本文整理汇总了Python中CvScreensInterface类的典型用法代码示例。如果您正苦于以下问题:Python CvScreensInterface类的具体用法?Python CvScreensInterface怎么用?Python CvScreensInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CvScreensInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initAfterReload
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()
示例2: _delayedPythonCallUtil
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
示例3: handleInput
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
示例4: onWindowActivation
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()
示例5: CivicsButton
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
示例6: onMouseEvent
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
示例7: preGameStart
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()
示例8: __init__
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
示例9: __eventWBScriptPopupBegin
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)
示例10: __eventWBLandmarkPopupApply
def __eventWBLandmarkPopupApply(self, playerID, userData, popupReturn):
if (popupReturn.getEditBoxString(0)):
szLandmark = popupReturn.getEditBoxString(0)
if (len(szLandmark)):
CvScreensInterface.getWorldBuilderScreen().setLandmarkCB(szLandmark)
return
示例11: __eventWBLandmarkPopupBegin
def __eventWBLandmarkPopupBegin(self, argsList):
CvScreensInterface.getWorldBuilderScreen().setLandmarkCB("")
return
示例12: __eventWBAllPlotsPopupApply
def __eventWBAllPlotsPopupApply(self, playerID, userData, popupReturn):
if (popupReturn.getButtonClicked() >= 0):
CvScreensInterface.getWorldBuilderScreen().handleAllPlotsCB(popupReturn)
return
示例13: __eventWBAllPlotsPopupBegin
def __eventWBAllPlotsPopupBegin(self, argsList):
CvScreensInterface.getWorldBuilderScreen().allPlotsCB()
return
示例14: doEventCivilopediaFoundingFather
def doEventCivilopediaFoundingFather(argsList):
eEvent = argsList[0]
pTriggeredData = argsList[1]
CvScreensInterface.pediaShowHistorical((CivilopediaPageTypes.CIVILOPEDIA_PAGE_CONCEPT, gc.getInfoTypeForString("CONCEPT_FATHERS")))
示例15: onKbdEvent
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