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


Python PlayerUtil.getActivePlayerID方法代碼示例

本文整理匯總了Python中PlayerUtil.getActivePlayerID方法的典型用法代碼示例。如果您正苦於以下問題:Python PlayerUtil.getActivePlayerID方法的具體用法?Python PlayerUtil.getActivePlayerID怎麽用?Python PlayerUtil.getActivePlayerID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PlayerUtil的用法示例。


在下文中一共展示了PlayerUtil.getActivePlayerID方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: printStatus

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
def printStatus(ePlayer, eAskingPlayer=None):
	player = PlayerUtil.getPlayer(ePlayer)
	if eAskingPlayer is None:
		eAskingPlayer = PlayerUtil.getActivePlayerID()
	print "Trade Status -- %s" % player.getCivilizationShortDescription(0)
	for eItem, name in STATUS_TRADE_ITEMS:
		tradeData = TradeData()
		tradeData.ItemType = eItem
		can = player.canTradeItem(eAskingPlayer, tradeData, False)
		denial = player.getTradeDenial(eAskingPlayer, tradeData)
		will = denial == DenialTypes.NO_DENIAL
		if denial in DENIALS:
			denial = DENIALS[denial]
		else:
			denial = str(denial)
		if not can:
			if will:
				print "%s: can't but will" % (name)
			else:
				print "%s: can't and won't because %s" % (name, denial)
		else:
			if will:
				print "%s: will" % (name)
			else:
				print "%s: won't because %s" % (name, denial)
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:27,代碼來源:TradeUtil.py

示例2: onGoodyReceived

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def onGoodyReceived(self, argsList):
		"""
		Name free units from goody huts.
		"""
		iPlayer, pPlot, pUnit, iGoodyType = argsList
		goody = gc.getGoodyInfo(iGoodyType)
		if goody.getUnitClassType() != -1:
			if iPlayer == PlayerUtil.getActivePlayerID() and UnitNamingOpt.isEnabled():
				pPlayer = gc.getPlayer(iPlayer)
				pCity = pPlayer.getCapitalCity()
				if pCity is None or pCity.isNone():
					class EmpireAsCity:
						def __init__(self, name):
							self.name = name
						def getName(self):
							return self.name
					pCity = EmpireAsCity(pPlayer.getCivilizationAdjective(0))
				lUnitReName = UnitReName()
				zsEra = gc.getEraInfo(pPlayer.getCurrentEra()).getType()
				for i in range(pPlot.getNumUnits()):
					pUnit = pPlot.getUnit(i)
					if pUnit and not pUnit.isNone() and pUnit.getOwner() == iPlayer:
						if pUnit.getNameNoDesc() == "":
							zsUnitCombat = lUnitReName.getUnitCombat(pUnit)
							zsUnitClass = gc.getUnitClassInfo(pUnit.getUnitClassType()).getType()
							zsUnitNameConv = lUnitReName.getUnitNameConvFromIniFile(zsEra, zsUnitClass, zsUnitCombat)
							zsUnitName = lUnitReName.getUnitName(zsUnitNameConv, pUnit, pCity, True)
							if zsUnitName:
								pUnit.setName(zsUnitName)
開發者ID:markourm,項目名稱:fall,代碼行數:31,代碼來源:UnitNameEventManager.py

示例3: handleUserResponse

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
def handleUserResponse(argsList):
    eComment = argsList[0]
    commentArgsSize = argsList[1]
    if commentArgsSize:
        args = argsList[2:]
    else:
        args = []
    dispatchEvent(eComment, PlayerUtil.getActivePlayerID(), diplo.getWhoTradingWith(), args)
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:10,代碼來源:DiplomacyUtil.py

示例4: drawDots

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def drawDots(self, skip=None):
		"""
		Draws the dot for every city.
		"""
		dotAlpha = self.DOT_ALPHA
		for city in self.iterCities(PlayerUtil.getActivePlayerID()):
			if not city.isAt(skip):
				self.drawDot(city, dotAlpha)
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:10,代碼來源:CvStrategyOverlay.py

示例5: getProposedTrade

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
def getProposedTrade():
	trade = TradeUtil.Trade(PlayerUtil.getActivePlayerID(), diplo.getWhoTradingWith())
	if not diplo.ourOfferEmpty():
		getProposedTradeData(diplo.getPlayerTradeOffer, trade.addTrade)
	if not diplo.theirOfferEmpty():
		getProposedTradeData(diplo.getTheirTradeOffer, trade.addOtherTrade)
	BugUtil.debug("DiplomacyUtil.getProposedTrade - %r", trade)
	return trade
開發者ID:Alrik2002,項目名稱:Civ4-MMod,代碼行數:10,代碼來源:DiplomacyUtil.py

示例6: drawCities

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def drawCities(self, skip=None):
		"""
		Draws all of the cities except skip, if given.
		"""
		crossAlpha = self.CROSS_ALPHA
		dotAlpha = self.DOT_ALPHA
		for city in self.iterCities(PlayerUtil.getActivePlayerID()):
			if not city.isAt(skip):
				self.drawCity(city, crossAlpha, dotAlpha)
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:11,代碼來源:CvStrategyOverlay.py

示例7: drawCrosses

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def drawCrosses(self, layer=None, skip=None):
		"""
		Draws the cross for every city in the given layer.
		"""
		crossAlpha = self.CROSS_ALPHA
		for city in self.iterCities(PlayerUtil.getActivePlayerID()):
			if not city.isAt(skip):
				if layer is None or layer == city.layer:
					self.drawCross(city, crossAlpha)
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:11,代碼來源:CvStrategyOverlay.py

示例8: removeCityAt

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def removeCityAt(self, point):
		"""
		Sends a message to remove the active player's city at the given point.
		"""
		ePlayer = PlayerUtil.getActivePlayerID()
		if self.hasCity(ePlayer, point):
			CyMessageControl().sendModNetMessage(MSG_REMOVE_CITY, ePlayer, point[X] * 1000 + point[Y], -1, -1)
		else:
			self.freeze()
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:11,代碼來源:CvStrategyOverlay.py

示例9: removeCity

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def removeCity(self, ePlayer, city):
		"""
		Removes the city from the data set and erases its dot and cross.
		"""
		if city:
			BugUtil.debug("DotMap - removing city %s", city)
			del self.getCities(ePlayer)[city.point]
			self.dirty = True
			if ePlayer == PlayerUtil.getActivePlayerID():
				self.redrawCrosses(city.layer)
				self.eraseDot(city, self.DOT_ALPHA)
		else:
			BugUtil.warn("City doesn't exist")
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:15,代碼來源:CvStrategyOverlay.py

示例10: showReminders

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def showReminders(self, endOfTurn):
		global g_turnReminderTexts
		thisTurn = gc.getGame().getGameTurn()
		if (endOfTurn):
			prompt = BugUtil.getPlainText("TXT_KEY_REMIND_NEXT_TURN_PROMPT")
			eventId = RECALL_AGAIN_EVENT_ID
		else:
			g_turnReminderTexts = ""
			prompt = BugUtil.getPlainText("TXT_KEY_REMIND_END_TURN_PROMPT")
			eventId = RECALL_EVENT_ID
		yes = BugUtil.getPlainText("TXT_KEY_POPUP_YES")
		no = BugUtil.getPlainText("TXT_KEY_POPUP_NO")
		queue = self.reminders.get(PlayerUtil.getActivePlayerID())
		while (not queue.isEmpty()):
			nextTurn = queue.nextTurn()
			if (nextTurn > thisTurn):
				break
			elif (nextTurn < thisTurn):
				# invalid (lost) reminder
				reminder = queue.pop()
				BugUtil.warn("Reminder - skipped turn %d: %s", reminder.turn, reminder.message)
			else:
				self.reminder = queue.pop()
				if (g_autolog.isLogging() and ReminderOpt.isAutolog()):
					g_autolog.writeLog("Reminder: %s" % self.reminder.message)
				if (not endOfTurn):
					if (g_turnReminderTexts):
						g_turnReminderTexts += ", "
					g_turnReminderTexts += self.reminder.message
				if (ReminderOpt.isShowMessage()):
					CyInterface().addMessage(PlayerUtil.getActivePlayerID(), True, 10, self.reminder.message, 
											 None, 0, None, ColorTypes(8), 0, 0, False, False)
				if (ReminderOpt.isShowPopup()):
					popup = PyPopup.PyPopup(eventId, EventContextTypes.EVENTCONTEXT_SELF)
					popup.setHeaderString(self.reminder.message)
					popup.setBodyString(prompt)
					popup.addButton(yes)
					popup.addButton(no)
					popup.launch(False)
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:41,代碼來源:ReminderEventManager.py

示例11: check

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def check(self):
		#DLP
		if CyGame().isPitbossHost():
			return
		if (not Civ4lertsOpt.isShowWorstEnemyAlert()):
			return
		eActivePlayer = PlayerUtil.getActivePlayerID()
		eActiveTeam, activeTeam = PlayerUtil.getActiveTeamAndID()
		enemies = self.enemies[eActivePlayer]
		newEnemies = AttitudeUtil.getWorstEnemyTeams()
		delayedMessages = {}
		for eTeam, eNewEnemy in newEnemies.iteritems():
			if activeTeam.isHasMet(eTeam):
				eOldEnemy = enemies[eTeam]
				if eOldEnemy != -1 and not gc.getTeam(eOldEnemy).isAlive():
					eOldEnemy = -1
					enemies[eTeam] = -1
				if eActiveTeam != eNewEnemy and not activeTeam.isHasMet(eNewEnemy):
					eNewEnemy = -1
				if eOldEnemy != eNewEnemy:
					enemies[eTeam] = eNewEnemy
					if eNewEnemy == -1:
						if eOldEnemy == eActiveTeam:
							message = BugUtil.getText("TXT_KEY_CIV4LERTS_ON_YOU_NO_WORST_ENEMY", gc.getTeam(eTeam).getName())
						else:
							message = BugUtil.getText("TXT_KEY_CIV4LERTS_ON_NO_WORST_ENEMY", 
									(gc.getTeam(eTeam).getName(), gc.getTeam(eOldEnemy).getName()))
					elif eOldEnemy == -1:
						message = None # handled below
						if eNewEnemy not in delayedMessages:
							delayedMessages[eNewEnemy] = gc.getTeam(eTeam).getName()
						else:
							delayedMessages[eNewEnemy] += u", " + gc.getTeam(eTeam).getName()
					else:
						if eOldEnemy == eActiveTeam:
							message = BugUtil.getText("TXT_KEY_CIV4LERTS_ON_SWITCH_WORST_ENEMY_FROM_YOU", 
									(gc.getTeam(eTeam).getName(), gc.getTeam(eNewEnemy).getName()))
						elif eNewEnemy == eActiveTeam:
							message = BugUtil.getText("TXT_KEY_CIV4LERTS_ON_SWITCH_WORST_ENEMY_TO_YOU", 
									(gc.getTeam(eTeam).getName(), gc.getTeam(eOldEnemy).getName()))
						else:
							message = BugUtil.getText("TXT_KEY_CIV4LERTS_ON_SWITCH_WORST_ENEMY", 
									(gc.getTeam(eTeam).getName(), gc.getTeam(eNewEnemy).getName(), gc.getTeam(eOldEnemy).getName()))
					if message:
						addMessageNoIcon(eActivePlayer, message)
		for eEnemy, haters in delayedMessages.iteritems():
			if eActiveTeam == eEnemy:
				message = BugUtil.getText("TXT_KEY_CIV4LERTS_ON_YOU_WORST_ENEMY", haters)
			else:
				message = BugUtil.getText("TXT_KEY_CIV4LERTS_ON_WORST_ENEMY", (haters, gc.getTeam(eEnemy).getName()))
			addMessageNoIcon(eActivePlayer, message)
開發者ID:DarkLunaPhantom,項目名稱:civ4ffplus,代碼行數:53,代碼來源:Civ4lerts.py

示例12: addCity

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def addCity(self, city):
		"""
		Adds the city to the data set and draws its dot and cross.
		"""
		ePlayer = PlayerUtil.getActivePlayerID()
		if self.hasCity(ePlayer, city.point):
			oldCity = self.getCity(ePlayer, city.point)
			if city == oldCity:
				return
			self.removeCity(oldCity)
		BugUtil.debug("DotMap - adding city %s", city)
		self.getCities(ePlayer)[city.point] = city
		self.dirty = True
		self.drawCity(city, self.CROSS_ALPHA, self.DOT_ALPHA)
開發者ID:hardtimes1966,項目名稱:modxml,代碼行數:16,代碼來源:CvStrategyOverlay.py

示例13: onBeginActivePlayerTurn

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def onBeginActivePlayerTurn(self, argsList):
		if (not Civ4lertsOpt.isShowGoldTradeAlert()):
			return
		playerID = PlayerUtil.getActivePlayerID()
		for rival in TradeUtil.getGoldTradePartners(playerID):
			rivalID = rival.getID()
			oldMaxGoldTrade = self._getMaxGoldTrade(playerID, rivalID)
			newMaxGoldTrade = rival.AI_maxGoldTrade(playerID)
			deltaMaxGoldTrade = newMaxGoldTrade - oldMaxGoldTrade
			if deltaMaxGoldTrade >= Civ4lertsOpt.getGoldTradeThreshold():
				message = localText.getText("TXT_KEY_CIV4LERTS_ON_GOLD_TRADE", (rival.getName(), newMaxGoldTrade))
				addMessageNoIcon(playerID, message)
				self._setMaxGoldTrade(playerID, rivalID, newMaxGoldTrade)
			elif newMaxGoldTrade < oldMaxGoldTrade:
				self._setMaxGoldTrade(playerID, rivalID, newMaxGoldTrade)
開發者ID:Alrik2002,項目名稱:Civ4-MMod,代碼行數:17,代碼來源:Civ4lerts.py

示例14: unhighlightCity

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def unhighlightCity(self):
		"""
		Removes the highlight from the existing city location if there is one.
		
		If there is no city there (N), the current layer is redrawn (L) and the dot is erased (d).
		If the city is on the same layer (S), nothing is done (N). --> LC
		If the city is on a different layer (D), the current layer is redrawn (L) and the city is drawn (C).
		"""
		if self.highlightedCity:
			point = self.highlightedCity.point
			self.clearHighlightCrossLayer()
			ePlayer = PlayerUtil.getActivePlayerID()
			city = self.getCity(ePlayer, point)
			if city is not None:
				self.drawCity(city, self.CROSS_ALPHA, self.DOT_ALPHA)
			self.highlightedCity = None
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:18,代碼來源:CvStrategyOverlay.py

示例15: onBeginActivePlayerTurn

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayerID [as 別名]
	def onBeginActivePlayerTurn(self, argsList):
		if not Civ4lertsOpt.isShowSlaveTradeAlert():
			return
		if len(self.maxSlaveTrade) == 0:
			return
		playerID = PlayerUtil.getActivePlayerID()
		for rival in TradeUtil.getSlaveTradePartners(playerID):
			rivalID = rival.getID()
			oldMaxSlaveTrade = self._getMaxSlaveTrade(playerID, rivalID)
			newMaxSlaveTrade = rival.getUnitClassCount(gc.getInfoTypeForString("UNITCLASS_SLAVE"))
			deltaMaxSlaveTrade = newMaxSlaveTrade - oldMaxSlaveTrade
			if deltaMaxSlaveTrade > 0:
				message = localText.getText("TXT_KEY_CIV4LERTS_ON_SLAVE_TRADE", (rival.getCivilizationShortDescription(0), newMaxSlaveTrade))
				addMessageNoIcon(playerID, message)
				self._setMaxSlaveTrade(playerID, rivalID, newMaxSlaveTrade)
			elif newMaxSlaveTrade < oldMaxSlaveTrade:
				self._setMaxSlaveTrade(playerID, rivalID, newMaxSlaveTrade)
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:19,代碼來源:Civ4lerts.py


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