home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 January / Gamestar_80_2006-01_dvd.iso / Dema / Civilization4 / data1.cab / Civ4DemoComponent / Assets / Python / Screens / CvIntroMovieScreen.py < prev    next >
Encoding:
Python Source  |  2005-11-09  |  3.8 KB  |  104 lines

  1. ## Sid Meier's Civilization 4
  2. ## Copyright Firaxis Games 2005
  3. from CvPythonExtensions import *
  4. import CvUtil
  5. import ScreenInput
  6. import CvScreenEnums
  7.  
  8. # globals
  9. gc = CyGlobalContext()
  10. ArtFileMgr = CyArtFileMgr()
  11. localText = CyTranslator()
  12.  
  13. class CvIntroMovieScreen:
  14.     "Intro Movie Screen"
  15.     bMovieState = 0
  16.     def interfaceScreen (self):
  17.         
  18.         self.currentMovie = "ART_DEF_MOVIE_2K_INTRO"
  19.         self.X_SCREEN = 0
  20.         self.Y_SCREEN = 0
  21.         self.W_SCREEN = 1024
  22.         self.H_SCREEN = 768
  23.         self.Y_TITLE = 12
  24.         self.BORDER_HEIGHT = 100
  25.         
  26.         self.X_EXIT = 410
  27.         self.Y_EXIT = 326
  28.         
  29.         game = CyGame()
  30.         if ( game.isNetworkMultiPlayer() or game.isPitbossHost()):
  31.             return
  32.         
  33.         self.createMovieScreen(self.currentMovie)
  34.     
  35.     def createMovieScreen(self, movieArtDef):
  36.         # Create a new screen, called IntroMovieScreen, using the file CvIntroMovieScreen.py for input
  37.         screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
  38.         screen.setDimensions(screen.centerX(0), screen.centerY(0), -1, -1)
  39.         screen.setRenderInterfaceOnly(True)
  40.         screen.showWindowBackground( False )
  41.         screen.setShowFor( 0 )
  42.         
  43.         # Show the screen
  44.         screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)        
  45.         
  46.         screen.setButtonGFC("Exit", u"Your movies are not installed correctly.", "", #self.EXIT_TEXT,
  47.             self.X_EXIT, self.Y_EXIT, 400, 100, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD)
  48.         
  49.         # Play the movie
  50.         movieFilePath = CyArtFileMgr().getMovieArtInfo(movieArtDef).getPath()
  51.         print "PLAY", movieFilePath
  52.         screen.playMovie( movieFilePath, -1, -1, -1, -1, 0)
  53.         
  54.     def createLogoScreen(self):
  55.         screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
  56.         screen.setDimensions(screen.centerX(0), screen.centerY(0), 1024, 768)
  57.         screen.setRenderInterfaceOnly(True)
  58.         screen.showWindowBackground( False )
  59.         
  60.         # Show the screen
  61.         screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)
  62.         
  63.         # Background First
  64.         screen.setImageButton( "LogoBackground", ArtFileMgr.getInterfaceArtInfo("MAINMENU_LOAD").getPath(), -2, -2, 1028, 776, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  65.         
  66.         # Logos
  67.         screen.setImageButton( "Logos", ArtFileMgr.getInterfaceArtInfo("INTRO_LOGOS").getPath(), 256, 328, 512, 256, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  68.         
  69.         screen.setLabel( "LegalText1", "Background", "<font=2>" + localText.getText("TXT_LEGAL_LINE_1", ()) + "</font>", CvUtil.FONT_CENTER_JUSTIFY, 512, 654, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  70.         screen.setLabel( "LegalText2", "Background", "<font=2>" + localText.getText("TXT_LEGAL_LINE_2", ()) + "</font>", CvUtil.FONT_CENTER_JUSTIFY, 512, 674, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  71.         print "LOGO"
  72.         screen.setShowFor( 4000 )
  73.  
  74.     def closeScreen(self):
  75.         screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
  76.         screen.hideScreen()
  77.         
  78.     def hideScreen(self):
  79.         screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
  80.         screen.hideScreen()
  81.     
  82.     # Will handle the input for this screen...
  83.     def handleInput (self, inputClass):
  84.         screen = CyGInterfaceScreen( "IntroMovieScreen", CvScreenEnums.INTRO_MOVIE_SCREEN )
  85.         if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_MOVIE_DONE or inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED or inputClass.getNotifyCode() == NotifyCode.NOTIFY_CHARACTER):
  86.             if self.bMovieState == 2:
  87.                 return self.hideScreen()
  88.             elif self.bMovieState == 1:
  89.                 print "MS 2"
  90.                 self.bMovieState = 2
  91.                 self.currentMovie = "ART_DEF_MOVIE_2K_INTRO"
  92.                 self.closeScreen()
  93.                 self.createMovieScreen( "ART_DEF_MOVIE_INTRO" )
  94.             else:
  95.                 print "MS 1"
  96.                 self.bMovieState = 1
  97.                 self.closeScreen()
  98.                 self.createLogoScreen()
  99.         return 0
  100.  
  101.     def update(self, fDelta):
  102.         return
  103.  
  104.