def interfaceScreen(self, iEra): # K-Mod note: I've taken out all reference to X_SCREEN and Y_SCREEN, and instead set it up to be automatically centered. (I haven't left the old code in. I've just deleted it.) self.W_SCREEN = 775 self.H_SCREEN = 660 self.Y_TITLE = 20 self.X_EXIT = self.W_SCREEN / 2 - 50 self.Y_EXIT = self.H_SCREEN - 50 self.W_EXIT = 120 self.H_EXIT = 30 if (CyInterface().noTechSplash()): return 0 # player = PyPlayer(CyGame().getActivePlayer()) screen = CyGInterfaceScreen("EraMovieScreen" + str(iEra), CvScreenEnums.ERA_MOVIE_SCREEN) #screen.setDimensions(screen.centerX(0), screen.centerY(0), self.W_SCREEN, self.H_SCREEN) # This doesn't work. Those 'center' functions assume a particular window size. (not original code) screen.setDimensions(screen.getXResolution() / 2 - self.W_SCREEN / 2, screen.getYResolution() / 2 - self.H_SCREEN / 2 - 70, self.W_SCREEN, self.H_SCREEN) # K-Mod screen.addPanel("EraMoviePanel", "", "", True, True, 0, 0, self.W_SCREEN, self.H_SCREEN, PanelStyles.PANEL_STYLE_MAIN) screen.showWindowBackground(True) screen.setRenderInterfaceOnly(False) screen.setSound("AS2D_NEW_ERA") screen.showScreen(PopupStates.POPUPSTATE_MINIMIZED, False) # Header... szHeader = localText.getText("TXT_KEY_ERA_SPLASH_SCREEN", (gc.getEraInfo(iEra).getTextKey(), )) szHeaderId = "EraTitleHeader" + str(iEra) screen.setText(szHeaderId, "Background", szHeader, CvUtil.FONT_CENTER_JUSTIFY, self.W_SCREEN / 2, self.Y_TITLE, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) screen.setButtonGFC("EraExit" + str(iEra), localText.getText("TXT_KEY_MAIN_MENU_OK", ()), "", self.X_EXIT, self.Y_EXIT, self.W_EXIT, self.H_EXIT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD) # Play the movie if iEra == 1: szMovie = "Art/Movies/Era/Era01-Classical.dds" elif iEra == 2: szMovie = "Art/Movies/Era/Era02-Medeival.dds" elif iEra == 3: szMovie = "Art/Movies/Era/Era03-Renaissance.dds" elif iEra == 4: szMovie = "Art/Movies/Era/Era04-Industrial.dds" else: szMovie = "Art/Movies/Era/Era05-Modern.dds" screen.addDDSGFC("EraMovieMovie" + str(iEra), szMovie, 27, 50, 720, 540, WidgetTypes.WIDGET_GENERAL, -1, -1) return 0
def interfaceScreen (self, iFinishedProject): #create screen screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN) #setup panel self.windowWidth = screen.getXResolution() self.windowHeight = screen.getYResolution() screen.setDimensions(0, 0, self.windowWidth, self.windowHeight) self.W_SCREEN = 400 self.X_SCREEN = self.windowWidth - self.W_SCREEN - 10 self.H_SCREEN = 768 self.Y_SCREEN = self.windowHeight / 2 - self.H_SCREEN / 2 self.Y_TITLE = self.Y_SCREEN + 20 self.activeProject = iFinishedProject self.PADDING = 15 self.W_EXIT = 120 self.H_EXIT = 40 self.X_EXIT = self.X_SCREEN + self.W_SCREEN - self.W_EXIT - self.PADDING self.Y_EXIT = self.Y_SCREEN + self.H_SCREEN - self.H_EXIT - self.PADDING self.W_LAUNCH = 100 self.H_LAUNCH = 60 self.X_LAUNCH = self.X_SCREEN - self.PADDING - self.W_LAUNCH self.Y_LAUNCH = self.Y_SCREEN + self.H_SCREEN - self.H_LAUNCH - self.PADDING self.X_LAUNCH_LABEL1 = self.X_SCREEN + self.PADDING self.Y_LAUNCH_LABEL1 = self.Y_LAUNCH + 8 self.X_LAUNCH_LABEL2 = self.X_LAUNCH_LABEL1 self.Y_LAUNCH_LABEL2 = self.Y_LAUNCH + 32 self.TYPE_BUTTON = 0 self.ZOOM_BUTTON = 1 self.ADD_BUTTON = 2 self.LAUNCH_BUTTON = 3 #main panel screen.addPanel("SpaceShipMainPanel", "", "", True, True, self.X_SCREEN, self.Y_SCREEN, self.W_SCREEN, self.H_SCREEN, PanelStyles.PANEL_STYLE_EMPTY) #create list of spaceship components self.componentProjects = [] self.spaceVictory = -1 for i in xrange(gc.getNumProjectInfos()): component = gc.getProjectInfo(i) if (component.isSpaceship()): self.spaceVictory = component.getVictoryPrereq() self.componentProjects.append(i); #title text self.finishedLabelX = 10 self.finishedLabelY = 10 self.finishedLabelX2 = self.finishedLabelX self.finishedLabelY2 = self.finishedLabelY + 30 if(self.activeProject >= 0): screen.setLabel("FinishedLabel", "SpaceShipMainPanel", "<color=255,255,0><font=4>" + localText.getText("TXT_KEY_WONDER_SCREEN_TEXT", (gc.getProjectInfo(self.activeProject).getDescription(),)) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.finishedLabelX, self.finishedLabelY, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) screen.setLabel("FinishedLabel2", "SpaceShipMainPanel", "<color=255,255,0><font=4>" + localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_ADD_COMPONENT", ()) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.finishedLabelX2, self.finishedLabelY2, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) else: #check if landed on alpha centauri activeTeam = gc.getGame().getActiveTeam() victoryCountdown = gc.getTeam(activeTeam).getVictoryCountdown(self.spaceVictory) gameState = gc.getGame().getGameState() if(((gameState == GameStateTypes.GAMESTATE_EXTENDED) and (victoryCountdown > 0)) or (victoryCountdown == 0)): screen.setLabel("FinishedLabel", "SpaceShipMainPanel", "<color=255,255,0><font=4>" + localText.getText("TXT_KEY_SPACE_SHIP_ALPHA_CENTAURI", ()) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.finishedLabelX, self.finishedLabelY, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) else: #normal welcome screen.setLabel("FinishedLabel", "SpaceShipMainPanel", "<color=255,255,0><font=4>" + localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_WELCOME", ()) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.finishedLabelX, self.finishedLabelY, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) if (victoryCountdown > 0): # K-Mod (success chance is now shown near the launch button) screen.setLabel("FinishedLabel2", "SpaceShipMainPanel", "<color=255,255,0><font=4>" + localText.getText("TXT_KEY_SPACESHIP_CHANCE_OF_SUCCESS", (gc.getTeam(gc.getGame().getActiveTeam()).getLaunchSuccessRate(self.spaceVictory), )) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.finishedLabelX2, self.finishedLabelY2, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) #component panels self.numComponents = len(self.componentProjects) self.componentPanelYOffset = 10 self.componentPanelXOffset = 10 self.componentPanelHeight = self.H_SCREEN / (self.numComponents + 1) self.componentPanelHeightExtra = 10 self.componentPanelWidth = self.W_SCREEN - 2 * self.componentPanelXOffset self.componentNameXOffset = 12 self.componentNameYOffset = 10 self.componentTypeWidth = 60 self.componentTypeHeight = 30 self.componentTypeXOffset = self.componentPanelWidth - self.componentTypeWidth - 10 self.componentTypeYOffset = 35 self.componentZoomWidth = 60 self.componentZoomHeight = 30 self.componentZoomXOffset = self.componentPanelWidth - self.componentZoomWidth - 10 self.componentZoomYOffset = 65 self.componentAddWidth = 60 self.componentAddHeight = 60 self.componentAddXOffset = 10 self.componentAddYOffset = 35 self.componentModelHeight = self.componentPanelHeight self.componentModelWidth = 2 * self.componentModelHeight self.componentModelXOffset = (self.componentPanelWidth - self.componentModelWidth) / 2 self.componentModelYOffset = 0 self.componentCompletedLabelXOffset = 12 self.componentCompletedLabelYOffset = 40 self.componentRequiredLabelXOffset = 12 self.componentRequiredLabelYOffset = 55 self.componentInProductionLabelXOffset = 12 self.componentInProductionLabelYOffset = 70 screen.setSpaceShip(self.activeProject) self.rebuildComponentPanel() #show spaceship screen screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False) return 0
def interfaceScreen(self): player = gc.getPlayer(gc.getGame().getActivePlayer()) # Create a new screen, called DomesticAdvisor, using the file CvDomesticAdvisor.py for input screen = CyGInterfaceScreen("DomesticAdvisor", CvScreenEnums.DOMESTIC_ADVISOR) self.nScreenWidth = screen.getXResolution() - 30 self.nScreenHeight = screen.getYResolution() - 250 self.nTableWidth = self.nScreenWidth - 35 self.nTableHeight = self.nScreenHeight - 85 self.nNormalizedTableWidth = 970 self.nFirstSpecialistX = 30 self.nSpecialistY = self.nScreenHeight - 55 self.nSpecialistWidth = 32 self.nSpecialistLength = 32 self.nSpecialistDistance = 100 # Offset from Specialist Image/Size for the Specialist Plus/Minus buttons self.nPlusOffsetX = -4 self.nMinusOffsetX = 16 self.nPlusOffsetY = self.nMinusOffsetY = 30 self.nPlusWidth = self.nPlusHeight = self.nMinusWidth = self.nMinusHeight = 20 # Offset from Specialist Image for the Specialist Text self.nSpecTextOffsetX = 40 self.nSpecTextOffsetY = 10 screen.setRenderInterfaceOnly(True) screen.setDimensions(15, 100, self.nScreenWidth, self.nScreenHeight) screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False) # Here we set the background widget and exit button, and we show the screen screen.addPanel("DomesticAdvisorBG", u"", u"", True, False, 0, 0, self.nScreenWidth, self.nScreenHeight, PanelStyles.PANEL_STYLE_MAIN) screen.setText( "DomesticExit", "Background", localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ()).upper(), CvUtil.FONT_RIGHT_JUSTIFY, self.nScreenWidth - 25, self.nScreenHeight - 45, -0.1, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1) bCanLiberate = False (loopCity, iter) = player.firstCity(False) while loopCity: if loopCity.getLiberationPlayer(False) != -1: # UNOFFICIAL_PATCH begin if not gc.getTeam( gc.getPlayer(loopCity.getLiberationPlayer(False)). getTeam()).isAtWar(CyGame().getActiveTeam()): bCanLiberate = True break # UNOFFICIAL_PATCH end (loopCity, iter) = player.nextCity(iter, False) if bCanLiberate or player.canSplitEmpire(): screen.setImageButton( "DomesticSplit", "", self.nScreenWidth - 180, self.nScreenHeight - 45, 28, 28, WidgetTypes.WIDGET_ACTION, gc.getControlInfo( ControlTypes.CONTROL_FREE_COLONY).getActionInfoIndex(), -1) screen.setStyle("DomesticSplit", "Button_HUDAdvisorVictory_Style") # Erase the flag? CyInterface().setDirty(InterfaceDirtyBits.MiscButtons_DIRTY_BIT, True) # Draw the city list... self.drawContents()