當前位置: 首頁>>代碼示例>>Python>>正文


Python CvEventInterface.getEventManager方法代碼示例

本文整理匯總了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)
開發者ID:AP-ML,項目名稱:DTM,代碼行數:11,代碼來源:BugUtil.py

示例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),
         )
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:15,代碼來源:BugConfig.py

示例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
開發者ID:DarkLunaPhantom,項目名稱:civ4ffplus,代碼行數:31,代碼來源:FinalFrontierGameUtils.py

示例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
開發者ID:DarkLunaPhantom,項目名稱:civ4ffplus,代碼行數:10,代碼來源:FinalFrontierGameUtils.py

示例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
開發者ID:DarkLunaPhantom,項目名稱:civ4ffplus,代碼行數:10,代碼來源:FinalFrontierGameUtils.py

示例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
開發者ID:DarkLunaPhantom,項目名稱:civ4ffplus,代碼行數:10,代碼來源:FinalFrontierGameUtils.py

示例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()	
開發者ID:hardtimes1966,項目名稱:modxml,代碼行數:24,代碼來源:CvAppInterface.py

示例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
開發者ID:DarkLunaPhantom,項目名稱:civ4ffplus,代碼行數:17,代碼來源:FinalFrontierGameUtils.py

示例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
開發者ID:hardtimes1966,項目名稱:modxml,代碼行數:17,代碼來源:CvOverlayScreenUtils.py

示例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
開發者ID:hardtimes1966,項目名稱:modxml,代碼行數:17,代碼來源:BugConfig.py

示例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
開發者ID:YggdrasiI,項目名稱:PBStats,代碼行數:50,代碼來源:Webserver.py

示例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
開發者ID:Pretzle,項目名稱:DTM,代碼行數:20,代碼來源:CvGameUtils.py

示例13: bAlt

# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def bAlt():
	return CvEventInterface.getEventManager().bAlt
開發者ID:hardtimes1966,項目名稱:modxml,代碼行數:4,代碼來源:MonkeyTools.py

示例14: bShift

# 需要導入模塊: import CvEventInterface [as 別名]
# 或者: from CvEventInterface import getEventManager [as 別名]
def bShift():
	return CvEventInterface.getEventManager().bShift
開發者ID:hardtimes1966,項目名稱:modxml,代碼行數:4,代碼來源:MonkeyTools.py

示例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))
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:8,代碼來源:InputUtil.py


注:本文中的CvEventInterface.getEventManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。