本文整理匯總了Python中CvEventInterface.getEventManager方法的典型用法代碼示例。如果您正苦於以下問題:Python CvEventInterface.getEventManager方法的具體用法?Python CvEventInterface.getEventManager怎麽用?Python CvEventInterface.getEventManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CvEventInterface
的用法示例。
在下文中一共展示了CvEventInterface.getEventManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: doHotSeatCheck
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def doHotSeatCheck(args):
"""
Called during EndPlayerTurn, fires SwitchHotSeatPlayer event during a hot seat
game when the active player's turn ends.
"""
iGameTurn, ePlayer = args
game = gc.getGame()
if game.isHotSeat() and ePlayer == game.getActivePlayer():
CvEventInterface.getEventManager().fireEvent("SwitchHotSeatPlayer", ePlayer)
示例2: handle
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def handle(self, element, type, module, function, dll):
dll = BugDll.decode(dll)
if self.isDllOkay(element, dll):
CvEventInterface.getEventManager().addEventHandler(
type, BugUtil.getFunction(module, function, True, *element.args, **element.kwargs)
)
else:
BugUtil.info(
"BugConfig - ignoring <%s> %s, requires dll version %s",
element.tag,
type,
self.resolveDll(element, dll),
)
示例3: calculateScore
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def calculateScore(self,argsList):
ePlayer = argsList[0]
bFinal = argsList[1]
bVictory = argsList[2]
FinalFrontier = CvEventInterface.getEventManager().FinalFrontier
iMaxPopulation = FinalFrontier.iMaxPopulation
iPopulationScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getPopScore(), gc.getGame().getInitPopulation(), iMaxPopulation, gc.getDefineINT("SCORE_POPULATION_FACTOR"), True, bFinal, bVictory)
printd("Pop Score Stuff")
printd(gc.getPlayer(ePlayer).getPopScore())
printd(gc.getGame().getInitPopulation())
printd(iMaxPopulation)
printd(iPopulationScore)
iPlayerLandScore = gc.getPlayer(ePlayer).getTotalLand()
iLandScore = CvUtil.getScoreComponent(iPlayerLandScore , gc.getGame().getInitLand(), gc.getGame().getMaxLand(), gc.getDefineINT("SCORE_LAND_FACTOR"), True, bFinal, bVictory)
printd("Land Score Stuff")
printd(iPlayerLandScore)
printd(gc.getGame().getInitLand())
printd(gc.getGame().getMaxLand())
printd(iLandScore)
iTechScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getTechScore(), gc.getGame().getInitTech(), gc.getGame().getMaxTech(), gc.getDefineINT("SCORE_TECH_FACTOR"), True, bFinal, bVictory)
iWondersScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getWondersScore(), gc.getGame().getInitWonders(), gc.getGame().getMaxWonders(), gc.getDefineINT("SCORE_WONDER_FACTOR"), False, bFinal, bVictory)
iTotalScore = int(iLandScore + iWondersScore + iTechScore + iPopulationScore)
printd("Player %d Score: %d Pop: %d Land: %d Tech: %d Wonders: %d" %(ePlayer, iTotalScore, iPopulationScore, iLandScore, iTechScore, iWondersScore))
return iTotalScore
示例4: getUnitCostMod
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def getUnitCostMod(self, argsList):
iPlayer, iUnit = argsList
iCostMod = -1 # Any value > 0 will be used
FinalFrontier = CvEventInterface.getEventManager().FinalFrontier
iCostMod = FinalFrontier.getUnitCostMod(iPlayer, iUnit)
return iCostMod
示例5: getBuildingCostMod
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def getBuildingCostMod(self, argsList):
iPlayer, iCityID, iBuilding = argsList
iCostMod = -1 # Any value > 0 will be used
FinalFrontier = CvEventInterface.getEventManager().FinalFrontier
iCostMod = FinalFrontier.getBuildingCostMod(iPlayer, iCityID, iBuilding)
return iCostMod
示例6: AI_chooseProduction
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def AI_chooseProduction(self,argsList):
pCity = argsList[0]
FinalFrontier = CvEventInterface.getEventManager().FinalFrontier
bOverride = FinalFrontier.getAI().doCityAIProduction(pCity)
return bOverride
示例7: preGameStart
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
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: AI_unitUpdate
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def AI_unitUpdate(self,argsList):
pUnit = argsList[0]
FinalFrontier = CvEventInterface.getEventManager().FinalFrontier
bOverride = false
# Only do it for actual AI units, not automated human ones
pPlayer = gc.getPlayer(pUnit.getOwner())
if (not pPlayer.isHuman()) and (not pPlayer.isBarbarian()) and pPlayer.isAlive() and (not pUnit.isNone()) and (not pUnit.isDead()):
iConstructShip = gc.getInfoTypeForString(gc.getDefineSTRING("CONSTRUCT_SHIP"))
if (pUnit.getUnitClassType() == iConstructShip):
bOverride = FinalFrontier.getAI().doConstructionShipAI(pUnit)
return bOverride
示例9: onKbdEvent
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def onKbdEvent(argsList):
"""
Event handler for keyboard events, checks keys against the hotkey list and opens the screen or closes it on match
"""
eventType, key, mouseX, mouseY, plotX, plotY = argsList
eventManager = CvEventInterface.getEventManager()
if ( eventType == eventManager.EventKeyDown ):
stroke = InputUtil.Keystroke(key, eventManager.bAlt, eventManager.bCtrl, eventManager.bShift)
if stroke in keys:
if overlayScreen.isOpen():
hideOverlayScreen()
else:
showOverlayScreen()
return 1
return 0
示例10: __init__
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
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
示例11: request
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def request(self, webserver):
gamedata = createGameData()
newState = not webserver.compareGamedata(gamedata)
# Check if CvGame::doTurn is currently running.
# Try ness for mods without the DLL changes for bGameTurnProcessing
inconsistentState = False
try:
inconsistentState = CvEventInterface.getEventManager(
).bGameTurnProcessing
except AttributeError:
for iPlayer in range(gc.getMAX_CIV_PLAYERS()):
if gc.getPlayer(iPlayer).isTurnActive():
inconsistentState = True
break
except:
pass
# PB.consoleOut("Webupload request %i" % (self.requestCounter,))
self.requestCounter += 1
if (not inconsistentState
and (newState or not self.reduceTraffic or
self.requestCounter % self.reduceFactor == 0)
):
params = urllib.urlencode(
{'action': 'update', 'id': self.gameId,
'pwHash': self.pwHash, 'info':
simplejson.dumps(
{'return': 'ok', 'info': gamedata})})
else:
# Minimal alive message.
gamedataMinimal = {"turnTimer": gamedata.get("turnTimer")}
if gamedata["turnTimer"] == 1:
gamedataMinimal["turnTimerValue"] = gamedata.get(
"turnTimerValue")
params = urllib.urlencode(
{'action': 'update', 'id': self.gameId, 'pwHash': self.pwHash, 'info':
simplejson.dumps(
{'return': 'ok', 'info': gamedataMinimal})})
try:
# f = urllib.urlopen("%s?%s" % (url,params) ) # GET method
urllib.urlopen(self.url, params) # POST method
except:
# PB.consoleOut("Webupload failed")
pass
示例12: canPickPlot
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def canPickPlot(self, argsList):
pPlot = argsList[0]
pGodsOfOld=CvEventInterface.getEventManager()
if GodsOfOld.iPushButton == 2:
if pPlot.isCoastalLand():
return true
else:
return false
if GodsOfOld.iPushButton == 3:
if pPlot.isCity():
iCoords = ( pPlot.getX(), pPlot.getY() )
if pGodsOfOld.lPlagueCities.count( iCoords ) == 0:
return true
else:
return false
else:
return false
return true
示例13: bAlt
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def bAlt():
return CvEventInterface.getEventManager().bAlt
示例14: bShift
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def bShift():
return CvEventInterface.getEventManager().bShift
示例15: handle
# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def handle(self, element, keys, module, function, dll):
dll = BugDll.decode(dll)
if self.isDllOkay(element, dll):
CvEventInterface.getEventManager().addShortcutHandler(keys, BugUtil.getFunction(module, function, *element.args, **element.kwargs))
else:
BugUtil.info("InputUtil - ignoring <%s> %s, requires dll version %s", element.tag, keys, self.resolveDll(element, dll))