本文整理汇总了Python中horizons.util.startgameoptions.StartGameOptions.create_load_game方法的典型用法代码示例。如果您正苦于以下问题:Python StartGameOptions.create_load_game方法的具体用法?Python StartGameOptions.create_load_game怎么用?Python StartGameOptions.create_load_game使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.util.startgameoptions.StartGameOptions
的用法示例。
在下文中一共展示了StartGameOptions.create_load_game方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_save_load_ticket_1421
# 需要导入模块: from horizons.util.startgameoptions import StartGameOptions [as 别名]
# 或者: from horizons.util.startgameoptions.StartGameOptions import create_load_game [as 别名]
def test_save_load_ticket_1421(gui):
"""
Boatbuilder crashes when saving/loading while a ship is being produced.
"""
# Select boat builder
gui.cursor_click(64, 10, 'left')
# Select trade ships tab
gui.trigger('tab_base', '1')
# Build huker
gui.trigger('boatbuilder_showcase', 'ok_0')
# Select war ships tab
gui.trigger('tab_base', '2')
# Build frigate
gui.trigger('boatbuilder_showcase', 'ok_0')
fd, filename = tempfile.mkstemp()
os.close(fd)
assert gui.session.save(savegamename=filename)
options = StartGameOptions.create_load_game(filename, None)
horizons.main.start_singleplayer(options)
示例2: _load_cmd_map
# 需要导入模块: from horizons.util.startgameoptions import StartGameOptions [as 别名]
# 或者: from horizons.util.startgameoptions.StartGameOptions import create_load_game [as 别名]
def _load_cmd_map(savegame, ai_players, force_player_id=None):
"""Load a map specified by user.
@param savegame: either the displayname of a savegame or a path to a savegame
@return: bool, whether loading succeeded"""
# first check for partial or exact matches in the normal savegame list
savegames = SavegameManager.get_saves()
map_file = _find_matching_map(savegame, savegames)
if not map_file:
return False
options = StartGameOptions.create_load_game(map_file, force_player_id)
start_singleplayer(options)
return True
示例3: saveload
# 需要导入模块: from horizons.util.startgameoptions import StartGameOptions [as 别名]
# 或者: from horizons.util.startgameoptions.StartGameOptions import create_load_game [as 别名]
def saveload(gui):
"""Save and load the game (gui test version). Use like this:
# For gui tests
saveload(gui)
"""
fd, filename = tempfile.mkstemp()
os.close(fd)
assert gui.session.save(savegamename=filename)
options = StartGameOptions.create_load_game(filename, None)
# This hands out a new session, but `gui.session` is a property.
horizons.main.start_singleplayer(options)
# Restore some properties that were changed for tests:
# Set game speed to maximum, and disable autoscroll.
gui.setup()
示例4: _load_last_quicksave
# 需要导入模块: from horizons.util.startgameoptions import StartGameOptions [as 别名]
# 或者: from horizons.util.startgameoptions.StartGameOptions import create_load_game [as 别名]
def _load_last_quicksave(session=None, force_player_id=None):
"""Load last quicksave
@param session: value of session
@return: bool, whether loading succeeded"""
save_files = SavegameManager.get_quicksaves()[0]
if _modules.session is not None:
if not save_files:
_modules.session.ingame_gui.open_popup(_("No quicksaves found"),
_("You need to quicksave before you can quickload."))
return False
else:
if not save_files:
print "Error: No quicksave found."
return False
save = max(save_files)
options = StartGameOptions.create_load_game(save, force_player_id)
start_singleplayer(options)
return True