本文整理汇总了Python中horizons.util.startgameoptions.StartGameOptions.create_start_multiplayer方法的典型用法代码示例。如果您正苦于以下问题:Python StartGameOptions.create_start_multiplayer方法的具体用法?Python StartGameOptions.create_start_multiplayer怎么用?Python StartGameOptions.create_start_multiplayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.util.startgameoptions.StartGameOptions
的用法示例。
在下文中一共展示了StartGameOptions.create_start_multiplayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare_multiplayer
# 需要导入模块: from horizons.util.startgameoptions import StartGameOptions [as 别名]
# 或者: from horizons.util.startgameoptions.StartGameOptions import create_start_multiplayer [as 别名]
def prepare_multiplayer(game, trader_enabled=True, pirate_enabled=True, natural_resource_multiplier=1):
"""Starts a multiplayer game server
TODO: actual game data parameter passing
"""
_modules.gui.show_loading_screen()
global preloading
preload_game_join(preloading)
# remove cursor while loading
horizons.globals.fife.cursor.set(fife_module.CURSOR_NONE)
horizons.globals.fife.engine.pump()
horizons.globals.fife.set_cursor_image('default')
# destruct old session (right now, without waiting for gc)
if _modules.session is not None and _modules.session.is_alive:
_modules.session.end()
# start new session
from horizons.mpsession import MPSession
# get random seed for game
uuid = game.uuid
random = sum([ int(uuid[i : i + 2], 16) for i in range(0, len(uuid), 2) ])
_modules.session = MPSession(horizons.globals.db, NetworkInterface(), rng_seed=random)
# NOTE: this data passing is only temporary, maybe use a player class/struct
if game.is_savegame:
map_file = SavegameManager.get_multiplayersave_map(game.map_name)
else:
map_file = SavegameManager.get_map(game.map_name)
options = StartGameOptions.create_start_multiplayer(map_file, game.get_player_list(), not game.is_savegame)
_modules.session.load(options)