本文整理汇总了Python中horizons.messaging.WorldObjectDeleted.subscribe方法的典型用法代码示例。如果您正苦于以下问题:Python WorldObjectDeleted.subscribe方法的具体用法?Python WorldObjectDeleted.subscribe怎么用?Python WorldObjectDeleted.subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.messaging.WorldObjectDeleted
的用法示例。
在下文中一共展示了WorldObjectDeleted.subscribe方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from horizons.messaging import WorldObjectDeleted [as 别名]
# 或者: from horizons.messaging.WorldObjectDeleted import subscribe [as 别名]
def __init__(self, session, building, ship=None, build_related=None):
super(BuildingTool, self).__init__(session)
assert not (ship and build_related)
self.renderer = self.session.view.renderer['InstanceRenderer']
self.ship = ship
self._class = building
self.__init_selectable_component()
self.buildings = [] # list of PossibleBuild objs
self.buildings_action_set_ids = [] # list action set ids of list above
self.buildings_fife_instances = {} # fife instances of possible builds
self.buildings_missing_resources = {} # missing resources for possible builds
self.rotation = 45 + random.randint(0, 3)*90
self.start_point, self.end_point = None, None
self.last_change_listener = None
self._transparencified_instances = set() # fife instances modified for transparency
self._buildable_tiles = set() # tiles marked as buildable
self._related_buildings = set() # buildings highlighted as related
self._highlighted_buildings = set() # related buildings highlighted when preview is near it
self._build_logic = None
self._related_buildings_selected_tiles = frozenset() # highlights w.r.t. related buildings
if self.ship is not None:
self._build_logic = ShipBuildingToolLogic(ship)
elif build_related is not None:
self._build_logic = BuildRelatedBuildingToolLogic(self, weakref.ref(build_related) )
else:
self._build_logic = SettlementBuildingToolLogic(self)
self.load_gui()
self.__class__.gui.show()
self.session.ingame_gui.minimap_to_front()
self.session.gui.on_escape = self.on_escape
self.highlight_buildable()
WorldObjectDeleted.subscribe(self._on_worldobject_deleted)
示例2: __init__
# 需要导入模块: from horizons.messaging import WorldObjectDeleted [as 别名]
# 或者: from horizons.messaging.WorldObjectDeleted import subscribe [as 别名]
def __init__(self, session):
self.session = session
# {instance: [list of icons]}
self.icons = {}
# Renderer used to render the icons
self.renderer = self.session.view.renderer['GenericRenderer']
AddStatusIcon.subscribe(self.on_add_icon_message)
RemoveStatusIcon.subscribe(self.on_remove_icon_message)
WorldObjectDeleted.subscribe(self.on_worldobject_deleted_message)
示例3: __init__
# 需要导入模块: from horizons.messaging import WorldObjectDeleted [as 别名]
# 或者: from horizons.messaging.WorldObjectDeleted import subscribe [as 别名]
def __init__(self, session):
super(TearingTool, self).__init__(session)
self.coords = None
self.selected = WeakList()
self.oldedges = None
self.tear_tool_active = True
self.session.ingame_gui.hide_menu()
self.session.selected_instances.clear()
horizons.globals.fife.set_cursor_image("tearing")
self._hovering_over = WeakList()
WorldObjectDeleted.subscribe(self._on_object_deleted)
示例4: __init__
# 需要导入模块: from horizons.messaging import WorldObjectDeleted [as 别名]
# 或者: from horizons.messaging.WorldObjectDeleted import subscribe [as 别名]
def __init__(self, session):
self.session = session
# {instance: [list of icons]}
self.icons = {}
# Renderer used to render the icons
self.renderer = self.session.view.renderer['GenericRenderer']
self.tooltip_instance = None # no weakref:
# we need to remove the tooltip always anyway, and along with it the entry here
self.tooltip_icon = Icon(position=(1,1)) # 0, 0 is currently not supported by tooltips
AddStatusIcon.subscribe(self.on_add_icon_message)
HoverInstancesChanged.subscribe(self.on_hover_instances_changed)
RemoveStatusIcon.subscribe(self.on_remove_icon_message)
WorldObjectDeleted.subscribe(self.on_worldobject_deleted_message)
示例5: __init__
# 需要导入模块: from horizons.messaging import WorldObjectDeleted [as 别名]
# 或者: from horizons.messaging.WorldObjectDeleted import subscribe [as 别名]
def __init__(self, renderer, layer):
"""
@param renderer: Renderer used to render the icons
@param layer: map layer, needed to place icon
"""
self.layer = layer
self.renderer = renderer
# {instance: [list of icons]}
self.icons = {}
self.tooltip_instance = None # no weakref:
# we need to remove the tooltip always anyway, and along with it the entry here
self.tooltip_icon = Icon(position=(1, 1)) # 0, 0 is currently not supported by tooltips
AddStatusIcon.subscribe(self.on_add_icon_message)
HoverInstancesChanged.subscribe(self.on_hover_instances_changed)
RemoveStatusIcon.subscribe(self.on_remove_icon_message)
WorldObjectDeleted.subscribe(self.on_worldobject_deleted_message)
示例6: remove
# 需要导入模块: from horizons.messaging import WorldObjectDeleted [as 别名]
# 或者: from horizons.messaging.WorldObjectDeleted import subscribe [as 别名]
def remove(self):
self._mark()
self.tear_tool_active = False
horizons.main.fife.set_cursor_image("default")
WorldObjectDeleted.subscribe(self._on_object_deleted)
super(TearingTool, self).remove()