本文整理匯總了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)
示例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)