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): 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()