当前位置: 首页>>代码示例>>Python>>正文


Python CvEventInterface类代码示例

本文整理汇总了Python中CvEventInterface的典型用法代码示例。如果您正苦于以下问题:Python CvEventInterface类的具体用法?Python CvEventInterface怎么用?Python CvEventInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CvEventInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onLoad

def onLoad(argsList):
	'Called when a file is loaded'
	import pickle	
	import CvEventInterface
	loadDataStr=argsList[0]	
	if len(loadDataStr):
		CvEventInterface.onEvent( ('OnLoad',pickle.loads(loadDataStr),0,0,0,0,0 ) )	
开发者ID:hardtimes1966,项目名称:modxml,代码行数:7,代码来源:CvAppInterface.py

示例2: doHotSeatCheck

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,代码行数:9,代码来源:BugUtil.py

示例3: handle

 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,代码行数:13,代码来源:BugConfig.py

示例4: calculateScore

	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,代码行数:29,代码来源:FinalFrontierGameUtils.py

示例5: getBuildingCostMod

	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,代码行数:8,代码来源:FinalFrontierGameUtils.py

示例6: getUnitCostMod

	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,代码行数:8,代码来源:FinalFrontierGameUtils.py

示例7: AI_chooseProduction

	def AI_chooseProduction(self,argsList):
		pCity = argsList[0]
		
		FinalFrontier = CvEventInterface.getEventManager().FinalFrontier
		
		bOverride = FinalFrontier.getAI().doCityAIProduction(pCity)
		
		return bOverride
开发者ID:DarkLunaPhantom,项目名称:civ4ffplus,代码行数:8,代码来源:FinalFrontierGameUtils.py

示例8: onSave

def onSave():
	'Here is your chance to save data.  This function should return a string'
	import CvWBDesc
	import pickle	
	import CvEventInterface
	# if the tutorial is active, it will save out the Shown Messages list
	saveDataStr = pickle.dumps( CvEventInterface.onEvent( ('OnSave',0,0,0,0,0 ) ) )
	return saveDataStr
开发者ID:hardtimes1966,项目名称:modxml,代码行数:8,代码来源:CvAppInterface.py

示例9: 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()	
开发者ID:hardtimes1966,项目名称:modxml,代码行数:22,代码来源:CvAppInterface.py

示例10: AI_unitUpdate

	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,代码行数:15,代码来源:FinalFrontierGameUtils.py

示例11: onKbdEvent

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,代码行数:15,代码来源:CvOverlayScreenUtils.py

示例12: __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
开发者ID:hardtimes1966,项目名称:modxml,代码行数:15,代码来源:BugConfig.py

示例13: request

    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,代码行数:48,代码来源:Webserver.py

示例14: canPickPlot

	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,代码行数:18,代码来源:CvGameUtils.py

示例15: handle

	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,代码行数:6,代码来源:InputUtil.py


注:本文中的CvEventInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。