本文整理汇总了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)
示例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)
示例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)