本文整理匯總了Python中PlayerUtil.getActivePlayer方法的典型用法代碼示例。如果您正苦於以下問題:Python PlayerUtil.getActivePlayer方法的具體用法?Python PlayerUtil.getActivePlayer怎麽用?Python PlayerUtil.getActivePlayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PlayerUtil
的用法示例。
在下文中一共展示了PlayerUtil.getActivePlayer方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: reset
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayer [as 別名]
def reset(self):
"Clears state kept for each city."
#DLP
if CyGame().isPitbossHost():
return
self._beforeReset()
player = PlayerUtil.getActivePlayer()
for city in PlayerUtil.playerCities(player):
self.resetCity(city)
示例2: getSaveFileName
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayer [as 別名]
def getSaveFileName(pathName):
if pathName:
activePlayer = PlayerUtil.getActivePlayer()
if not MapFinder.isActive() and options.isUsePlayerName():
fileName = activePlayer.getName()
turnYear = CyGameTextMgr().getTimeStr(gc.getGame().getGameTurn(), False)
fileName += '_' + turnYear.replace(" ", "-")
else:
objLeaderHead = gc.getLeaderHeadInfo (activePlayer.getLeaderType()).getText()
game = gc.getGame()
map = gc.getMap()
difficulty = gc.getHandicapInfo(activePlayer.getHandicapType()).getText()
mapType = os.path.basename(map.getMapScriptName())
mapSize = gc.getWorldInfo(map.getWorldSize()).getText()
mapClimate = gc.getClimateInfo(map.getClimate()).getText()
mapLevel = gc.getSeaLevelInfo(map.getSeaLevel()).getText()
era = gc.getEraInfo(game.getStartEra()).getText()
speed = gc.getGameSpeedInfo(game.getGameSpeedType()).getText()
turnYear = CyGameTextMgr().getTimeStr(game.getGameTurn(), False)
turnYear = turnYear.replace(" ", "-")
turnYear = turnYear.replace(",", "-")
fileName = objLeaderHead[0:3]
fileName += '_' + difficulty[0:3]
fileName += '_' + mapSize[0:3]
fileName += '_' + mapType[0:3]
fileName += '_' + speed[0:3]
fileName += '_' + era[0:3]
fileName += '_' + turnYear
fileName += '_' + mapClimate[0:3]
fileName += '_' + mapLevel[0:3]
fileName = BugPath.join(pathName, fileName)
baseFileName = CvUtil.convertToStr(fileName)
fileName = CvUtil.convertToStr(fileName + '_' + time.strftime("%b-%d-%Y_%H-%M-%S"))
return (fileName, baseFileName)
示例3: getHoverText
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayer [as 別名]
def getHoverText(eWidgetType, iData1, iData2, bOption):
city, iTurns = getDisplayCity()
if (not city):
# no rate or progress in any city and no city selected
return BugUtil.getText("TXT_KEY_MISC_GREAT_PERSON", (0, PlayerUtil.getActivePlayer().greatPeopleThreshold(False)))
iThreshold = gc.getPlayer(city.getOwner()).greatPeopleThreshold(False)
iProgress = city.getGreatPeopleProgress()
iRate = city.getGreatPeopleRate()
szText = BugUtil.colorText(city.getName(), "COLOR_HIGHLIGHT_TEXT")
szText += u"\n"
szText += BugUtil.getText("TXT_KEY_MISC_GREAT_PERSON", (iProgress, iThreshold))
if (iRate > 0):
szText += u"\n%d%s%s " % (iRate, g_gpIcon, BugUtil.getPlainText("TXT_KEY_PER_TURN"))
szText += BugUtil.getText("INTERFACE_CITY_TURNS", (iTurns,))
percents = calcPercentages(city)
if (len(percents) > 0):
percents.sort()
percents.reverse()
szText += u"\n"
for iPercent, iUnit in percents:
# iUnit = getUnitType(gpType)
szText += u"\n%s%s - %d%%" % (getUnitIcon(iUnit), gc.getUnitInfo(iUnit).getDescription(), iPercent)
return szText
示例4: reset
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActivePlayer [as 別名]
def reset(self):
"Clears state kept for each city."
self._beforeReset()
player = PlayerUtil.getActivePlayer()
for city in PlayerUtil.playerCities(player):
self.resetCity(city)