本文整理汇总了Python中gamestate.GameState.setCurrentPlayer方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.setCurrentPlayer方法的具体用法?Python GameState.setCurrentPlayer怎么用?Python GameState.setCurrentPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gamestate.GameState
的用法示例。
在下文中一共展示了GameState.setCurrentPlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Client
# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import setCurrentPlayer [as 别名]
#.........这里部分代码省略.........
self.game.removePlayer(name)
self.mainWindow.chat.addLine(Line(Line.PlayerLeft, target=name))
self.mainWindow.playerInfo.removePlayer(name)
elif msg == Message.PlayerLeftDuringGame:
name = args[0]
self.mainWindow.chat.addLine(Line(Line.PlayerLeft, target=name))
elif msg == Message.ColorChanged:
name = args[0]
color = args[1:]
self.game.setPlayerColor(name, color)
self.mainWindow.chat.changePlayerColor(name, color)
self.mainWindow.chat.addLine("%s has changed their color." % (name))
self.mainWindow.playerInfo.changePlayerColor(name, color)
elif msg == Message.NameChangeTaken:
self.mainWindow.chat.addLine("That name is already taken.")
elif msg == Message.NameChangeSuccess:
name = args[0]
self.game.setPlayerName(self.game.clientPlayer.name, name)
elif msg == Message.NameChanged:
before = args[0]
after = args[1]
self.game.setPlayerName(before, after)
self.mainWindow.chat.changePlayerName(before, after)
self.mainWindow.chat.addLine("%s changed their name to %s" % (before, after))
self.mainWindow.playerInfo.changePlayerName(before, after)
elif msg == Message.TurnChanged or msg == Message.CurrentPlayer:
name = args[0]
self.game.setCurrentPlayer(name)
if self.game.yourTurn():
self.mainWindow.activateWindow()
self.mainWindow.playerInfo.changeCurrentPlayer(name)
elif msg == Message.TerritoryUpdated:
(name, owner, count) = args
t = self.game.board.getTerritory(name)
previousOwner = t.owner
previousTroopCount = t.troopCount
t.owner = self.game.getPlayer(owner)
t.troopCount = count
if t.owner != previousOwner:
self.mainWindow.boardWidget.updateTerritoryOwner(name, owner)
if t.troopCount != previousTroopCount:
self.mainWindow.boardWidget.updateTerritoryTroopCount(name, count)
self.mainWindow.playerInfo.updateStatistics()
self.game.changed.emit()
elif msg == Message.RemainingTroopsChanged:
troops = args[0]
self.game.remainingTroops = troops
elif msg == Message.MustExchangeCards:
self.mainWindow.chat.addLine("You must trade in your cards.")
elif msg == Message.CardsExchanged:
name = args[0]
indexes = args[1:]
player = self.game.getPlayer(name)
if player == self.game.clientPlayer:
player.cards = [c for i, c in enumerate(player.cards) if not i in indexes]
self.mainWindow.player.updateStatistics()