当前位置: 首页>>代码示例>>Python>>正文


Python Game.host方法代码示例

本文整理汇总了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
开发者ID:FAForever,项目名称:server,代码行数:13,代码来源:test_game.py

示例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
开发者ID:FAForever,项目名称:server,代码行数:14,代码来源:test_game.py

示例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]
开发者ID:yorick-ne,项目名称:server,代码行数:14,代码来源:test_game.py

示例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
开发者ID:FAForever,项目名称:server,代码行数:15,代码来源:test_game.py

示例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}
开发者ID:FAForever,项目名称:server,代码行数:16,代码来源:test_game.py


注:本文中的server.games.game.Game.host方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。