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


Python Weapon.save_attacks方法代码示例

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


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

示例1: save

# 需要导入模块: from horizons.world.units.weapon import Weapon [as 别名]
# 或者: from horizons.world.units.weapon.Weapon import save_attacks [as 别名]
	def save(self, db):
		"""Saves the current game to the specified db.
		@param db: DbReader object of the db the game is saved to."""
		super(World, self).save(db)
		if isinstance(self.map_name, list):
			db("INSERT INTO metadata VALUES(?, ?)", 'random_island_sequence', ' '.join(self.map_name))
		else:
			# the map name has to be simplified because the absolute paths won't be transferable between machines
			simplified_name = self.map_name
			if self.map_name.startswith(PATHS.USER_MAPS_DIR):
				simplified_name = 'USER_MAPS_DIR:' + simplified_name[len(PATHS.USER_MAPS_DIR):]
			db("INSERT INTO metadata VALUES(?, ?)", 'map_name', simplified_name)

		for island in self.islands:
			island.save(db)
		for player in self.players:
			player.save(db)
		if self.trader is not None:
			self.trader.save(db)
		if self.pirate is not None:
			self.pirate.save(db)
		for unit in self.ships + self.ground_units:
			unit.save(db)
		for bullet in self.bullets:
			bullet.save(db)
		self.diplomacy.save(db)
		Weapon.save_attacks(db)
		self.disaster_manager.save(db)
开发者ID:ThePawnBreak,项目名称:unknown-horizons,代码行数:30,代码来源:__init__.py

示例2: save

# 需要导入模块: from horizons.world.units.weapon import Weapon [as 别名]
# 或者: from horizons.world.units.weapon.Weapon import save_attacks [as 别名]
	def save(self, db):
		"""Saves the current game to the specified db.
		@param db: DbReader object of the db the game is saved to."""
		super(World, self).save(db)
		for name, value in self.properties.iteritems():
			db("INSERT INTO map_properties (name, value) VALUES (?, ?)", name, json.dumps(value))
		for island in self.islands:
			island.save(db)
		for player in self.players:
			player.save(db)
		if self.trader is not None:
			self.trader.save(db)
		if self.pirate is not None:
			self.pirate.save(db)
		for unit in self.ships + self.ground_units:
			unit.save(db)
		for bullet in self.bullets:
			bullet.save(db)
		self.diplomacy.save(db)
		Weapon.save_attacks(db)
		self.disaster_manager.save(db)
开发者ID:acieroid,项目名称:unknown-horizons,代码行数:23,代码来源:__init__.py

示例3: save

# 需要导入模块: from horizons.world.units.weapon import Weapon [as 别名]
# 或者: from horizons.world.units.weapon.Weapon import save_attacks [as 别名]
	def save(self, db):
		"""Saves the current game to the specified db.
		@param db: DbReader object of the db the game is saved to."""
		super(World, self).save(db)
		if isinstance(self.map_name, list):
			db("INSERT INTO metadata VALUES(?, ?)", 'random_island_sequence', ' '.join(self.map_name))
		else:
			db("INSERT INTO metadata VALUES(?, ?)", 'map_name', self.map_name)

		for island in self.islands:
			island.save(db)
		for player in self.players:
			player.save(db)
		if self.trader is not None:
			self.trader.save(db)
		if self.pirate is not None:
			self.pirate.save(db)
		for unit in self.ships + self.ground_units:
			unit.save(db)
		for bullet in self.bullets:
			bullet.save(db)
		self.diplomacy.save(db)
		Weapon.save_attacks(db)
		self.disaster_manager.save(db)
开发者ID:Hadescho,项目名称:unknown-horizons,代码行数:26,代码来源:__init__.py


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