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


Python StartGameOptions.create_start_scenario方法代码示例

本文整理汇总了Python中horizons.util.startgameoptions.StartGameOptions.create_start_scenario方法的典型用法代码示例。如果您正苦于以下问题:Python StartGameOptions.create_start_scenario方法的具体用法?Python StartGameOptions.create_start_scenario怎么用?Python StartGameOptions.create_start_scenario使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在horizons.util.startgameoptions.StartGameOptions的用法示例。


在下文中一共展示了StartGameOptions.create_start_scenario方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: act

# 需要导入模块: from horizons.util.startgameoptions import StartGameOptions [as 别名]
# 或者: from horizons.util.startgameoptions.StartGameOptions import create_start_scenario [as 别名]
	def act(self, player_name, player_color):
		map_file = self._get_selected_map()

		try:
			options = StartGameOptions.create_start_scenario(map_file)
			options.set_human_data(player_name, player_color)
			horizons.main.start_singleplayer(options)
		except InvalidScenarioFileFormat as e:
			self._show_invalid_scenario_file_popup(e)
开发者ID:Rareson,项目名称:unknown-horizons,代码行数:11,代码来源:singleplayermenu.py

示例2: start_single

# 需要导入模块: from horizons.util.startgameoptions import StartGameOptions [as 别名]
# 或者: from horizons.util.startgameoptions.StartGameOptions import create_start_scenario [as 别名]
	def start_single(self):
		""" Starts a single player horizons. """
		assert self.current is self.widgets['singleplayermenu']
		playername = self.current.playerdata.get_player_name()
		if not playername:
			self.show_popup(_("Invalid player name"), _("You entered an invalid playername."))
			return
		playercolor = self.current.playerdata.get_player_color()
		self._save_player_name()

		if self.current.collectData('random'):
			map_file = self._get_random_map_file()
		else:
			assert self.active_right_side.collectData('maplist') != -1
			map_file = self._get_selected_map()

		is_scenario = bool(self.current.collectData('scenario'))
		if not is_scenario:
			ai_players = int(self.current.aidata.get_ai_players())
			horizons.globals.fife.set_uh_setting("AIPlayers", ai_players)
		horizons.globals.fife.save_settings()

		self.mainmenu.show_loading_screen()
		if is_scenario:
			try:
				options = StartGameOptions.create_start_scenario(map_file)
				options.set_human_data(playername, playercolor)
				horizons.main.start_singleplayer(options)
			except InvalidScenarioFileFormat as e:
				self._show_invalid_scenario_file_popup(e)
				self._select_single(show='scenario')
		else: # free play/random map
			options = StartGameOptions.create_start_map(map_file)
			options.set_human_data(playername, playercolor)
			options.ai_players = ai_players
			options.trader_enabled = self.widgets['game_settings'].findChild(name='free_trader').marked
			options.pirate_enabled = self.widgets['game_settings'].findChild(name='pirates').marked
			options.disasters_enabled = self.widgets['game_settings'].findChild(name='disasters').marked
			options.natural_resource_multiplier = self._get_natural_resource_multiplier()
			horizons.main.start_singleplayer(options)

		ExtScheduler().rem_all_classinst_calls(self)
开发者ID:Antagonym,项目名称:unknown-horizons,代码行数:44,代码来源:singleplayermenu.py


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