本文整理匯總了Python中PlayerUtil.getActiveWars方法的典型用法代碼示例。如果您正苦於以下問題:Python PlayerUtil.getActiveWars方法的具體用法?Python PlayerUtil.getActiveWars怎麽用?Python PlayerUtil.getActiveWars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PlayerUtil
的用法示例。
在下文中一共展示了PlayerUtil.getActiveWars方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: showSituationReport
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getActiveWars [as 別名]
def showSituationReport(self):
self.timer.start()
self.deleteAllWidgets()
screen = self.getScreen()
# get Player arrays
pVassals = [[]] * gc.getMAX_PLAYERS()
pDefPacts = [[]] * gc.getMAX_PLAYERS()
bVassals = False
bDefPacts = False
for iLoopPlayer in range(gc.getMAX_PLAYERS()):
pPlayer = gc.getPlayer(iLoopPlayer)
if (pPlayer.isAlive()
and (gc.getTeam(pPlayer.getTeam()).isHasMet(gc.getPlayer(self.iActivePlayer).getTeam())
or gc.getGame().isDebugMode())
and iLoopPlayer != self.iActivePlayer
and not pPlayer.isBarbarian()
and not pPlayer.isMinorCiv()):
pVassals[iLoopPlayer] = PlayerUtil.getVassals(iLoopPlayer, self.iActivePlayer)
pDefPacts[iLoopPlayer] = PlayerUtil.getDefensivePacts(iLoopPlayer, self.iActivePlayer)
if len(pVassals[iLoopPlayer]) > 0:
bVassals = True
if len(pDefPacts[iLoopPlayer]) > 0:
bDefPacts = True
bVassals = True
bDefPacts = True
self.initIconGrid(screen, bVassals, bDefPacts)
self.initPower()
activePlayer = gc.getPlayer(self.iActivePlayer)
# Assemble the panel
iPANEL_X = 5
iPANEL_Y = 60
iPANEL_WIDTH = self.W_SCREEN - 20
iPANEL_HEIGHT = self.H_SCREEN - 120
self.tradePanel = self.getNextWidgetName()
screen.addPanel(self.tradePanel, "", "", True, True, iPANEL_X, iPANEL_Y, iPANEL_WIDTH, iPANEL_HEIGHT, PanelStyles.PANEL_STYLE_MAIN )
self.iconGrid.createGrid()
self.iconGrid.clearData()
iRow = 0
for iLoopPlayer in range(gc.getMAX_PLAYERS()):
pPlayer = gc.getPlayer(iLoopPlayer)
if (pPlayer.isAlive()
and (gc.getTeam(pPlayer.getTeam()).isHasMet(gc.getPlayer(self.iActivePlayer).getTeam())
or gc.getGame().isDebugMode())
and iLoopPlayer != self.iActivePlayer
and not pPlayer.isBarbarian()
and not pPlayer.isMinorCiv()):
# szPlayerName = pPlayer.getName() + "/" + pPlayer.getCivilizationShortDescription(0)
# BugUtil.debug("Grid_ThreatIndex - Start %i %s" % (iLoopPlayer, szPlayerName))
# BugUtil.debug("Grid_ThreatIndex - Start %i" % (iLoopPlayer))
self.iconGrid.appendRow(pPlayer.getCivilizationShortDescription(0), "", 3)
# add leaderhead icon
self.iconGrid.addIcon(iRow, self.Col_Leader,
gc.getLeaderHeadInfo(pPlayer.getLeaderType()).getButton(), 64,
WidgetTypes.WIDGET_LEADERHEAD, iLoopPlayer, self.iActivePlayer)
# add worst enemy
self.Grid_WorstEnemy(iRow, iLoopPlayer)
# add current war opponents
pActiveWars = PlayerUtil.getActiveWars(iLoopPlayer, self.iActivePlayer)
bCurrentWar = len(pActiveWars) > 0
for pLoopPlayer in pActiveWars:
self.iconGrid.addIcon(iRow, self.Col_Curr_Wars,
gc.getLeaderHeadInfo (pLoopPlayer.getLeaderType()).getButton(), 32,
*BugDll.widgetVersion(2, "WIDGET_LEADERHEAD_RELATIONS", iLoopPlayer, pLoopPlayer.getID(),
WidgetTypes.WIDGET_LEADERHEAD, iLoopPlayer, pLoopPlayer.getID()))
# show vassals
if bVassals:
for pLoopPlayer in pVassals[iLoopPlayer]:
self.iconGrid.addIcon(iRow, self.Col_Vassals,
gc.getLeaderHeadInfo (pLoopPlayer.getLeaderType()).getButton(), 32,
*BugDll.widgetVersion(2, "WIDGET_LEADERHEAD_RELATIONS", iLoopPlayer, pLoopPlayer.getID(),
WidgetTypes.WIDGET_LEADERHEAD, iLoopPlayer, pLoopPlayer.getID()))
# show defensive pacts
if bDefPacts:
for pLoopPlayer in pDefPacts[iLoopPlayer]:
self.iconGrid.addIcon(iRow, self.Col_DefPacts,
gc.getLeaderHeadInfo (pLoopPlayer.getLeaderType()).getButton(), 32,
*BugDll.widgetVersion(2, "WIDGET_LEADERHEAD_RELATIONS", iLoopPlayer, pLoopPlayer.getID(),
WidgetTypes.WIDGET_LEADERHEAD, iLoopPlayer, pLoopPlayer.getID()))
# show players that the current player will declare on
#.........這裏部分代碼省略.........