本文整理汇总了Python中horizons.ai.aiplayer.behavior.BehaviorManager.load方法的典型用法代码示例。如果您正苦于以下问题:Python BehaviorManager.load方法的具体用法?Python BehaviorManager.load怎么用?Python BehaviorManager.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.ai.aiplayer.behavior.BehaviorManager
的用法示例。
在下文中一共展示了BehaviorManager.load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish_loading
# 需要导入模块: from horizons.ai.aiplayer.behavior import BehaviorManager [as 别名]
# 或者: from horizons.ai.aiplayer.behavior.BehaviorManager import load [as 别名]
def finish_loading(self, db):
""" This is called separately because most objects are loaded after the player. """
# load the ships
for ship_id, state_id in db("SELECT rowid, state FROM ai_ship WHERE owner = ?", self.worldid):
ship = WorldObject.get_object_by_id(ship_id)
self.ships[ship] = self.shipStates[state_id]
# load unit manager
self.unit_manager = UnitManager.load(db, self)
# load combat manager
self.combat_manager = CombatManager.load(db, self)
# load strategy manager
self.strategy_manager = StrategyManager.load(db, self)
# load BehaviorManager
self.behavior_manager = BehaviorManager.load(db, self)
# load the land managers
for (worldid,) in db("SELECT rowid FROM ai_land_manager WHERE owner = ?", self.worldid):
land_manager = LandManager.load(db, self, worldid)
self.islands[land_manager.island.worldid] = land_manager
# load the settlement managers and settlement foundation missions
for land_manager in self.islands.itervalues():
db_result = db("SELECT rowid FROM ai_settlement_manager WHERE land_manager = ?", land_manager.worldid)
if db_result:
settlement_manager = SettlementManager.load(db, self, db_result[0][0])
self.settlement_managers.append(settlement_manager)
self._settlement_manager_by_settlement_id[settlement_manager.settlement.worldid] = settlement_manager
# load the foundation ship preparing missions
db_result = db("SELECT rowid FROM ai_mission_prepare_foundation_ship WHERE settlement_manager = ?",
settlement_manager.worldid)
for (mission_id,) in db_result:
self.missions.add(PrepareFoundationShip.load(db, mission_id, self.report_success, self.report_failure))
else:
mission_id = db("SELECT rowid FROM ai_mission_found_settlement WHERE land_manager = ?", land_manager.worldid)[0][0]
self.missions.add(FoundSettlement.load(db, mission_id, self.report_success, self.report_failure))
for settlement_manager in self.settlement_managers:
# load the domestic trade missions
db_result = db("SELECT rowid FROM ai_mission_domestic_trade WHERE source_settlement_manager = ?", settlement_manager.worldid)
for (mission_id,) in db_result:
self.missions.add(DomesticTrade.load(db, mission_id, self.report_success, self.report_failure))
# load the special domestic trade missions
db_result = db("SELECT rowid FROM ai_mission_special_domestic_trade WHERE source_settlement_manager = ?", settlement_manager.worldid)
for (mission_id,) in db_result:
self.missions.add(SpecialDomesticTrade.load(db, mission_id, self.report_success, self.report_failure))
# load the international trade missions
db_result = db("SELECT rowid FROM ai_mission_international_trade WHERE settlement_manager = ?", settlement_manager.worldid)
for (mission_id,) in db_result:
self.missions.add(InternationalTrade.load(db, mission_id, self.report_success, self.report_failure))
示例2: finish_loading
# 需要导入模块: from horizons.ai.aiplayer.behavior import BehaviorManager [as 别名]
# 或者: from horizons.ai.aiplayer.behavior.BehaviorManager import load [as 别名]
def finish_loading(self, db):
# load ships one by one from db (ship instances themselves are loaded already, but
# we have to use them here)
for ship_id, state_id in db("SELECT rowid, state FROM pirate_ships"):
state = self.shipStates[state_id]
ship = WorldObject.get_object_by_id(ship_id)
self.ships[ship] = state
# load unit manager
self.unit_manager = UnitManager.load(db, self)
# load combat manager
self.combat_manager = PirateCombatManager.load(db, self)
# load strategy manager
self.strategy_manager = PirateStrategyManager.load(db, self)
# load BehaviorManager
self.behavior_manager = BehaviorManager.load(db, self)