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


Python AIPlayer.clear_caches方法代码示例

本文整理汇总了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.
开发者ID:mitfik,项目名称:unknown-horizons,代码行数:34,代码来源:session.py

示例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
开发者ID:mihaibivol,项目名称:unknown-horizons,代码行数:36,代码来源:__init__.py

示例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.
开发者ID:perher,项目名称:unknown-horizons,代码行数:44,代码来源:session.py

示例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
开发者ID:perher,项目名称:unknown-horizons,代码行数:42,代码来源:__init__.py

示例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()
开发者ID:acieroid,项目名称:unknown-horizons,代码行数:8,代码来源:session.py

示例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()
开发者ID:aviler,项目名称:unknown-horizons,代码行数:6,代码来源:session.py


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