本文整理汇总了Python中horizons.ai.aiplayer.AIPlayer.clear_caches方法的典型用法代码示例。如果您正苦于以下问题:Python AIPlayer.clear_caches方法的具体用法?Python AIPlayer.clear_caches怎么用?Python AIPlayer.clear_caches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.ai.aiplayer.AIPlayer
的用法示例。
在下文中一共展示了AIPlayer.clear_caches方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from horizons.ai.aiplayer import AIPlayer [as 别名]
# 或者: from horizons.ai.aiplayer.AIPlayer import clear_caches [as 别名]
def __init__(self, gui, db, rng_seed=None):
super(Session, self).__init__()
self.log.debug("Initing session")
self.gui = gui # main gui, not ingame gui
self.db = db # main db for game data (game.sqlite)
# this saves how often the current game has been saved
self.savecounter = 0
self.is_alive = True
WorldObject.reset()
NamedObject.reset()
AIPlayer.clear_caches()
#game
self.random = self.create_rng(rng_seed)
self.timer = self.create_timer()
Scheduler.create_instance(self.timer)
self.manager = self.create_manager()
self.view = View(self, (15, 15))
Entities.load(self.db)
self.scenario_eventhandler = ScenarioEventHandler(self) # dummy handler with no events
self.campaign = {}
#GUI
self.gui.session = self
self.ingame_gui = IngameGui(self, self.gui)
self.keylistener = IngameKeyListener(self)
self.coordinates_tooltip = None
self.display_speed()
self.selected_instances = set()
self.selection_groups = [set()] * 10 # List of sets that holds the player assigned unit groups.
示例2: __init__
# 需要导入模块: from horizons.ai.aiplayer import AIPlayer [as 别名]
# 或者: from horizons.ai.aiplayer.AIPlayer import clear_caches [as 别名]
def __init__(self, db, rng_seed=None):
"""
Unfortunately, right now there is no other way to setup Dummy versions of the GUI,
View etc., unless we want to patch the references in the session module.
"""
super(LivingObject, self).__init__()
self.gui = Dummy()
self.db = db
self.savecounter = 0 # this is a new game.
self.is_alive = True
WorldObject.reset()
NamedObject.reset()
AIPlayer.clear_caches()
# Game
self.current_tick = 0
self.random = self.create_rng(rng_seed)
self.timer = self.create_timer()
Scheduler.create_instance(self.timer)
ExtScheduler.create_instance(Dummy)
self.manager = self.create_manager()
self.view = Dummy()
self.view.renderer = Dummy()
Entities.load(self.db)
self.scenario_eventhandler = Dummy()
self.campaign = {}
self.selected_instances = []
# GUI
self.gui.session = self
self.ingame_gui = Dummy()
GAME_SPEED.TICKS_PER_SECOND = 16
示例3: __init__
# 需要导入模块: from horizons.ai.aiplayer import AIPlayer [as 别名]
# 或者: from horizons.ai.aiplayer.AIPlayer import clear_caches [as 别名]
def __init__(self, gui, db, rng_seed=None):
super(Session, self).__init__()
assert isinstance(gui, Gui)
assert isinstance(db, horizons.util.uhdbaccessor.UhDbAccessor)
self.log.debug("Initing session")
self.gui = gui # main gui, not ingame gui
self.db = db # main db for game data (game.sql)
# this saves how often the current game has been saved
self.savecounter = 0
self.is_alive = True
self.message_bus = MessageBus()
# misc
WorldObject.reset()
NamedComponent.reset()
AIPlayer.clear_caches()
#game
self.random = self.create_rng(rng_seed)
assert isinstance(self.random, Random)
self.timer = self.create_timer()
Scheduler.create_instance(self.timer)
self.manager = self.create_manager()
self.view = View(self)
Entities.load(self.db)
self.scenario_eventhandler = ScenarioEventHandler(self) # dummy handler with no events
self.campaign = {}
#GUI
self.gui.session = self
self.ingame_gui = IngameGui(self, self.gui)
self.keylistener = IngameKeyListener(self)
self.coordinates_tooltip = None
self.display_speed()
LastActivePlayerSettlementManager.create_instance(self)
self.status_icon_manager = StatusIconManager(self)
self.selected_instances = set()
self.selection_groups = [set()] * 10 # List of sets that holds the player assigned unit groups.
示例4: __init__
# 需要导入模块: from horizons.ai.aiplayer import AIPlayer [as 别名]
# 或者: from horizons.ai.aiplayer.AIPlayer import clear_caches [as 别名]
def __init__(self, db, rng_seed=None):
"""
Unfortunately, right now there is no other way to setup Dummy versions of the GUI,
View etc., unless we want to patch the references in the session module.
"""
super(LivingObject, self).__init__()
self.gui = Dummy()
self.db = db
self.savecounter = 0 # this is a new game.
self.is_alive = True
WorldObject.reset()
NamedComponent.reset()
AIPlayer.clear_caches()
# Game
self.random = self.create_rng(rng_seed)
self.timer = self.create_timer()
Scheduler.create_instance(self.timer)
ExtScheduler.create_instance(Dummy)
self.manager = self.create_manager()
self.view = Dummy()
self.view.renderer = Dummy()
Entities.load(self.db)
self.scenario_eventhandler = Dummy()
self.campaign = {}
self.message_bus = MessageBus()
self.status_icon_manager = StatusIconManager(self)
# GUI
self.gui.session = self
self.ingame_gui = Dummy()
LastActivePlayerSettlementManager.create_instance(self)
self.selected_instances = set()
self.selection_groups = [set()] * 10 # List of sets that holds the player assigned unit groups.
GAME_SPEED.TICKS_PER_SECOND = 16
示例5: _clear_caches
# 需要导入模块: from horizons.ai.aiplayer import AIPlayer [as 别名]
# 或者: from horizons.ai.aiplayer.AIPlayer import clear_caches [as 别名]
def _clear_caches(cls):
"""Clear all data caches in global namespace related to a session"""
WorldObject.reset()
NamedComponent.reset()
AIPlayer.clear_caches()
SelectableBuildingComponent.reset()
示例6: _clear_caches
# 需要导入模块: from horizons.ai.aiplayer import AIPlayer [as 别名]
# 或者: from horizons.ai.aiplayer.AIPlayer import clear_caches [as 别名]
def _clear_caches(self):
WorldObject.reset()
NamedComponent.reset()
AIPlayer.clear_caches()