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


Python messaging.SettlerUpdate类代码示例

本文整理汇总了Python中horizons.messaging.SettlerUpdate的典型用法代码示例。如果您正苦于以下问题:Python SettlerUpdate类的具体用法?Python SettlerUpdate怎么用?Python SettlerUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SettlerUpdate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: level_down

	def level_down(self):
		if self.level == 0: # can't level down any more
			# replace this building with a ruin
			command = Build(BUILDINGS.SETTLER_RUIN, self.position.origin.x, \
			                self.position.origin.y, island=self.island, settlement=self.settlement)

			Scheduler().add_new_object(
			  Callback.ChainedCallbacks(self.remove, Callback(command, self.owner)), # remove, then build new
			  self, run_in=0)

			self.log.debug("%s: Destroyed by lack of happiness", self)
			if self.owner.is_local_player:
				# check_duplicate: only trigger once for different settlers of a neighborhood
				self.session.ingame_gui.message_widget.add(self.position.center().x, self.position.center().y, \
			                                           'SETTLERS_MOVED_OUT', check_duplicate=True)
		else:
			self.level -= 1
			self._update_level_data()
			# reset happiness value for new level
			self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, self.__get_data("happiness_init_value") - self.happiness)
			self.log.debug("%s: Level down to %s", self, self.level)
			self._changed()

			# Notify the world about the level down
			SettlerUpdate.broadcast(self, self.level, -1)
开发者ID:ephillipe,项目名称:unknown-horizons,代码行数:25,代码来源:settler.py

示例2: level_down

	def level_down(self):
		if self.level == TIER.LOWEST:
			# Can't level down any more.
			self.make_ruin()
			self.log.debug("%s: Destroyed by lack of happiness", self)
			if self.owner.is_local_player:
				# check_duplicate: only trigger once for different settlers of a neighborhood
				self.session.ingame_gui.message_widget.add(point=self.position.center,
			                                           string_id='SETTLERS_MOVED_OUT', check_duplicate=True)
		else:
			self.level -= 1
			self._update_level_data()
			# reset happiness value for new level
			new_happiness = self.__get_data("happiness_init_value") - self.happiness
			self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, new_happiness)
			self.log.debug("%s: Level down to %s", self, self.level)
			self._changed()

			# update the level of our inhabitants so graphics can change
			if self.has_component(CollectingComponent):
				for collector in self.get_component(CollectingComponent).get_local_collectors():
					collector.level_upgrade(self.level)

			# Notify the world about the level down
			SettlerUpdate.broadcast(self, self.level, -1)
开发者ID:MarkusHackspacher,项目名称:unknown-horizons,代码行数:25,代码来源:settler.py

示例3: end

	def end(self):
		self.widgets['minimap'].mapEvents({
			'zoomIn' : None,
			'zoomOut' : None,
			'rotateRight' : None,
			'rotateLeft': None,

			'destroy_tool' : None,
			'build' : None,
			'diplomacyButton' : None,
			'gameMenuButton' : None
		})

		for w in self.widgets.itervalues():
			if w.parent is None:
				w.hide()
		self.message_widget = None
		self.tabwidgets = None
		self.minimap = None
		self.resource_overview.end()
		self.resource_overview = None
		self.hide_menu()
		SettlerUpdate.unsubscribe(self._on_settler_level_change)
		ResourceBarResize.unsubscribe(self._on_resourcebar_resize)
		HoverSettlementChanged.unsubscribe(self._cityinfo_set)
		SettlerInhabitantsChanged.unsubscribe(self._on_settler_inhabitant_change)

		super(IngameGui, self).end()
开发者ID:Antagonym,项目名称:unknown-horizons,代码行数:28,代码来源:ingamegui.py

示例4: end

    def end(self):
        self._stats = None
        self.session = None

        if self.regular_player:
            SettlerUpdate.unsubscribe(self.notify_settler_reached_level)
            NewDisaster.unsubscribe(self.notify_new_disaster, sender=self)
开发者ID:ChrisOelmueller,项目名称:unknown-horizons,代码行数:7,代码来源:player.py

示例5: load

	def load(self, db, worldid):
		super(Settler, self).load(db, worldid)
		self.inhabitants, last_tax_payed = \
		    db("SELECT inhabitants, last_tax_payed FROM settler WHERE rowid=?", worldid)[0]
		remaining_ticks = \
		    db("SELECT ticks FROM remaining_ticks_of_month WHERE rowid=?", worldid)[0][0]
		self.__init(loading=True, last_tax_payed=last_tax_payed)
		self._load_upgrade_data(db)
		SettlerUpdate.broadcast(self, self.level, self.level)
		self.run(remaining_ticks)
开发者ID:STEVEOO6,项目名称:unknown-horizons,代码行数:10,代码来源:settler.py

示例6: _do_level_up

		def _do_level_up():
			self.level += 1
			self.log.debug("%s: Levelling up to %s", self, self.level)
			self._update_level_data()

			# Notify the world about the level up
			SettlerUpdate.broadcast(self, self.level, 1)

			# reset happiness value for new level
			self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, self.__get_data("happiness_init_value") - self.happiness)
			self._changed()
开发者ID:ephillipe,项目名称:unknown-horizons,代码行数:11,代码来源:settler.py

示例7: _do_level_up

		def _do_level_up():
			# NOTE: production is unused, but gets passed by the production code
			self.level += 1
			self.log.debug("%s: Levelling up to %s", self, self.level)
			self._update_level_data()

			# Notify the world about the level up
			SettlerUpdate.broadcast(self, self.level)

			# reset happiness value for new level
			self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS_ID, self.__get_data("happiness_init_value") - self.happiness)
			self._changed()
开发者ID:savionok,项目名称:unknown-horizons,代码行数:12,代码来源:settler.py

示例8: _do_level_up

		def _do_level_up():
			self.level += 1
			self.log.debug("%s: Levelling up to %s", self, self.level)
			self._update_level_data()

			# update the level of our inhabitants so graphics can change
			if self.has_component(CollectingComponent):
				for collector in self.get_component(CollectingComponent).get_local_collectors():
					collector.level_upgrade(self.level)

			# Notify the world about the level up
			SettlerUpdate.broadcast(self, self.level, 1)

			# reset happiness value for new level
			new_happiness = self.__get_data("happiness_init_value") - self.happiness
			self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, new_happiness)
			self._changed()
开发者ID:MarkusHackspacher,项目名称:unknown-horizons,代码行数:17,代码来源:settler.py

示例9: __init

    def __init(self, name, color, difficulty_level, settlerlevel=0):
        assert isinstance(color, Color)
        assert (isinstance(name, str) or isinstance(name, unicode)) and len(name) > 0
        try:
            self.name = unicode(name)
        except UnicodeDecodeError:
            # WORKAROUND: this line should be the only unicode conversion here.
            # however, if unicode() gets a parameter, it will fail if the string is already unicode.
            self.name = unicode(name, errors="ignore")
        self.color = color
        self.difficulty = DifficultySettings.get_settings(difficulty_level)
        self.settler_level = settlerlevel
        assert self.color.is_default_color, "Player color has to be a default color"
        SettlerUpdate.subscribe(self.notify_settler_reached_level)

        if self.regular_player:
            Scheduler().add_new_object(Callback(self.update_stats), self, run_in=0)
开发者ID:savionok,项目名称:unknown-horizons,代码行数:17,代码来源:player.py

示例10: __init

	def __init(self, name, color, difficulty_level, settlerlevel = 0):
		assert isinstance(color, Color)
		assert (isinstance(name, str) or isinstance(name, unicode)) and len(name) > 0
		try:
			self.name = unicode(name)
		except UnicodeDecodeError:
			# WORKAROUND: this line should be the only unicode conversion here.
			# however, if unicode() gets a parameter, it will fail if the string is already unicode.
			self.name = unicode(name, errors='ignore')
		self.color = color
		self.difficulty = DifficultySettings.get_settings(difficulty_level)
		self.settler_level = settlerlevel
		self.stats = None
		assert self.color.is_default_color, "Player color has to be a default color"

		SettlerUpdate.subscribe(self.notify_settler_reached_level)
		NewDisaster.subscribe(self, self.notify_new_disaster)
开发者ID:ephillipe,项目名称:unknown-horizons,代码行数:17,代码来源:player.py

示例11: __init

	def __init(self, name, color, clientid, difficulty_level, max_tier_notification, settlerlevel=0):
		assert isinstance(color, Color)
		assert isinstance(name, basestring) and name
		try:
			self.name = unicode(name)
		except UnicodeDecodeError:
			# WORKAROUND: this line should be the only unicode conversion here.
			# however, if unicode() gets a parameter, it will fail if the string is already unicode.
			self.name = unicode(name, errors='ignore')
		self.color = color
		self.clientid = clientid
		self.difficulty = DifficultySettings.get_settings(difficulty_level)
		self.max_tier_notification = max_tier_notification
		self.settler_level = settlerlevel
		self._stats = None
		assert self.color.is_default_color, "Player color has to be a default color"

		if self.regular_player:
			SettlerUpdate.subscribe(self.notify_settler_reached_level)
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:19,代码来源:player.py

示例12: level_down

    def level_down(self):
        if self.level == 0:  # can't level down any more
            self.make_ruin()
            self.log.debug("%s: Destroyed by lack of happiness", self)
            if self.owner.is_local_player:
                # check_duplicate: only trigger once for different settlers of a neighborhood
                self.session.ingame_gui.message_widget.add(
                    point=self.position.center(), string_id="SETTLERS_MOVED_OUT", check_duplicate=True
                )
        else:
            self.level -= 1
            self._update_level_data()
            # reset happiness value for new level
            self.get_component(StorageComponent).inventory.alter(
                RES.HAPPINESS, self.__get_data("happiness_init_value") - self.happiness
            )
            self.log.debug("%s: Level down to %s", self, self.level)
            self._changed()

            # Notify the world about the level down
            SettlerUpdate.broadcast(self, self.level, -1)
开发者ID:stefanbeller,项目名称:unknown-horizons,代码行数:21,代码来源:settler.py

示例13: end

	def end(self):
		self.mainhud.mapEvents({
			'zoomIn' : None,
			'zoomOut' : None,
			'rotateRight' : None,
			'rotateLeft': None,

			'destroy_tool' : None,
			'build' : None,
			'diplomacyButton' : None,
			'gameMenuButton' : None
		})

		self.message_widget = None
		self.minimap = None
		self.resource_overview.end()
		self.resource_overview = None
		self.keylistener = None
		self.cityinfo.end()
		self.cityinfo = None
		self.hide_menu()
		SettlerUpdate.unsubscribe(self._on_settler_level_change)
		SpeedChanged.unsubscribe(self._on_speed_changed)
		self.session.view.remove_change_listener(self._update_zoom)

		if self.cursor:
			self.cursor.remove()
			self.cursor.end()
			self.cursor = None

		LastActivePlayerSettlementManager().remove()
		LastActivePlayerSettlementManager.destroy_instance()

		self.production_finished_icon_manager.end()
		self.production_finished_icon_manager = None
		self.status_icon_manager.end()
		self.status_icon_manager = None

		super(IngameGui, self).end()
开发者ID:ChrisOelmueller,项目名称:unknown-horizons,代码行数:39,代码来源:ingamegui.py

示例14: hide

	def hide(self):
		SettlerUpdate.unsubscribe(self.on_settler_level_change, sender=self.instance)
		super(SettlerOverviewTab, self).hide()
开发者ID:Antagonym,项目名称:unknown-horizons,代码行数:3,代码来源:residentialtabs.py

示例15: show

	def show(self):
		super(SettlerOverviewTab, self).show()
		SettlerUpdate.subscribe(self.on_settler_level_change, sender=self.instance)
开发者ID:Antagonym,项目名称:unknown-horizons,代码行数:3,代码来源:residentialtabs.py


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