def initAfterReload(): """ Initialize BUG and fires PythonReloaded event after reloading Python modules while game is still running. The first time this module is loaded after the game launches, the global context is not yet ready, and thus BUG cannot be initialized. When the Python modules are reloaded after being changed, however, this will reinitialize BUG and the main interface. """ import BugInit if BugInit.init(): try: import CvScreensInterface CvScreensInterface.reinitMainInterface() except: import BugUtil BugUtil.error("BugInit - failure rebuilding main interface after reloading Python modules") getEventManager().fireEvent("PythonReloaded") import CvMainInterface #added Sephi mainInterface = CvMainInterface.CvMainInterface() mainInterface.initState() # initialize BUG after Python modules have been reloaded initAfterReload()
def _delayedPythonCallUtil(_self, argsList): iArg1, iArg2 = argsList #print("delayedPythonCall triggerd with %i %i" % (iArg1, iArg2)) if iArg1 == 1 and iArg2 == 0: # To avoid nested redrawing of two threads (leads to CtD) # try to win the battle by periodical requests if getMousePos() # returns a valid value. #(If yes, drawing will not causes an 'unidentifiable C++ exception' # in fullscreen mode.) iRepeat = 1000 # Milliseconds till next check pt = CyInterface().getMousePos() #print("Mouse position (%i, %i)" % (int(pt.x), int(pt.y))) if pt.x == 0 and pt.y == 0: print("(ModUpdaterScreen) Hey, window not ready for drawing." "Wait %s milliseconds..." % (iRepeat, )) return iRepeat else: if not CvScreensInterface.modUpdaterScreen.FIRST_DRAWN: CvScreensInterface.showModUpdaterScreen() return 0 # Unhandled argument combination... Should not be reached. return 0
def init(): # called when parsing 'BUG Core.xml' import CvScreensInterface try: CvScreensInterface.initBugAdvisors() except AttributeError: import BugUtil BugUtil.error("Failed to call CvScreensInterface.initBugAdvisors")
def _delayedPythonCallUtil(_self, argsList): iArg1, iArg2 = argsList #print("delayedPythonCall triggerd with %i %i" % (iArg1, iArg2)) if iArg1 == 1 and iArg2 == 0: # To avoid nested redrawing of two threads (leads to CtD) # try to win the battle by periodical requests if getMousePos() # returns a valid value. #(If yes, drawing will not causes an 'unidentifiable C++ exception' # in fullscreen mode.) iRepeat = 1000 # Milliseconds till next check pt = CyInterface().getMousePos() #print("Mouse position (%i, %i)" % (int(pt.x), int(pt.y))) if pt.x == 0 and pt.y == 0: print("(ModUpdaterScreen) Hey, window not ready for drawing." "Wait %s milliseconds..." % (iRepeat,)) return iRepeat else: if not CvScreensInterface.modUpdaterScreen.FIRST_DRAWN: CvScreensInterface.showModUpdaterScreen() return 0 # Unhandled argument combination... Should not be reached. return 0
def __eventWBLandmarkPopupApply(self, playerID, userData, popupReturn): if (popupReturn.getEditBoxString(0)): szLandmark = popupReturn.getEditBoxString(0) if (len(szLandmark)): CvScreensInterface.getWorldBuilderScreen().setLandmarkCB( szLandmark) return
def handleInput(self, inputClass): 'Handles input for this screen' if inputClass.getNotifyCode() == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED: screen = self.getScreen() iIndex = screen.getSelectedPullDownID("DebugMenu") self.setActivePlayer(screen.getPullDownData("DebugMenu", iIndex)) self.placeContents() self.updateCivicCosts() self.updateRevolution() return 1 elif inputClass.getFunctionName().startswith("CivicButton") or inputClass.getFunctionName().startswith("CivicName"): if inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED: if inputClass.getFlags() & MouseFlags.MOUSE_RBUTTONUP: CvScreensInterface.pediaJumpToCivic((inputClass.getID(), )) else: # Select civic self.selectCivic(inputClass.getID()) self.showCivic(gc.getCivicInfo(inputClass.getID()).getCivicOptionType()) self.updateCivicCosts() self.updateRevolution() elif inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON: self.colorCivicTexts(inputClass.getID(), True) if self.hoverCivic(inputClass.getID(), True): # Highlight button self.showCivic(gc.getCivicInfo(inputClass.getID()).getCivicOptionType()) self.updateCivicCosts() self.updateRevolution() elif inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_OFF: self.colorCivicTexts(inputClass.getID(), False) if self.hoverCivic(inputClass.getID(), False): # Unhighlight button self.showCivic(gc.getCivicInfo(inputClass.getID()).getCivicOptionType()) self.updateCivicCosts() self.updateRevolution() return 1 elif inputClass.getFunctionName().startswith("CivicIcon"): if inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED: CvScreensInterface.pediaJumpToCivic((inputClass.getData1(), )) elif inputClass.getFunctionName() == "RevolutionButton": self.doRevolution() return 1 elif inputClass.getFunctionName() == "CancelButton": for i in xrange(gc.getNumCivicOptionInfos()): self.SelectedCivics[i] = self.PlayerCivics[i] self.DisplayedCivics[i] = self.PlayerCivics[i] self.placeContents() self.updateCivicCosts() self.updateRevolution() return 1 return 0
def _onWindowActivation(self, eventType, argsList): 'Called when the game window activates or deactivates' bActive = argsList[0] if not hasattr(CvScreensInterface, "showModUpdaterScreen"): CvModUpdaterScreen.integrate() # Show ModUpdater screen after Window switch if (bActive and -1 == CyGame().getActivePlayer() and not CyGame().isPitbossHost()): CvScreensInterface.showModUpdaterScreen()
def onWindowActivation(self, argsList): 'Called when the game window activates or deactivates' bActive = argsList[0] # Updater Mod if not hasattr(CvScreensInterface, "showModUpdaterScreen"): CvModUpdaterScreen.integrate() # Show ModUpdater screen after Window switch if( bActive and -1 == CyGame().getActivePlayer() and not CyGame().isPitbossHost()): CvScreensInterface.showModUpdaterScreen()
def preGameStart(): # BUG - core import CvEventInterface CvEventInterface.getEventManager().fireEvent("PreGameStart") # continue import CvScreensInterface if not CyGame().isPitbossHost(): # Preload the tech chooser..., only do this release builds, in debug build we may not be raising the tech chooser if not CyGlobalContext().isDebugBuild(): NiTextOut("Preloading tech chooser") CvScreensInterface.showTechChooser() CvScreensInterface.techChooser.hideScreen() NiTextOut("Loading main interface...") CvScreensInterface.showMainInterface()
def __eventWBScriptPopupBegin(self, argsList): popup = PyPopup.PyPopup(CvUtil.EventWBScriptPopup, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(localText.getText("TXT_KEY_WB_SCRIPT", ())) popup.createEditBox( CvScreensInterface.getWorldBuilderScreen().getCurrentScript()) popup.launch() return
def preGameStart(): import CvScreensInterface if not CyGame().isPitbossHost(): NiTextOut("Initializing font icons") # Load dynamic font icons into the icon map CvUtil.initDynamicFontIcons() if not CyGame().isPitbossHost(): # Preload the tech chooser..., only do this release builds, in debug build we may not be raising the tech chooser if (not gc.isDebugBuild()): NiTextOut("Preloading tech chooser") CvScreensInterface.showTechChooser() CvScreensInterface.techChooser.hideScreen() NiTextOut("Loading main interface...") CvScreensInterface.showMainInterface()
def initAfterReload(): """ Initialize BUG and fires PythonReloaded event after reloading Python modules while game is still running. The first time this module is loaded after the game launches, the global context is not yet ready, and thus BUG cannot be initialized. When the Python modules are reloaded after being changed, however, this will reinitialize BUG and the main interface. """ import BugInit import BugPath if not BugPath.isMac() and BugInit.init(): try: import CvScreensInterface CvScreensInterface.reinitMainInterface() except: import BugUtil BugUtil.error("BugInit - failure rebuilding main interface after reloading Python modules") getEventManager().fireEvent("PythonReloaded")
def CivicsButton(self, inputClass): if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED) : if (inputClass.getFlags() & MouseFlags.MOUSE_RBUTTONUP): CvScreensInterface.pediaJumpToCivic((inputClass.getID(), )) else: # Select button self.select(inputClass.getID()) self.drawHelpText(gc.getCivicInfo(inputClass.getID()).getCivicOptionType()) self.updateAnarchy() elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON) : # Highlight this button if self.highlight(inputClass.getID()): self.drawHelpText(gc.getCivicInfo(inputClass.getID()).getCivicOptionType()) self.updateAnarchy() elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_OFF) : if self.unHighlight(inputClass.getID()): self.drawHelpText(gc.getCivicInfo(inputClass.getID()).getCivicOptionType()) self.updateAnarchy() return 0
def onMouseEvent(self, argsList): 'mouse handler - returns 1 if the event was consumed' eventType,mx,my,px,py,interfaceConsumed,screens = argsList if ( px!=-1 and py!=-1 ): if ( eventType == self.EventLButtonDown ): if (self.bAllowCheats and self.bCtrl and self.bAlt and CyMap().plot(px,py).isCity() and not interfaceConsumed): # Launch Edit City Event self.beginEvent( CvUtil.EventEditCity, (px,py) ) return 1 elif (self.bAllowCheats and self.bCtrl and self.bShift and not interfaceConsumed): # Launch Place Object Event self.beginEvent( CvUtil.EventPlaceObject, (px, py) ) return 1 if ( eventType == self.EventBack ): return CvScreensInterface.handleBack(screens) elif ( eventType == self.EventForward ): return CvScreensInterface.handleForward(screens) return 0
def preGameStart(): import CvScreensInterface # BUG - core - start import CvEventInterface CvEventInterface.getEventManager().fireEvent("PreGameStart") # BUG - core - end if not CyGame().isPitbossHost(): NiTextOut("Initializing font icons") # Load dynamic font icons into the icon map CvUtil.initDynamicFontIcons() # if not CyGame().isPitbossHost(): # # Preload the tech chooser..., only do this release builds, in debug build we may not be raising the tech chooser # if (not gc.isDebugBuild()): # NiTextOut("Preloading tech chooser") # CvScreensInterface.showTechChooser(argsList) # CvScreensInterface.techChooser.hideScreen() NiTextOut("Loading main interface...") CvScreensInterface.showMainInterface()
def __init__(self, game=None, attrs=None): if game is None: game = BugCore.game self.game = game self.eventManager = CvEventInterface.getEventManager() self.options = BugOptions.getOptions() self.optionsScreen = CvScreensInterface.getBugOptionsScreen() self.attrs = attrs self.mod = None self.iniFile = None self.section = None self.option = None self.screen = None self.symbol = None
def __eventWBAllPlotsPopupBegin(self, argsList): CvScreensInterface.getWorldBuilderScreen().allPlotsCB() return
def __eventWBLandmarkPopupBegin(self, argsList): CvScreensInterface.getWorldBuilderScreen().setLandmarkCB("") #popup = PyPopup.PyPopup(CvUtil.EventWBLandmarkPopup, EventContextTypes.EVENTCONTEXT_ALL) #popup.createEditBox(localText.getText("TXT_KEY_WB_LANDMARK_START", ())) #popup.launch() return
def handleInput (self, inputClass): screen = self.getScreen() if not screen.isActive(): return HandleInputUtil.debugInput(inputClass) bAlt, bCtrl, bShift = self.InputData.getModifierKeys() iCode = inputClass.eNotifyCode iData = inputClass.iData ID = inputClass.iItemID NAME = inputClass.szFunctionName iBtn = inputClass.iButtonType iData1 = inputClass.iData1 iData2 = inputClass.iData2 szFlag = HandleInputUtil.MOUSE_FLAGS.get(inputClass.uiFlags, "UNKNOWN") szSplit = NAME.split("|") BASE = szSplit[0] if szSplit[1:]: TYPE = szSplit[1] else: TYPE = "" if szSplit[2:]: CASE = szSplit[2:] else: CASE = [0] # Remove potential Help Text self.bTooltip = False screen.hide("Tooltip") if iCode == NotifyCode.NOTIFY_CURSOR_MOVE_ON: if BASE == "WID": if TYPE == "RELATION": aMap = [ "<color=255,0,0>", "<color=0,255,255>", "", "<color=0,255,0>", "<color=255,255,0>" ] iPlayerY, iPlayerX = self.aRelationList[ID] iSum, szTxt = self.sumAttitude(iPlayerY, iPlayerX) szTxt += "\n---> " + aMap[GC.getPlayer(iPlayerY).AI_getAttitude(iPlayerX)] + str(iSum) self.updateTooltip(screen, szTxt) elif TYPE == "LEADER": CyPlayer = GC.getPlayer(ID) szLeader = GC.getLeaderHeadInfo(CyPlayer.getLeaderType()).getDescription() if CyPlayer.isHuman(): szTxt = CyPlayer.getName() if szTxt == szLeader: szTxt = TRNSLTR.getText("TXT_KEY_PITBOSS_HUMAN", ()) else: szTxt = TRNSLTR.getText("TXT_KEY_MAIN_MENU_AI", ()) szTxt += "\n%s %s\n" %(CyPlayer.getCivilizationAdjective(0), szLeader) szTxt += "%s - %s" %(CyPlayer.getCivilizationShortDescription(0), CyPlayer.getCivilizationDescription(0)) self.updateTooltip(screen, szTxt) elif TYPE == "BONUS": if CASE[0] == "DEAL": iBonus, CyDeal = self.aDealMap[ID] szTxt = GTM.getDealString(CyDeal, self.iPlayer) + "\n" if CyDeal.isCancelable(self.iPlayer, False): szTxt += TRNSLTR.getText("TXT_KEY_MISC_CLICK_TO_CANCEL", ()) + "\n" szTxt += "\n" else: szTxt = "" iBonus = ID szTxt += GTM.getBonusHelp(iBonus, False) self.updateTooltip(screen, szTxt) elif TYPE == "CIVIC": self.updateTooltip(screen, GTM.parseCivicInfo(ID, False, True, False)) elif TYPE == "RELIGION": self.updateTooltip(screen, GTM.parseReligionInfo(ID, False)) elif TYPE == "TECH": self.updateTooltip(screen, GTM.getTechHelp(ID, False, True, False, True, -1)) elif BASE == "GPT": szTxt = "" if TYPE == "WILL": szTxt = TRNSLTR.getText("TXT_KEY_FOREIGN_ADVISOR_GOLD_PER_TURN_FOR_TRADE", (ID,)) elif TYPE == "POS": szTxt = "<color=27,255,71>" + TRNSLTR.getText("TXT_KEY_FINANCIAL_ADVISOR_NET_INCOME", (ID,)) + " " + self.charGold elif TYPE == "NEG": szTxt = "<color=255,27,27>" + TRNSLTR.getText("TXT_KEY_FINANCIAL_ADVISOR_NET_INCOME", (-ID,)) + " " + self.charGold if szTxt: self.updateTooltip(screen, szTxt) elif BASE == "GOLD": if TYPE == "ALL": CyPlayerX = GC.getPlayer(ID) iGold = CyPlayerX.getGold() iGrGold = CyPlayerX.getGreaterGold() szTxt = "" if iGrGold: szTxt += str(iGrGold) szTxt += str(iGold) + self.charGold self.updateTooltip(screen, szTxt) elif TYPE == "WILL": iGold = GC.getPlayer(ID).AI_maxGoldTrade(self.iPlayer) iGrGold = iGold / 1000000 szTxt = "" if iGrGold: iGold - iGrGold*1000000 szTxt += str(iGrGold) szTxt += str(iGold) + self.charGold self.updateTooltip(screen, szTxt) elif iCode == NotifyCode.NOTIFY_CLICKED: if BASE == "FA_Tab": if CASE[0] != "Col": screen.hide("FA_Tab|Col" + str(self.iTab)) screen.show("FA_Tab" + str(self.iTab)) self.iTab = ID self.drawContents(screen) elif NAME == "BonusList": self.iBonusList = ID self.drawContents(screen) elif BASE == "KD": screen.deleteWidget("KD|Pnl") screen.deleteWidget("KD|Nay0") screen.deleteWidget("KD|Nay1") screen.deleteWidget("KD|Yay1") if TYPE == "Yay": CyMessageControl().sendModNetMessage(666, self.iPlayer, iData1, 0, 0) GAME.getDeal(iData1).kill() self.drawContents(screen) elif szFlag == "MOUSE_RBUTTONUP": if iBtn == WidgetTypes.WIDGET_LEADERHEAD and self.iTab == 0: if bShift: UP.pediaJumpToLeader([GC.getPlayer(iData1).getLeaderType()]) elif iData1 != self.iPlayer: screen.hideScreen() elif iBtn == WidgetTypes.WIDGET_LEADERHEAD: if iData1 != self.iPlayer: screen.hideScreen() elif BASE == "WID": if TYPE == "LEADER": UP.pediaJumpToLeader([GC.getPlayer(ID).getLeaderType()]) elif TYPE == "BONUS": if CASE[0] == "DEAL": iBonus = self.aDealMap[ID][0] else: iBonus = ID UP.pediaJumpToBonus([iBonus]) elif TYPE == "CIVIC": UP.pediaJumpToCivic([ID]) elif TYPE == "RELIGION": UP.pediaJumpToReligion([ID]) elif TYPE == "TECH": UP.pediaJumpToTech([ID]) else: if iBtn == WidgetTypes.WIDGET_LEADERHEAD and self.iTab == 0: aList = self.selectedLeaders if bShift: if iData1 in aList: aList.remove(iData1) else: aList.append(iData1) else: if aList and len(aList) == 1 and iData1 == aList[0]: aList = [] else: aList = [iData1] self.selectedLeaders = aList self.drawContents(screen) elif BASE == "WID": if TYPE == "LEADER": if ID != self.iPlayer: self.CyPlayer.contact(ID) screen.hideScreen() elif TYPE == "BONUS": if CASE[0] == "DEAL": iBonus, CyDeal = self.aDealMap[ID] if CyDeal.isCancelable(self.iPlayer, False): eWidGen = WidgetTypes.WIDGET_GENERAL ePnlMain = PanelStyles.PANEL_STYLE_MAIN eBtnStd = ButtonStyles.BUTTON_STYLE_STANDARD xRes = self.xRes yRes = self.yRes xMid = xRes/2 yMid = yRes/2 screen.setImageButton("KD|Nay0", "", 0, 0, xRes, yRes, eWidGen, 1, 1) screen.addPanel("KD|Pnl", "", "", True, True, xMid-180, yMid-60, 360, 120, ePnlMain) szTxt = "<font=3b>" + TRNSLTR.getText("TXT_KEY_ANNUL", ()) screen.setLabelAt("", "KD|Pnl", szTxt, 1<<2, 180, 20, 0, FontTypes.GAME_FONT, eWidGen, 1, 1) szTxt = TRNSLTR.getText("TXT_KEY_POPUP_NO", ()) screen.setButtonGFC("KD|Nay1", szTxt, "", xMid - 160, yMid, 150, 40, eWidGen, 1, 1, eBtnStd) szTxt = TRNSLTR.getText("TXT_KEY_POPUP_YES", ()) screen.setButtonGFC("KD|Yay1", szTxt, "", xMid + 10, yMid, 150, 40, eWidGen, CyDeal.getID(), 1, eBtnStd) elif iCode == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED: if NAME == "FA_DebugDD": iIndex = screen.getSelectedPullDownID(NAME) self.iPlayer = iPlayer = screen.getPullDownData(NAME, iIndex) self.CyPlayer = CyPlayer = GC.getPlayer(iPlayer) self.iTeam = iTeam = CyPlayer.getTeam() self.CyTeam = GC.getTeam(iTeam) self.calcPlayerRelative() self.drawContents(screen)
def __eventWBScriptPopupBegin(self, argsList): popup = PyPopup.PyPopup(CvUtil.EventWBScriptPopup, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(localText.getText("TXT_KEY_WB_SCRIPT", ())) popup.createEditBox(CvScreensInterface.getWorldBuilderScreen().getCurrentScript()) popup.launch() return
def onKbdEvent(self, argsList): 'keypress handler - return 1 if the event was consumed' eventType,key,mx,my,px,py = argsList game = gc.getGame() if (self.bAllowCheats): # notify debug tools of input to allow it to override the control argsList = (eventType,key,self.bCtrl,self.bShift,self.bAlt,mx,my,px,py,gc.getGame().isNetworkMultiPlayer()) if ( CvDebugTools.g_CvDebugTools.notifyInput(argsList) ): return 0 if ( eventType == self.EventKeyDown ): theKey=int(key) CvCameraControls.g_CameraControls.handleInput( theKey ) if (self.bAllowCheats): # Shift - T (Debug - No MP) if (theKey == int(InputTypes.KB_T)): if ( self.bShift ): self.beginEvent(CvUtil.EventAwardTechsAndGold) #self.beginEvent(CvUtil.EventCameraControlPopup) return 1 elif (theKey == int(InputTypes.KB_W)): if ( self.bShift and self.bCtrl): self.beginEvent(CvUtil.EventShowWonder) return 1 # Shift - ] (Debug - currently mouse-overd unit, health += 10 elif (theKey == int(InputTypes.KB_LBRACKET) and self.bShift ): unit = CyMap().plot(px, py).getUnit(0) if ( not unit.isNone() ): d = min( unit.maxHitPoints()-1, unit.getDamage() + 10 ) unit.setDamage( d, PlayerTypes.NO_PLAYER ) # Shift - [ (Debug - currently mouse-overd unit, health -= 10 elif (theKey == int(InputTypes.KB_RBRACKET) and self.bShift ): unit = CyMap().plot(px, py).getUnit(0) if ( not unit.isNone() ): d = max( 0, unit.getDamage() - 10 ) unit.setDamage( d, PlayerTypes.NO_PLAYER ) elif (theKey == int(InputTypes.KB_F1)): if ( self.bShift ): CvScreensInterface.replayScreen.showScreen(False) return 1 # don't return 1 unless you want the input consumed elif (theKey == int(InputTypes.KB_F2)): if ( self.bShift ): import CvDebugInfoScreen CvScreensInterface.showDebugInfoScreen() return 1 elif (theKey == int(InputTypes.KB_F3)): if ( self.bShift ): CvScreensInterface.showDanQuayleScreen(()) return 1 elif (theKey == int(InputTypes.KB_F4)): if ( self.bShift ): CvScreensInterface.showUnVictoryScreen(()) return 1 return 0
def onKbdEvent(self, argsList): 'keypress handler - return 1 if the event was consumed' eventType,key,mx,my,px,py = argsList game = gc.getGame() if (self.bAllowCheats): # notify debug tools of input to allow it to override the control argsList = (eventType,key,self.bCtrl,self.bShift,self.bAlt,mx,my,px,py,gc.getGame().isNetworkMultiPlayer()) if ( CvDebugTools.g_CvDebugTools.notifyInput(argsList) ): return 0 if ( eventType == self.EventKeyDown ): theKey=int(key) CvCameraControls.g_CameraControls.handleInput( theKey ) # Dale - AoD: AoDCheatMenu START if (self.bAllowCheats): # TAC - Multiplayer - koma13 if( theKey == int(InputTypes.KB_Z) and self.bShift and self.bCtrl ) : self.beginEvent(CvUtil.EventAoDCheatMenu) # Dale - AoD: AoDCheatMenu END # Achievements START if( theKey == int(InputTypes.KB_F10) and not self.bShift and not self.bCtrl ) : CvScreensInterface.showAchieveAdvisorScreen() # Achievements END # TAC: EventTriggerMenu START # Shift+Ctrl+E im Cheatmodus if( theKey == int(InputTypes.KB_E) and self.bShift and self.bCtrl and self.bAllowCheats) : ePlayer = gc.getGame().getActivePlayer() popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON) popupInfo.setText(CyTranslator().getText("TXT_KEY_POPUP_SELECT_EVENT",())) popupInfo.setData1(ePlayer) popupInfo.setOnClickedPythonCallback("selectOneEvent") popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_SELECT_NEVER_MIND", ()), "") for i in range(gc.getNumEventTriggerInfos()): trigger = gc.getEventTriggerInfo(i) name = trigger.getType().replace("EVENTTRIGGER_", "").replace("_", " ").title() popupInfo.addPythonButton(name, "") # popupInfo.addPythonButton(str(trigger.getType()), "") popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_SELECT_NEVER_MIND", ()), "") popupInfo.addPopup(ePlayer) # TAC: EventTriggerMenu END if (self.bAllowCheats): # Shift - T (Debug - No MP) if (theKey == int(InputTypes.KB_T)): if ( self.bShift ): self.beginEvent(CvUtil.EventAwardGold) #self.beginEvent(CvUtil.EventCameraControlPopup) return 1 # TAC: Wonder Movie Cheat disabled #elif (theKey == int(InputTypes.KB_W)): # if ( self.bShift and self.bCtrl): # self.beginEvent(CvUtil.EventShowWonder) # return 1 # Shift - ] (Debug - currently mouse-overd unit, health += 10 elif (theKey == int(InputTypes.KB_LBRACKET) and self.bShift ): unit = CyMap().plot(px, py).getUnit(0) if ( not unit.isNone() ): d = min( unit.maxHitPoints()-1, unit.getDamage() + 10 ) unit.setDamage( d ) # Shift - [ (Debug - currently mouse-overd unit, health -= 10 elif (theKey == int(InputTypes.KB_RBRACKET) and self.bShift ): unit = CyMap().plot(px, py).getUnit(0) if ( not unit.isNone() ): d = max( 0, unit.getDamage() - 10 ) unit.setDamage( d ) elif (theKey == int(InputTypes.KB_F1)): if ( self.bShift ): CvScreensInterface.replayScreen.showScreen(False) return 1 # don't return 1 unless you want the input consumed return 0
def onKbdEvent(self, argsList): 'keypress handler - return 1 if the event was consumed' """ Handles onKbdEvent by firing the keystroke's handler if it has one registered. """ eventType, key, mx, my, px, py = argsList game = gc.getGame() # if self.bAllowCheats: if gc.getGame().isDebugMode(): # notify debug tools of input to allow it to override the control argsList = (eventType, key, self.bCtrl, self.bShift, self.bAlt, mx, my, px, py, game.isNetworkMultiPlayer()) if CvDebugTools.g_CvDebugTools.notifyInput(argsList): return 0 if eventType == self.EventKeyDown and not InputUtil.isModifier(key): theKey = int(key) # <f1rpo> (advc.007b) # Added not bCtrl/bAlt/bShift checks so that each cheat is triggered by only one combination of modifier keys if not self.bShift and self.bCtrl and self.bAlt and theKey == int( InputTypes.KB_R): BugUtil.warn( "Note (K-Mod): Reloading of Art Defines (Ctrl+Alt+R) is disabled" ) return 1 # Don't use this key combination for anything else # </f1rpo> stroke = InputUtil.Keystroke(key, self.bAlt, self.bCtrl, self.bShift) if stroke in self.shortcuts: BugUtil.debug( "BugEventManager - calling handler for shortcut %s", stroke) self.shortcuts[stroke](argsList) return 1 # From FfH-Mod: by Kael 07/05/2008 if theKey == int(InputTypes.KB_LEFT): if self.bCtrl: CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() - 45.0) return 1 elif self.bShift: CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() - 10.0) return 1 if theKey == int(InputTypes.KB_RIGHT): if self.bCtrl: CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() + 45.0) return 1 elif self.bShift: CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() + 10.0) return 1 # From FfH: End # PAE Spieler am Zug Message aktivieren/deaktvieren: STRG+P / CTRL+P -- if theKey == int(InputTypes.KB_P): if self.bCtrl: if self.bPAE_ShowMessagePlayerTurn: self.bPAE_ShowMessagePlayerTurn = False CyInterface().addMessage( gc.getGame().getActivePlayer(), True, 5, CyTranslator().getText( "TXT_KEY_MESSAGE_PAE_CIV_TURN_DEACTIVATED", ("", )), None, 2, None, ColorTypes(14), 0, 0, False, False) else: self.bPAE_ShowMessagePlayerTurn = True self.iPAE_ShowMessagePlayerHumanID = gc.getGame( ).getActivePlayer() CyInterface().addMessage( gc.getGame().getActivePlayer(), True, 5, CyTranslator().getText( "TXT_KEY_MESSAGE_PAE_CIV_TURN_ACTIVATED", ("", )), None, 2, None, ColorTypes(14), 0, 0, False, False) return 1 CvCameraControls.g_CameraControls.handleInput(theKey) ## AI AutoPlay ## if CyGame().getAIAutoPlay(): if theKey == int(InputTypes.KB_SPACE) or theKey == int( InputTypes.KB_ESCAPE): CyGame().setAIAutoPlay(0) return 1 ## AI AutoPlay ## # <f1rpo> (advc.007b) Cheats copied from CvEventManager # if self.bAllowCheats: if gc.getGame().isDebugMode(): # Shift - T (Debug - No MP) if self.bShift and not self.bCtrl and not self.bAlt and theKey == int( InputTypes.KB_T): self.beginEvent(CvUtil.EventAwardTechsAndGold) return 1 if self.bShift and self.bCtrl and not self.bAlt and theKey == int( InputTypes.KB_W): self.beginEvent(CvUtil.EventShowWonder) return 1 # Shift - ] Debug - currently mouse-over'd unit, health += 10 elif theKey == int( InputTypes.KB_LBRACKET ) and self.bShift and not self.bCtrl and not self.bAlt: unit = CyMap().plot(px, py).getUnit(0) if not unit.isNone(): d = min(unit.maxHitPoints() - 1, unit.getDamage() + 10) unit.setDamage(d, PlayerTypes.NO_PLAYER) # Shift - [ Debug - currently mouse-over'd unit, health -= 10 elif theKey == int( InputTypes.KB_RBRACKET ) and self.bShift and not self.bCtrl and not self.bAlt: unit = CyMap().plot(px, py).getUnit(0) if not unit.isNone(): d = max(0, unit.getDamage() - 10) unit.setDamage(d, PlayerTypes.NO_PLAYER) # <advc.gfd> Keep Nightinggale's key combination elif theKey == int( InputTypes.KB_F1 ) and self.bShift and self.bCtrl and not self.bAlt: GameFontDisplay.GameFontDisplay().interfaceScreen() return 1 # </advc.gfd> elif theKey == int(InputTypes.KB_F1): if self.bShift and self.bAlt: CyInterface().addImmediateMessage( "BEGIN Python file optimization", "") import ResolveConstantFunctions ResolveConstantFunctions.main(True) CyInterface().addImmediateMessage( "END Python file optimization", "") return 1 elif self.bShift and not self.bCtrl and not self.bAlt: CvScreensInterface.replayScreen.showScreen(False) return 1 # don't return 1 unless you want the input consumed elif theKey == int(InputTypes.KB_F2): if self.bShift and not self.bCtrl and self.bAlt: import remote_pdb remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace() return 1 elif self.bShift and not self.bCtrl and not self.bAlt: import CvDebugInfoScreen CvScreensInterface.showDebugInfoScreen() return 1 elif theKey == int(InputTypes.KB_F3): if self.bShift and not self.bCtrl and not self.bAlt: CvScreensInterface.showDanQuayleScreen(()) return 1 elif theKey == int(InputTypes.KB_F4): if self.bShift and not self.bCtrl and not self.bAlt: CvScreensInterface.showUnVictoryScreen(()) return 1 # </f1rpo> return 0
def __eventWBLandmarkPopupApply(self, playerID, userData, popupReturn): if (popupReturn.getEditBoxString(0)): szLandmark = popupReturn.getEditBoxString(0) if (len(szLandmark)): CvScreensInterface.getWorldBuilderScreen().setLandmarkCB(szLandmark) return
def __eventWBScriptPopupApply(self, playerID, userData, popupReturn): if (popupReturn.getEditBoxString(0)): szScriptName = popupReturn.getEditBoxString(0) CvScreensInterface.getWorldBuilderScreen().setScriptCB(szScriptName)
def handleInput (self, inputClass): screen = self.getScreen() if not screen.isActive(): return HandleInputUtil.debugInput(inputClass) bAlt, bCtrl, bShift = self.InputData.getModifierKeys() iCode = inputClass.eNotifyCode iData = inputClass.iData ID = inputClass.iItemID NAME = inputClass.szFunctionName iBtn = inputClass.iButtonType iData1 = inputClass.iData1 iData2 = inputClass.iData2 szFlag = HandleInputUtil.MOUSE_FLAGS.get(inputClass.uiFlags, "UNKNOWN") szSplit = NAME.split("|") BASE = szSplit[0] if szSplit[1:]: TYPE = szSplit[1] else: TYPE = "" if szSplit[2:]: CASE = szSplit[2:] else: CASE = [0] # Remove potential Help Text self.tooltip.reset(screen) if iCode == NotifyCode.NOTIFY_CURSOR_MOVE_ON: if BASE == "WID": if TYPE == "LEADER": CyPlayer = GC.getPlayer(ID) szLeader = GC.getLeaderHeadInfo(CyPlayer.getLeaderType()).getDescription() if CyPlayer.isHuman(): szTxt = CyPlayer.getName() if szTxt == szLeader: szTxt = TRNSLTR.getText("TXT_KEY_PITBOSS_HUMAN", ()) elif CyPlayer.isNPC(): szTxt = "NPC" else: szTxt = TRNSLTR.getText("TXT_KEY_MAIN_MENU_AI", ()) szTxt += "\n%s %s\n" %(CyPlayer.getCivilizationAdjective(0), szLeader) szTxt += "%s - %s" %(CyPlayer.getCivilizationShortDescription(0), CyPlayer.getCivilizationDescription(0)) self.tooltip.handle(screen, szTxt) elif iCode == NotifyCode.NOTIFY_CLICKED: if szFlag == "MOUSE_RBUTTONUP": if BASE == "WID": if TYPE == "LEADER": UP.pediaJumpToLeader([GC.getPlayer(ID).getLeaderType()]) else: if BASE == "WID": if TYPE == "LEADER": aList = self.selectedCivs bChange = True if bShift: if ID in aList: if len(aList) == 1: bChange = False else: aList.remove(ID) screen.hide("WID|LEADER|HiLi" + str(ID)) else: aList.append(ID) screen.show("WID|LEADER|HiLi" + str(ID)) else: if len(aList) == 1 and ID in aList: bChange = False else: if ID not in aList: screen.show("WID|LEADER|HiLi" + str(ID)) for iPlayerX in aList: if iPlayerX != ID: screen.hide("WID|LEADER|HiLi" + str(iPlayerX)) aList = [ID] if bChange: self.selectedCivs = aList self.UL_refreshUnitSelection(True, True) elif NAME == "MA_UnitButton": self.bUnitDetails = not self.bUnitDetails self.UL_refreshUnitSelection(True, True) elif iCode == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED: if NAME == "MA_DDBox": key = self.grouper[iData].key self.groupingKeys[ID] = key self.selectedGroups.clear() self.UL_refresh(screen, False)
def __eventWBAllPlotsPopupApply(self, playerID, userData, popupReturn): if (popupReturn.getButtonClicked() >= 0): CvScreensInterface.getWorldBuilderScreen().handleAllPlotsCB(popupReturn) return
def doEventCivilopediaFoundingFather(argsList): eEvent = argsList[0] pTriggeredData = argsList[1] CvScreensInterface.pediaShowHistorical((CivilopediaPageTypes.CIVILOPEDIA_PAGE_CONCEPT, gc.getInfoTypeForString("CONCEPT_FATHERS")))
def onKbdEvent(self, argsList): """ Handles onKbdEvent by firing the keystroke's handler if it has one registered. """ eventType, key, mx, my, px, py = argsList if eventType == self.EventKeyDown and not InputUtil.isModifier(key): # <f1rpo> (advc.007b) # Added not bCtrl/bAlt/bShift checks so that each cheat is triggered by only one combination of modifier keys theKey = int(key) if not self.bShift and self.bCtrl and self.bAlt and theKey == int( InputTypes.KB_R): BugUtil.warn( "Note (K-Mod): Reloading of Art Defines (Ctrl+Alt+R) is disabled" ) return 1 # Don't use this key combination for anything else # </f1rpo> stroke = InputUtil.Keystroke(key, self.bAlt, self.bCtrl, self.bShift) if stroke in self.shortcuts: BugUtil.debug( "BugEventManager - calling handler for shortcut %s", stroke) self.shortcuts[stroke](argsList) return 1 # <f1rpo> (advc.007b) Cheats copied from CvEventManager if gc.getGame().isDebugMode(): # Shift - T Debug - techs if self.bShift and not self.bCtrl and not self.bAlt and theKey == int( InputTypes.KB_T): self.beginEvent(CvUtil.EventAwardTechsAndGold) return 1 elif self.bShift and self.bCtrl and not self.bAlt and theKey == int( InputTypes.KB_W): self.beginEvent(CvUtil.EventShowWonder) return 1 # Shift - ] Debug - currently mouse-over'd unit: health+=10 elif theKey == int( InputTypes.KB_LBRACKET ) and self.bShift and not self.bCtrl and not self.bAlt: unit = CyMap().plot(px, py).getUnit(0) if not unit.isNone(): d = min(unit.maxHitPoints() - 1, unit.getDamage() + 10) unit.setDamage(d, PlayerTypes.NO_PLAYER) # Shift - [ Debug - currently mouse-over'd unit: health-= 10 elif theKey == int( InputTypes.KB_RBRACKET ) and self.bShift and not self.bCtrl and not self.bAlt: unit = CyMap().plot(px, py).getUnit(0) if not unit.isNone(): d = max(0, unit.getDamage() - 10) unit.setDamage(d, PlayerTypes.NO_PLAYER) # <advc.gfd> Keep Nightinggale's key combination elif theKey == int( InputTypes.KB_F1 ) and self.bShift and self.bCtrl and not self.bAlt: GameFontDisplay.GameFontDisplay().interfaceScreen() return 1 # </advc.gfd> elif theKey == int(InputTypes.KB_F1): if self.bShift and not self.bCtrl and not self.bAlt: CvScreensInterface.replayScreen.showScreen(False) return 1 elif theKey == int(InputTypes.KB_F2): if self.bShift and not self.bCtrl and not self.bAlt: import CvDebugInfoScreen CvScreensInterface.showDebugInfoScreen() return 1 elif theKey == int(InputTypes.KB_F3): if self.bShift and not self.bCtrl and not self.bAlt: CvScreensInterface.showDanQuayleScreen(()) return 1 elif theKey == int(InputTypes.KB_F4): if self.bShift and not self.bCtrl and not self.bAlt: CvScreensInterface.showUnVictoryScreen(()) return 1 # </f1rpo> return 0
def doEventCivilopediaSettlement(argsList): eEvent = argsList[0] pTriggeredData = argsList[1] CvScreensInterface.pediaShowHistorical((CivilopediaPageTypes.CIVILOPEDIA_PAGE_CONCEPT, gc.getInfoTypeForString("CONCEPT_SETTLEMENTS")))
def doEventCivilopediaAutomatedTools(argsList): eEvent = argsList[0] pTriggeredData = argsList[1] CvScreensInterface.pediaShowHistorical((CivilopediaPageTypes.CIVILOPEDIA_PAGE_CONCEPT, gc.getInfoTypeForString("CONCEPT_TRADE")))
def doEventCivilopediaNativeVillages(argsList): eEvent = argsList[0] pTriggeredData = argsList[1] CvScreensInterface.pediaShowHistorical((CivilopediaPageTypes.CIVILOPEDIA_PAGE_CONCEPT, gc.getInfoTypeForString("CONCEPT_NATIVES")))
def __eventWBLandmarkPopupBegin(self, argsList): CvScreensInterface.getWorldBuilderScreen().setLandmarkCB("") return
def clearAllTranslations(argsList=None): CvScreensInterface.getBugOptionsScreen().clearAllTranslations()
def __eventWBScriptPopupBegin(self, argsList): popup = CyPopup(CvUtil.EventWBScriptPopup, EventContextTypes.EVENTCONTEXT_ALL, True) popup.setHeaderString(localText.getText("TXT_KEY_WB_SCRIPT", ()), CvUtil.FONT_CENTER_JUSTIFY) popup.createEditBox(CvScreensInterface.getWorldBuilderScreen().getCurrentScript(), 0) popup.launch(true, PopupStates.POPUPSTATE_IMMEDIATE)
def handleInput(self, inputClass): if not self.created: print "CvTechChooser.handleInput - aborted due to screen not being created" return 0 print "CvTechChooser.handleInput" screen = self.screen() bAlt, bCtrl, bShift = self.InputData.getModifierKeys() iCode = inputClass.eNotifyCode iData = inputClass.iData iData2 = inputClass.iData2 ID = inputClass.iItemID NAME = inputClass.szFunctionName szFlag = HandleInputUtil.MOUSE_FLAGS.get(inputClass.uiFlags, "UNKNOWN") szSplit = NAME.split("|") BASE = szSplit[0] if szSplit[1:]: TYPE = szSplit[1] else: TYPE = "" if szSplit[2:]: CASE = szSplit[2:] else: CASE = [""] iType = ID if iCode == NotifyCode.NOTIFY_CHARACTER: # Character if iData in (45, 49, 56): # Ctrl, Shift, Alt if self.bUnitTT: self.tooltip.handle(screen, CyGameTextMgr().getUnitHelp(self.iUnitTT, False, True, True, None)) self.bUnitTT = None return 1 elif iCode == 17: # Key Up if iData == InputTypes.KB_A: self.scrollTo(self.scrollOffs - self.xCellDist) elif iData == InputTypes.KB_D: self.scrollTo(self.scrollOffs + self.xCellDist) if iData == InputTypes.KB_Q: self.demoMode = not self.demoMode self.demoOffs = 0 elif iData in (InputTypes.KB_ESCAPE, InputTypes.KB_F6): # Stop F6 and ESC handlers from triggering on load if self.skipNextExitKey: self.skipNextExitKey = False else: screen.hideScreen() return 1 if self.bUnitTT is None: self.bUnitTT = True return 1 # Remove potential Help Text self.tooltip.reset(screen) self.iUnitTT = None self.bUnitTT = False if iCode == NotifyCode.NOTIFY_CURSOR_MOVE_ON: # Mouse Enter if BASE == "WID": if TYPE == "TECH": if CASE[0] == "CURRENT": szTxt = "Researching: " + CyGameTextMgr().getTechHelp(self.CyPlayer.getCurrentResearch(), False, True, True, True, -1) elif CASE[0] == "REQ": szTxt = TRNSLTR.getText("TXT_KEY_MISC_TECH_REQUIRES_KNOWLEDGE_OF", (GC.getTechInfo(ID).getTextKey(),)) else: szTxt = CyGameTextMgr().getTechHelp(ID, False, True, True, True, -1) self.tooltip.handle(screen, szTxt) elif TYPE == "UNIT": self.tooltip.handle(screen, CyGameTextMgr().getUnitHelp(ID, False, True, True, None)) self.iUnitTT = ID self.bUnitTT = True elif TYPE == "BUILDING": if CASE[0] == "OBS": CvBuildingInfo = GC.getBuildingInfo(ID) szTxt = TRNSLTR.getText("TXT_KEY_TECHHELP_OBSOLETES", (CvBuildingInfo.getType(), CvBuildingInfo.getTextKey())) else: szTxt = CyGameTextMgr().getBuildingHelp(ID, False, None, False, False, True) self.tooltip.handle(screen, szTxt) elif iCode == NotifyCode.NOTIFY_CLICKED: # click if BASE == "WID": if szFlag == "MOUSE_RBUTTONUP": if TYPE == "UNIT": UP.pediaJumpToUnit([ID]) elif TYPE == "BUILDING": UP.pediaJumpToBuilding([ID]) elif TYPE == "PROJECT": UP.pediaJumpToProject([ID]) elif TYPE == "PROMO": UP.pediaJumpToPromotion([ID]) elif TYPE == "TECH": if CASE[0] == "CURRENT": UP.pediaJumpToTech([self.CyPlayer.getCurrentResearch()]) else: UP.pediaJumpToTech([iType]) elif szFlag == "MOUSE_LBUTTONUP": if TYPE == "TECH": if self.CyPlayer.getAdvancedStartPoints() > -1: if CASE[0] == "CHOICE": self.updateSelectedTech(screen, ID) elif GC.getGame().getActivePlayer() == self.iPlayer: if CASE[0] == "CURRENT": CyMessageControl().sendResearch(-1, bShift) self.updateTechRecords(False) elif CASE[0] == "CHOICE" and (self.currentTechState[iType] == CIV_TECH_AVAILABLE or not bShift and (self.currentTechState[iType] == CIV_IS_RESEARCHING or self.currentTechState[iType] == CIV_IS_QUEUED)): CyMessageControl().sendResearch(iType, bShift) self.updateTechRecords(False) elif TYPE == "ERAIM" or TYPE == "ERATEXT": self.scrollTo(self.minEraXPos[ID] - self.minX) elif NAME == "AddTechButton": CyMessageControl().sendAdvancedStartAction(AdvancedStartActionTypes.ADVANCEDSTARTACTION_TECH, self.iPlayer, -1, -1, self.iSelectedTech, True) #Action, Player, X, Y, Data, bAdd self.updateSelectedTech(screen, -1) elif NAME == HSLIDER_ID: if iCode == 20: self.scrollOffs = iData self.scroll() elif iCode == 11: # List Select if NAME == "TC_DebugDD": self.initForPlayer(screen.getPullDownData(NAME, screen.getSelectedPullDownID(NAME)))
def __eventWBStartYearPopupApply(self, playerID, userData, popupReturn): iStartYear = popupReturn.getSpinnerWidgetValue(int(0)) CvScreensInterface.getWorldBuilderScreen().setStartYearCB(iStartYear)
def doEventCivilopediaImmigration(argsList): eEvent = argsList[0] pTriggeredData = argsList[1] CvScreensInterface.pediaShowHistorical((CivilopediaPageTypes.CIVILOPEDIA_PAGE_CONCEPT, gc.getInfoTypeForString("CONCEPT_IMMIGRATION")))
def preGameStart(): #import CvEventInterface #CvEventInterface.getEventManager().fireEvent("PreGameStart") import CvScreensInterface CvScreensInterface.mainInterface.bSetStartZoom = True CvScreensInterface.showMainInterface()
def handleInput(self, inputClass): screen = self.getScreen() if not screen.isActive(): return HandleInputUtil.debugInput(inputClass) xMouse, yMouse = self.InputData.getMousePosition() bAlt, bCtrl, bShift = self.InputData.getModifierKeys() iCode = inputClass.eNotifyCode iData = inputClass.iData ID = inputClass.iItemID NAME = inputClass.szFunctionName iBtn = inputClass.iButtonType iData1 = inputClass.iData1 iData2 = inputClass.iData2 szFlag = HandleInputUtil.MOUSE_FLAGS.get(inputClass.uiFlags, "UNKNOWN") szSplit = NAME.split("|") BASE = szSplit[0] if szSplit[1:]: TYPE = szSplit[1] else: TYPE = "" if szSplit[2:]: CASE = szSplit[2:] else: CASE = [0] # Remove potential Help Text screen.hide("Tooltip") if iCode == NotifyCode.NOTIFY_CURSOR_MOVE_ON: if BASE == "WID": if TYPE == "CIVIC": if CASE[0] == "TEXT": if ID != self.iCivicDisplayed: self.setCivicText(screen, ID) else: self.updateTooltip(screen, GTM.parseCivicInfo( ID, False, True, False), uFont=self.aFontList[4]) elif NAME == "CivicDisplay": self.updateTooltip(screen, "Toggle Display Type") elif iCode == NotifyCode.NOTIFY_CURSOR_MOVE_OFF: if BASE == "WID": if TYPE == "CIVIC": if CASE[0] == "TEXT": if ID != self.iCivicDisplayed: if self.iCivicDisplayed > -1: self.setCivicText(screen, self.iCivicDisplayed) else: screen.hide("CivicText") elif iCode == NotifyCode.NOTIFY_CLICKED: if BASE == "Civic_Tab": if CASE[0] != "Col": screen.hide("Civic_Tab|Col" + str(self.iTab)) screen.show("Civic_Tab" + str(self.iTab)) self.iTab = ID self.drawContents(screen) elif NAME == "CivicCancel": self.iCivicDisplayed = -1 if self.iType: screen.hide("CivicText") for iCivic in self.originalCivics: if iCivic not in self.currentCivics: self.selectCivic(screen, iCivic) self.updateStatus(screen) elif NAME == "CivicRevolution": # If we want to be able to change civics of another player in debug mode then a custom modnetmessage function must be created for MP compatibility. # CyMessageControl().sendModNetMessage(MsgID, iPlayer, -1, -1, -1) # The function would have to be able to reference this class instance and ask for reference.currentCivics. CyMessageControl().sendUpdateCivics(self.currentCivics) screen.hideScreen() elif szFlag == "MOUSE_RBUTTONUP": if BASE == "WID": if TYPE == "CIVIC": UP.pediaJumpToCivic([ID]) else: if BASE == "WID": if TYPE == "CIVIC": self.iCivicDisplayed = ID if ID in self.currentCivics or not self.CyPlayer.canDoCivics( ID): return self.selectCivic(screen, ID) self.updateStatus(screen) elif NAME == "CivicDisplay": self.iType = (self.iType + 1) % 2 self.drawContents(screen) elif iCode == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED: if NAME == "Civic_DebugDD": iIndex = screen.getSelectedPullDownID(NAME) self.iPlayer = iPlayer = screen.getPullDownData(NAME, iIndex) self.setActivePlayer(iPlayer) self.drawContents(screen)
def doEventCivilopediaProfessions(argsList): eEvent = argsList[0] pTriggeredData = argsList[1] CvScreensInterface.pediaShowHistorical((CivilopediaPageTypes.CIVILOPEDIA_PAGE_CONCEPT, gc.getInfoTypeForString("CONCEPT_PROFESSIONS")))
def edit(self): if super(DotMapLayer, self).edit(): CvScreensInterface.showOverlayScreen()
def handleInput(self, screen, szSplit, iNotifyCode, szFlag, ID, iData1): print "ACEM - handleInput" if iNotifyCode == NotifyCode.NOTIFY_CURSOR_MOVE_ON: if szSplit[0] in ("List", "ListBtn"): szText = CyGameTextMgr().getBuildingHelp( ID, False, False, False, self.CyCity, True) self.updateTooltip(screen, szText, self.xListTooltip) elif iNotifyCode == NotifyCode.NOTIFY_CLICKED: if szSplit[0] == "Exit": exitCityDemolish(screen) return if szSplit[0] == "Btn": if not ID: if szFlag == "MOUSE_RBUTTONUP" and iData1: x, y, w = self.xywBtn0 screen.setButtonGFC("CityDemolish|Btn0", "****", "", x, y, w, 30, WidgetTypes.WIDGET_GENERAL, 0, 0, ButtonStyles.BUTTON_STYLE_STANDARD) self.iSelected = None elif self.bListHidden: screen.show("CityDemolish|List") screen.show("CityDemolish|ListBkgr") self.bListHidden = False else: screen.hide("CityDemolish|List") screen.hide("CityDemolish|ListBkgr") self.bListHidden = True elif ID == 1 and szFlag == "MOUSE_LBUTTONUP": iSelected = self.iSelected if iSelected != None: self.doIt(iSelected) exitCityDemolish(screen) elif szSplit[0] == "ListTop": x, y, w = self.xywBtn0 if ID: screen.setButtonGFC("CityDemolish|Btn0", self.szAbandon, "", x, y, w, 30, WidgetTypes.WIDGET_GENERAL, 1, 0, ButtonStyles.BUTTON_STYLE_STANDARD) self.iSelected = -1 else: screen.hide("CityDemolish|List") self.bListHidden = True screen.setButtonGFC("CityDemolish|Btn0", "****", "", x, y, w, 30, WidgetTypes.WIDGET_GENERAL, 0, 0, ButtonStyles.BUTTON_STYLE_STANDARD) self.iSelected = None elif szSplit[0] in ("List", "ListBtn"): if szFlag == "MOUSE_RBUTTONUP": CvScreensInterface.pediaJumpToBuilding([ID]) else: x, y, w = self.xywBtn0 screen.setButtonGFC("CityDemolish|Btn0", self.aList[iData1], "", x, y, w, 30, WidgetTypes.WIDGET_GENERAL, 1, 0, ButtonStyles.BUTTON_STYLE_STANDARD) self.iSelected = ID if self.iSelected == None: screen.hide("CityDemolish|Btn1") screen.show("CityDemolish|Exit1") else: screen.hide("CityDemolish|Exit1") screen.show("CityDemolish|Btn1")
def freeze(self): if super(DotMapLayer, self).freeze(): self.unhighlightCity() CvScreensInterface.hideOverlayScreen()