當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。