def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBGameDataScreen", CvScreenEnums.WB_GAMEDATA) global iChange global bHiddenOption global bRepeat global iSelectedCiv global iSelectedLeader global bRemove if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 12: WBStoredDataScreen.WBStoredDataScreen( self.top).interfaceScreen() elif iIndex == 13: WBPlayerEnabledScreen.WBPlayerEnabledScreen( self.top).interfaceScreen() elif inputClass.getFunctionName() == "ChangeBy": if bRemove: iChange = -screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) else: iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "ChangeType": bRemove = not bRemove iChange = -iChange elif inputClass.getFunctionName().find("StartYear") > -1: if inputClass.getData1() == 1030: CyGame().setStartYear(CyGame().getStartYear() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setStartYear(CyGame().getStartYear() - abs(iChange)) self.placeStats() elif inputClass.getFunctionName().find("MaxCityElimination") > -1: if inputClass.getData1() == 1030: CyGame().setMaxCityElimination( CyGame().getMaxCityElimination() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setMaxCityElimination( max(0, CyGame().getMaxCityElimination() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("GameTurn") > -1: if inputClass.getData1() == 1030: iChange = min( abs(iChange), CyGame().getMaxTurns() - CyGame().getElapsedGameTurns()) CyGame().setGameTurn(CyGame().getGameTurn() + iChange) CyGame().changeMaxTurns(-iChange) elif inputClass.getData1() == 1031: iChange = min(CyGame().getGameTurn(), abs(iChange)) CyGame().setGameTurn(CyGame().getGameTurn() - iChange) CyGame().changeMaxTurns(iChange) self.placeStats() elif inputClass.getFunctionName().find("TargetScore") > -1: if inputClass.getData1() == 1030: CyGame().setTargetScore(CyGame().getTargetScore() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setTargetScore( max(0, CyGame().getTargetScore() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("EstimateEndTurn") > -1: if inputClass.getData1() == 1030: CyGame().setEstimateEndTurn(CyGame().getEstimateEndTurn() + iChange) elif inputClass.getData1() == 1031: CyGame().setEstimateEndTurn( max(0, CyGame().getEstimateEndTurn() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("NukesExploded") > -1: if inputClass.getData1() == 1030: CyGame().changeNukesExploded(abs(iChange)) elif inputClass.getData1() == 1031: CyGame().changeNukesExploded( -min(CyGame().getNukesExploded(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("MaxTurns") > -1: if inputClass.getData1() == 1030: CyGame().changeMaxTurns(abs(iChange)) elif inputClass.getData1() == 1031: CyGame().changeMaxTurns( -min(CyGame().getMaxTurns(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("TradeRoutes") > -1: if inputClass.getData1() == 1030: CyGame().changeTradeRoutes( min( abs(iChange), gc.getDefineINT("MAX_TRADE_ROUTES") - gc.getDefineINT("INITIAL_TRADE_ROUTES") - CyGame().getTradeRoutes())) elif inputClass.getData1() == 1031: CyGame().changeTradeRoutes( -min(CyGame().getTradeRoutes(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("AIAutoPlay") > -1: if inputClass.getData1() == 1030: CyGame().setAIAutoPlay(CyGame().getAIAutoPlay() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setAIAutoPlay( max(0, CyGame().getAIAutoPlay() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName() == "WBGameOptions": iGameOption = inputClass.getData2() if iGameOption < gc.getNumGameOptionInfos(): CyGame().setOption(iGameOption, not CyGame().isOption(iGameOption)) self.checkOptions(iGameOption) else: # Enabling/disabling secondary civs if iGameOption < 2000: iItem = iGameOption - 1000 data.setPlayerEnabled(iItem, not data.isPlayerEnabled(iItem)) # Enabling/disabling RFC options elif iGameOption == 2000: data.bIgnoreAI = not data.bIgnoreAI elif iGameOption == 2001: data.bUnlimitedSwitching = not data.bUnlimitedSwitching elif iGameOption == 2002: data.bNoCongressOption = not data.bNoCongressOption elif iGameOption == 2003: data.bNoPlagues = not data.bNoPlagues # Stored Variables elif iGameOption == 3001: data.bAlreadySwitched = not data.bAlreadySwitched elif iGameOption == 3002 and cong.isCongressEnabled(): data.iCongressTurns = max(1, data.iCongressTurns + iChange) self.placeGameOptions() elif inputClass.getFunctionName() == "HiddenOptions": bHiddenOption = not bHiddenOption self.placeGameOptions() elif inputClass.getFunctionName() == "AllowsRepeat": bRepeat = not bRepeat iSelectedCiv = -1 iSelectedLeader = -1 self.placeNewPlayer() elif inputClass.getFunctionName() == "WBNewCiv": iSelectedCiv = inputClass.getData2() iSelectedLeader = -1 self.interfaceScreen() elif inputClass.getFunctionName() == "WBNewLeader": iSelectedLeader = inputClass.getData2() self.interfaceScreen() elif inputClass.getFunctionName() == "CreatePlayer": for i in xrange(gc.getMAX_CIV_PLAYERS()): if not gc.getPlayer(i).isEverAlive(): CyGame().addPlayer(i, iSelectedLeader, iSelectedCiv) break screen.hideScreen() self.top.m_iCurrentPlayer = i self.top.normalPlayerTabModeCB() elif inputClass.getFunctionName() == "GameEditScriptData": popup = Popup.PyPopup(4444, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(CyTranslator().getText( "TXT_KEY_WB_SCRIPT", ())) popup.createEditBox(CyGame().getScriptData()) popup.launch() return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBGameDataScreen", CvScreenEnums.WB_GAMEDATA) global iChange global bHiddenOption global bRepeat global iSelectedCiv global iSelectedLeader global bRemove if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData("CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen(self.top.m_iCurrentPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen(self.top.m_iCurrentPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(self.top.m_iCurrentPlayer) elif iIndex == 12: WBStoredDataScreen.WBStoredDataScreen(self.top).interfaceScreen() elif inputClass.getFunctionName() == "ChangeBy": if bRemove: iChange = -screen.getPullDownData("ChangeBy", screen.getSelectedPullDownID("ChangeBy")) else: iChange = screen.getPullDownData("ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "ChangeType": bRemove = not bRemove iChange = -iChange elif inputClass.getFunctionName().find("StartYear") > -1: if inputClass.getData1() == 1030: CyGame().setStartYear(CyGame().getStartYear() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setStartYear(CyGame().getStartYear() - abs(iChange)) self.placeStats() elif inputClass.getFunctionName().find("MaxCityElimination") > -1: if inputClass.getData1() == 1030: CyGame().setMaxCityElimination(CyGame().getMaxCityElimination() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setMaxCityElimination(max(0, CyGame().getMaxCityElimination() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("GameTurn") > -1: if inputClass.getData1() == 1030: iChange = min(abs(iChange), CyGame().getMaxTurns() - CyGame().getElapsedGameTurns()) CyGame().setGameTurn(CyGame().getGameTurn() + iChange) CyGame().changeMaxTurns(- iChange) elif inputClass.getData1() == 1031: iChange = min(CyGame().getGameTurn(), abs(iChange)) CyGame().setGameTurn(CyGame().getGameTurn() - iChange) CyGame().changeMaxTurns(iChange) self.placeStats() elif inputClass.getFunctionName().find("TargetScore") > -1: if inputClass.getData1() == 1030: CyGame().setTargetScore(CyGame().getTargetScore() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setTargetScore(max(0, CyGame().getTargetScore() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("EstimateEndTurn") > -1: if inputClass.getData1() == 1030: CyGame().setEstimateEndTurn(CyGame().getEstimateEndTurn() + iChange) elif inputClass.getData1() == 1031: CyGame().setEstimateEndTurn(max(0, CyGame().getEstimateEndTurn() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("NukesExploded") > -1: if inputClass.getData1() == 1030: CyGame().changeNukesExploded(abs(iChange)) elif inputClass.getData1() == 1031: CyGame().changeNukesExploded(- min(CyGame().getNukesExploded(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("MaxTurns") > -1: if inputClass.getData1() == 1030: CyGame().changeMaxTurns(abs(iChange)) elif inputClass.getData1() == 1031: CyGame().changeMaxTurns(- min(CyGame().getMaxTurns(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("TradeRoutes") > -1: if inputClass.getData1() == 1030: CyGame().changeTradeRoutes(min(abs(iChange), gc.getDefineINT("MAX_TRADE_ROUTES") - gc.getDefineINT("INITIAL_TRADE_ROUTES") - CyGame().getTradeRoutes())) elif inputClass.getData1() == 1031: CyGame().changeTradeRoutes(- min(CyGame().getTradeRoutes(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("AIAutoPlay") > -1: if inputClass.getData1() == 1030: CyGame().setAIAutoPlay(CyGame().getAIAutoPlay() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setAIAutoPlay(max(0, CyGame().getAIAutoPlay() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName() == "WBGameOptions": iGameOption = inputClass.getData2() if iGameOption < gc.getNumGameOptionInfos(): CyGame().setOption(iGameOption, not CyGame().isOption(iGameOption)) self.checkOptions(iGameOption) else: # Enabling/disabling secondary civs if iGameOption < 2000: iItem = iGameOption - 1000 data.setPlayerEnabled(iItem, not data.isPlayerEnabled(iItem)) # Enabling/disabling RFC options elif iGameOption == 2000: data.bNoAIStability = not data.bNoAIStability elif iGameOption == 2001: data.bNoHumanStability = not data.bNoHumanStability elif iGameOption == 2002: data.bIgnoreAI = not data.bIgnoreAI elif iGameOption == 2003: data.bUnlimitedSwitching = not data.bUnlimitedSwitching elif iGameOption == 2004: data.bNoCongressOption = not data.bNoCongressOption elif iGameOption == 2005: data.bNoPlagues = not data.bNoPlagues # Stored Variables elif iGameOption == 3001: data.bAlreadySwitched = not data.bAlreadySwitched elif iGameOption == 3002 and cong.isCongressEnabled(): data.iCongressTurns = max(1, data.iCongressTurns+iChange) self.placeGameOptions() elif inputClass.getFunctionName() == "HiddenOptions": bHiddenOption = not bHiddenOption self.placeGameOptions() elif inputClass.getFunctionName() == "AllowsRepeat": bRepeat = not bRepeat iSelectedCiv = -1 iSelectedLeader = -1 self.placeNewPlayer() elif inputClass.getFunctionName() == "WBNewCiv": iSelectedCiv = inputClass.getData2() iSelectedLeader = -1 self.interfaceScreen() elif inputClass.getFunctionName() == "WBNewLeader": iSelectedLeader = inputClass.getData2() self.interfaceScreen() elif inputClass.getFunctionName() == "CreatePlayer": for i in xrange(gc.getMAX_CIV_PLAYERS()): if not gc.getPlayer(i).isEverAlive(): CyGame().addPlayer(i, iSelectedLeader, iSelectedCiv) break screen.hideScreen() self.top.m_iCurrentPlayer = i self.top.normalPlayerTabModeCB() elif inputClass.getFunctionName() == "GameEditScriptData": popup = Popup.PyPopup(4444, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(CyTranslator().getText("TXT_KEY_WB_SCRIPT", ())) popup.createEditBox(CyGame().getScriptData()) popup.launch() return 1
def placeGameOptions(self): screen = CyGInterfaceScreen("WBGameDataScreen", CvScreenEnums.WB_GAMEDATA) sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bHiddenOption: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.setText( "HiddenOptions", "Background", "<font=3b>" + sColor + CyTranslator().getText("TXT_KEY_WB_SHOW_HIDDEN", ()) + "</color></font>", CvUtil.FONT_RIGHT_JUSTIFY, screen.getXResolution() - 20, self.iGameOption_Y - 30, -0.1, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) iWidth = screen.getXResolution() - 40 iHeight = (screen.getYResolution() - self.iGameOption_Y - 40) / 24 * 24 + 2 nColumns = 3 iWidth1 = 80 iWidth2 = iWidth / nColumns - iWidth1 screen.addTableControlGFC("WBGameOptions", nColumns * 2, 20, self.iGameOption_Y, iWidth, iHeight, False, False, 24, 24, TableStyles.TABLE_STYLE_STANDARD) for i in xrange(nColumns): screen.setTableColumnHeader("WBGameOptions", i * 2, "", iWidth2) screen.setTableColumnHeader("WBGameOptions", i * 2 + 1, "", iWidth1) lList = [] for item in xrange(gc.getNumGameOptionInfos()): Info = gc.getGameOptionInfo(item) if Info.getVisible() or bHiddenOption: lList.append([Info.getDescription(), item]) lList.sort() # Merijn: Add extra DoC options lList2 = [] lList2.append( [CyTranslator().getText("TXT_KEY_WB_IGNORE_AI_UHV", ()), 2000]) lList2.append([ CyTranslator().getText("TXT_KEY_WB_UNLIMITED_SWITCHING", ()), 2001 ]) lList2.append( [CyTranslator().getText("TXT_KEY_WB_NO_CONGRESS", ()), 2002]) lList2.append( [CyTranslator().getText("TXT_KEY_WB_NO_PLAGUE", ()), 2003]) lList2.sort() # Stored variables lList3 = [] lList3.append( [CyTranslator().getText("TXT_KEY_WB_ALREADY_SWITCHED", ()), 3001]) lList3.append( [CyTranslator().getText("TXT_KEY_WB_CONGRESS_TURNS", ()), 3002]) lList3.sort() iNumRows = (len(lList) + nColumns - 1) / nColumns iNumRows2 = iNumRows + 3 + max(len(lSecondaryCivs), len(lList2), len(lList3)) for i in xrange(iNumRows2): screen.appendTableRow("WBGameOptions") for i in xrange(len(lList)): iColumn = i / iNumRows iRow = i % iNumRows item = lList[i][1] bEnabled = CyGame().isOption(item) bDefault = False if item in [6, 11]: # Aggressive AI, No Tech Brokering bDefault = True sText = self.colorText(lList[i][0], bEnabled) screen.setTableText("WBGameOptions", iColumn * 2, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_LEFT_JUSTIFY) sText = self.colorText( CyTranslator().getText("TXT_KEY_WB_DEFAULT", ()), bDefault) screen.setTableText("WBGameOptions", iColumn * 2 + 1, iRow, sText, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY) # Merijn: extra rows for secondary civs and RFC options screen.setTableText( "WBGameOptions", 0, iNumRows + 2, CyTranslator().getText("TXT_KEY_WB_SECONDARY_CIVS", ()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) screen.setTableText( "WBGameOptions", 2, iNumRows + 2, CyTranslator().getText("TXT_KEY_WB_RFC_OPTIONS", ()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) screen.setTableText( "WBGameOptions", 4, iNumRows + 2, CyTranslator().getText("TXT_KEY_WB_RFC_VARIABLES", ()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) iRow = iNumRows + 3 for iCiv in lSecondaryCivs: bEnabled = data.isPlayerEnabled(iCiv) bDefault = True if iCiv in [iHarappa, iPolynesia]: bDefault = False sText = self.colorText( gc.getPlayer(iCiv).getCivilizationShortDescription(0), bEnabled) screen.setTableText("WBGameOptions", 0, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, 1000 + iCiv, CvUtil.FONT_LEFT_JUSTIFY) sText = self.colorText( CyTranslator().getText("TXT_KEY_WB_DEFAULT", ()), bDefault) screen.setTableText("WBGameOptions", 1, iRow, sText, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY) iRow += 1 for i in xrange(len(lList2)): item = lList2[i][1] iRow = iNumRows + 3 + i bEnabled = False bDefault = False if item == 2000: bEnabled = data.bIgnoreAI bDefault = True elif item == 2001: bEnabled = data.bUnlimitedSwitching elif item == 2002: bEnabled = data.bNoCongressOption elif item == 2003: bEnabled = data.bNoPlagues sText = self.colorText(lList2[i][0], bEnabled) screen.setTableText("WBGameOptions", 2, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_LEFT_JUSTIFY) sText = self.colorText( CyTranslator().getText("TXT_KEY_WB_DEFAULT", ()), bDefault) screen.setTableText("WBGameOptions", 3, iRow, sText, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY) for i in xrange(len(lList3)): item = lList3[i][1] iRow = iNumRows + 3 + i bEnabled = False bWhite = False if item == 3001: bEnabled = data.bAlreadySwitched elif item == 3002: bWhite = True sText = self.colorText(lList3[i][0], bEnabled, bWhite) screen.setTableText("WBGameOptions", 4, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_LEFT_JUSTIFY) if item == 3002: if not cong.isCongressEnabled(): iTurns = -1 else: iTurns = data.iCongressTurns sText = self.colorText(str(iTurns), True, True) screen.setTableText("WBGameOptions", 5, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_CENTER_JUSTIFY)
def placeGameOptions(self): screen = CyGInterfaceScreen( "WBGameDataScreen", CvScreenEnums.WB_GAMEDATA) sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bHiddenOption: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.setText("HiddenOptions", "Background", "<font=3b>" + sColor + CyTranslator().getText("TXT_KEY_WB_SHOW_HIDDEN",()) + "</color></font>", CvUtil.FONT_RIGHT_JUSTIFY, screen.getXResolution() - 20, self.iGameOption_Y - 30, -0.1, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) iWidth = screen.getXResolution() - 40 iHeight = (screen.getYResolution() - self.iGameOption_Y - 40) /24 * 24 + 2 nColumns = 3 iWidth1 = 80 iWidth2 = iWidth / nColumns - iWidth1 screen.addTableControlGFC("WBGameOptions", nColumns * 2, 20, self.iGameOption_Y, iWidth, iHeight, False, False, 24, 24, TableStyles.TABLE_STYLE_STANDARD) for i in xrange(nColumns): screen.setTableColumnHeader("WBGameOptions", i * 2, "", iWidth2) screen.setTableColumnHeader("WBGameOptions", i * 2 + 1, "", iWidth1) lList = [] for item in xrange(gc.getNumGameOptionInfos()): Info = gc.getGameOptionInfo(item) if Info.getVisible() or bHiddenOption: lList.append([Info.getDescription(), item]) lList.sort() # Merijn: Add extra DoC options lList2 = [] lList2.append([CyTranslator().getText("TXT_KEY_WB_NO_STABILITY", ()), 2000]) lList2.append([CyTranslator().getText("TXT_KEY_WB_NO_HUMAN_STABILITY", ()), 2001]) lList2.append([CyTranslator().getText("TXT_KEY_WB_IGNORE_AI_UHV", ()), 2002]) lList2.append([CyTranslator().getText("TXT_KEY_WB_UNLIMITED_SWITCHING", ()), 2003]) lList2.append([CyTranslator().getText("TXT_KEY_WB_NO_CONGRESS", ()), 2004]) lList2.append([CyTranslator().getText("TXT_KEY_WB_NO_PLAGUE", ()), 2005]) lList2.sort() # Stored variables lList3 = [] lList3.append([CyTranslator().getText("TXT_KEY_WB_ALREADY_SWITCHED", ()), 3001]) lList3.append([CyTranslator().getText("TXT_KEY_WB_CONGRESS_TURNS", ()), 3002]) lList3.sort() iNumRows = (len(lList) + nColumns - 1) / nColumns iNumRows2 = iNumRows + 3 + max(len(lSecondaryCivs), len(lList2), len(lList3)) for i in xrange(iNumRows2): screen.appendTableRow("WBGameOptions") for i in xrange(len(lList)): iColumn = i / iNumRows iRow = i % iNumRows item = lList[i][1] bEnabled = CyGame().isOption(item) bDefault = False if item in [6, 11]: # Aggressive AI, No Tech Brokering bDefault = True sText = self.colorText(lList[i][0], bEnabled) screen.setTableText("WBGameOptions", iColumn * 2, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_LEFT_JUSTIFY) sText = self.colorText(CyTranslator().getText("TXT_KEY_WB_DEFAULT", ()), bDefault) screen.setTableText("WBGameOptions", iColumn * 2 + 1, iRow, sText, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY) # Merijn: extra rows for secondary civs and RFC options screen.setTableText("WBGameOptions", 0, iNumRows + 2, CyTranslator().getText("TXT_KEY_WB_SECONDARY_CIVS", ()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) screen.setTableText("WBGameOptions", 2, iNumRows + 2, CyTranslator().getText("TXT_KEY_WB_RFC_OPTIONS", ()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) screen.setTableText("WBGameOptions", 4, iNumRows + 2, CyTranslator().getText("TXT_KEY_WB_RFC_VARIABLES", ()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) iRow = iNumRows + 3 for iCiv in lSecondaryCivs: bEnabled = data.isPlayerEnabled(iCiv) bDefault = True if iCiv in [iHarappa, iPolynesia]: bDefault = False sText = self.colorText(gc.getPlayer(iCiv).getCivilizationShortDescription(0), bEnabled) screen.setTableText("WBGameOptions", 0, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, 1000+iCiv, CvUtil.FONT_LEFT_JUSTIFY) sText = self.colorText(CyTranslator().getText("TXT_KEY_WB_DEFAULT", ()), bDefault) screen.setTableText("WBGameOptions", 1, iRow, sText, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY) iRow += 1 for i in xrange(len(lList2)): item = lList2[i][1] iRow = iNumRows + 3 + i bEnabled = False bDefault = False if item == 2000: bEnabled = data.bNoAIStability elif item == 2001: bEnabled = data.bNoHumanStability elif item == 2002: bEnabled = data.bIgnoreAI bDefault = True elif item == 2003: bEnabled = data.bUnlimitedSwitching elif item == 2004: bEnabled = data.bNoCongressOption elif item == 2005: bEnabled = data.bNoPlagues sText = self.colorText(lList2[i][0], bEnabled) screen.setTableText("WBGameOptions", 2, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_LEFT_JUSTIFY) sText = self.colorText(CyTranslator().getText("TXT_KEY_WB_DEFAULT", ()), bDefault) screen.setTableText("WBGameOptions", 3, iRow, sText, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY) for i in xrange(len(lList3)): item = lList3[i][1] iRow = iNumRows + 3 + i bEnabled = False bWhite = False if item == 3001: bEnabled = data.bAlreadySwitched elif item == 3002: bWhite = True sText = self.colorText(lList3[i][0], bEnabled, bWhite) screen.setTableText("WBGameOptions", 4, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_LEFT_JUSTIFY) if item == 3002: if not cong.isCongressEnabled(): iTurns = -1 else: iTurns = data.iCongressTurns sText = self.colorText(str(iTurns), True, True) screen.setTableText("WBGameOptions", 5, iRow, sText, "", WidgetTypes.WIDGET_PYTHON, 1028, item, CvUtil.FONT_CENTER_JUSTIFY)