當前位置: 首頁>>代碼示例>>Python>>正文


Python NewDisaster.broadcast方法代碼示例

本文整理匯總了Python中horizons.messaging.NewDisaster.broadcast方法的典型用法代碼示例。如果您正苦於以下問題:Python NewDisaster.broadcast方法的具體用法?Python NewDisaster.broadcast怎麽用?Python NewDisaster.broadcast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在horizons.messaging.NewDisaster的用法示例。


在下文中一共展示了NewDisaster.broadcast方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: infect

# 需要導入模塊: from horizons.messaging import NewDisaster [as 別名]
# 或者: from horizons.messaging.NewDisaster import broadcast [as 別名]
	def infect(self, building, load=None):
		"""@load: (db, disaster_worldid), set on restoring infected state of savegame"""
		super(BuildingInfluencingDisaster, self).infect(building, load=load)
		self._affected_buildings.append(building)
		havoc_time = self.TIME_BEFORE_HAVOC
		# keep in sync with load()
		if load:
			db, worldid = load
			havoc_time = db("SELECT remaining_ticks_havoc FROM building_influencing_disaster WHERE disaster = ? AND building = ?", worldid, building.worldid)[0][0]
		Scheduler().add_new_object(Callback(self.wreak_havoc, building), self, run_in=havoc_time)
		AddStatusIcon.broadcast(building, self.STATUS_ICON(building))
		NewDisaster.broadcast(building.owner, building, self.__class__, self)
開發者ID:BenjaminHarper,項目名稱:unknown-horizons,代碼行數:14,代碼來源:buildinginfluencingdisaster.py

示例2: infect

# 需要導入模塊: from horizons.messaging import NewDisaster [as 別名]
# 或者: from horizons.messaging.NewDisaster import broadcast [as 別名]
	def infect(self, building, load=None):
		"""Infect a building with fire.
		@load: (db, disaster_worldid), set on restoring infected state of savegame"""
		super(FireDisaster, self).infect(building, load=load)
		# keep in sync with load()
		AddStatusIcon.broadcast(building, FireStatusIcon(building))
		NewDisaster.broadcast(building.owner, building, FireDisaster)
		self._affected_buildings.append(building)
		havoc_time = self.TIME_BEFORE_HAVOC
		if load:
			db, worldid = load
			havoc_time = db("SELECT remaining_ticks_havoc FROM fire_disaster WHERE disaster = ? AND building = ?", worldid, building.worldid)[0][0]

		Scheduler().add_new_object(Callback(self.wreak_havoc, building), self, run_in=havoc_time)
開發者ID:ChrisOelmueller,項目名稱:unknown-horizons,代碼行數:16,代碼來源:firedisaster.py


注:本文中的horizons.messaging.NewDisaster.broadcast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。