本文整理汇总了Python中server.games.game.Game.host方法的典型用法代码示例。如果您正苦于以下问题:Python Game.host方法的具体用法?Python Game.host怎么用?Python Game.host使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.games.game.Game
的用法示例。
在下文中一共展示了Game.host方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_game_is_invalid_due_to_desyncs
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import host [as 别名]
async def test_game_is_invalid_due_to_desyncs(game: Game, players):
await game.clear_data()
game.state = GameState.LOBBY
add_connected_players(game, [players.hosting, players.joining])
game.host = players.hosting
await game.launch()
game.desyncs = 30
await game.on_game_end()
assert game.validity is ValidityState.TOO_MANY_DESYNCS
示例2: test_game_sim_ends_when_no_more_connections
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import host [as 别名]
async def test_game_sim_ends_when_no_more_connections(game: Game, players):
await game.clear_data()
game.state = GameState.LOBBY
host_conn = add_connected_player(game, players.hosting)
join_conn = add_connected_player(game, players.joining)
game.host = players.hosting
await game.launch()
await game.remove_game_connection(host_conn)
await game.remove_game_connection(join_conn)
assert game.ended
示例3: add_connected_players
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import host [as 别名]
def add_connected_players(game: Game, players):
"""
Utility to add players with army and StartSpot indexed by a list
"""
for army, player in enumerate(players):
add_connected_player(game, player)
game.set_player_option(player.id, 'Army', army)
game.set_player_option(player.id, 'StartSpot', army)
game.set_player_option(player.id, 'Team', army)
game.set_player_option(player.id, 'Faction', 0)
game.set_player_option(player.id, 'Color', 0)
game.host = players[0]
示例4: test_game_sim_ends_when_connections_ended_sim
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import host [as 别名]
async def test_game_sim_ends_when_connections_ended_sim(game: Game, players):
await game.clear_data()
game.state = GameState.LOBBY
host_conn = add_connected_player(game, players.hosting)
join_conn = add_connected_player(game, players.joining)
game.host = players.hosting
await game.launch()
host_conn.finished_sim = True
join_conn.finished_sim = True
await game.check_sim_end()
assert game.ended
示例5: test_game_launch_freezes_players
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import host [as 别名]
async def test_game_launch_freezes_players(game: Game, players):
await game.clear_data()
game.state = GameState.LOBBY
host_conn = add_connected_player(game, players.hosting)
game.host = players.hosting
add_connected_player(game, players.joining)
await game.launch()
assert game.state == GameState.LIVE
assert game.players == {players.hosting, players.joining}
await game.remove_game_connection(host_conn)
assert game.players == {players.hosting, players.joining}