def drawSpecialists(self): screen = CyGInterfaceScreen("DomesticAdvisor", CvScreenEnums.DOMESTIC_ADVISOR) for i in xrange(gc.getNumSpecialistInfos()): if (gc.getSpecialistInfo(i).isVisible()): szName = "SpecialistImage" + str(i) screen.setImageButton( szName, gc.getSpecialistInfo(i).getTexture(), self.nFirstSpecialistX + (self.nSpecialistDistance * i), self.nSpecialistY, self.nSpecialistWidth, self.nSpecialistLength, WidgetTypes.WIDGET_CITIZEN, i, -1) screen.hide(szName) szName = "SpecialistPlus" + str(i) screen.setButtonGFC( szName, u"", "", self.nFirstSpecialistX + (self.nSpecialistDistance * i) + self.nPlusOffsetX, self.nSpecialistY + self.nPlusOffsetY, self.nPlusWidth, self.nPlusHeight, WidgetTypes.WIDGET_CHANGE_SPECIALIST, i, 1, ButtonStyles.BUTTON_STYLE_CITY_PLUS) screen.hide(szName) szName = "SpecialistMinus" + str(i) screen.setButtonGFC( szName, u"", "", self.nFirstSpecialistX + (self.nSpecialistDistance * i) + self.nMinusOffsetX, self.nSpecialistY + self.nMinusOffsetY, self.nMinusWidth, self.nMinusHeight, WidgetTypes.WIDGET_CHANGE_SPECIALIST, i, -1, ButtonStyles.BUTTON_STYLE_CITY_MINUS) screen.hide(szName) szName = "SpecialistText" + str(i) screen.setLabel( szName, "Background", "", CvUtil.FONT_LEFT_JUSTIFY, self.nFirstSpecialistX + (self.nSpecialistDistance * i) + self.nSpecTextOffsetX, self.nSpecialistY + self.nSpecTextOffsetY, 0, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) screen.hide(szName)
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()