本文整理汇总了Python中distributor.system.Distributor类的典型用法代码示例。如果您正苦于以下问题:Python Distributor类的具体用法?Python Distributor怎么用?Python Distributor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Distributor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_buff_update_msg
def send_buff_update_msg(self, buff, equipped, change_rate=None, immediate=False):
if not buff.visible:
return
if self.owner.valid_for_distribution and self.owner.is_sim and self.owner.is_selectable:
buff_msg = self._create_buff_update_msg(buff, equipped, change_rate=change_rate)
if gsi_handlers.buff_handlers.sim_buff_log_archiver.enabled:
gsi_handlers.buff_handlers.archive_buff_message(buff_msg, equipped, change_rate)
Distributor.instance().add_op(self.owner, GenericProtocolBufferOp(Operation.SIM_BUFF_UPDATE, buff_msg))
示例2: _setter
def _setter(inst, value):
message = self._get_message(inst)
ret = setter(inst, message, value, True)
if inst.valid_for_distribution:
op_message = SparseMessage(self._message_type())
setter(inst, op_message, value, False)
op = self.get_op(inst, value=op_message._value)
if op is not None:
Distributor.instance().add_op(inst, op)
return ret
示例3: get_household_display_info
def get_household_display_info(lot_id, _connection=None):
persistence_service = services.get_persistence_service()
household_display_info = UI_pb2.HouseholdDisplayInfo()
household_id = persistence_service.get_household_id_from_lot_id(lot_id)
if household_id is None:
household_id = 0
household = services.household_manager().get(household_id)
if household is None:
household_id = 0
else:
household_display_info.at_home_sim_ids.extend(household.get_sims_at_home())
household_display_info.household_id = household_id
household_display_info.lot_id = lot_id
op = shared_messages.create_message_op(household_display_info, Consts_pb2.MSG_UI_HOUSEHOLD_DISPLAY_INFO)
Distributor.instance().add_op_with_no_owner(op)
示例4: _send_destroy_message_to_client
def _send_destroy_message_to_client(self):
msg = commodity_protocol.RelationshipDelete()
msg.actor_sim_id = self._sim_id
msg.target_id = self._target_sim_id
op = GenericProtocolBufferOp(DistributorOps_pb2.Operation.SIM_RELATIONSHIP_DELETE, msg)
distributor = Distributor.instance()
distributor.add_op(self.find_sim_info(), op)
示例5: _open_ui_panel_for_object
def _open_ui_panel_for_object(self, owner):
msg = UI_pb2.OpenInventory()
msg.object_id = owner.id
msg.inventory_id = self._get_inventory_id()
msg.inventory_type = self._get_inventory_ui_type()
distributor = Distributor.instance()
distributor.add_op_with_no_owner(GenericProtocolBufferOp(Operation.OPEN_INVENTORY, msg))
示例6: send_reject_response
def send_reject_response(client, sim, context_handle, cancel_reason):
reject_msg = protocols.ServerResponseFailed()
reject_msg.handle = context_handle
reject_msg.reason = cancel_reason
distributor = Distributor.instance()
distributor.add_op_with_no_owner(GenericProtocolBufferOp(Operation.SIM_SERVER_RESPONSE_FAILED, reject_msg))
logger.debug(' sending reject msg')
示例7: lock_save
def lock_save(self, lock_holder):
self._save_locks.append(lock_holder)
msg = UI_pb2.GameSaveLockUnlock()
msg.is_locked = True
msg.lock_reason = lock_holder.get_lock_save_reason()
distributor = Distributor.instance()
distributor.add_event(MSG_GAME_SAVE_LOCK_UNLOCK, msg)
示例8: unlock_save
def unlock_save(self, lock_holder, send_event=True):
if lock_holder in self._save_locks:
self._save_locks.remove(lock_holder)
if send_event:
if not self.is_save_locked():
msg = UI_pb2.GameSaveLockUnlock()
msg.is_locked = False
distributor = Distributor.instance()
distributor.add_event(MSG_GAME_SAVE_LOCK_UNLOCK, msg)
else:
new_lock_holder = self._save_locks[-1]
msg = UI_pb2.GameSaveLockUnlock()
msg.is_locked = True
msg.lock_reason = new_lock_holder.get_lock_save_reason()
distributor = Distributor.instance()
distributor.add_event(MSG_GAME_SAVE_LOCK_UNLOCK, msg)
示例9: distribute
def distribute(self):
sim = self._sim
if sim is not None and not sim.is_hidden():
balloon_op = AddBalloon(self, sim)
distributor = Distributor.instance()
distributor.add_op(sim, balloon_op)
return True
return False
示例10: distribute_dialog
def distribute_dialog(self, dialog_type, dialog_msg):
distributor = Distributor.instance()
notification_op = GenericProtocolBufferOp(Operation.UI_NOTIFICATION_SHOW, dialog_msg)
owner = self.owner
if owner is not None:
distributor.add_op(owner, notification_op)
else:
distributor.add_op_with_no_owner(notification_op)
示例11: refresh_goals
def refresh_goals(self, completed_goal=None, debug_goal=None, debug_target=None, request_single_goal=False, request_single_delay=0, emotion_only=False):
if completed_goal is not None:
logger.debug('Whim completed for {}: {}', self._sim_info, completed_goal, owner='jjacobson')
op = distributor.ops.SetWhimComplete(completed_goal.guid64)
Distributor.instance().add_op(self._sim_info, op)
if completed_goal.score > 0:
self._sim_info.add_whim_bucks(completed_goal.score, SetWhimBucks.WHIM)
self._remove_goal_from_current_order(completed_goal)
completed_goal.unregister_for_on_goal_completed_callback(self._on_goal_completed)
del self._realized_goals[completed_goal]
completed_goal.decommision()
if request_single_delay == 0 or debug_goal is not None:
self.offer_goals(debug_goal=debug_goal, debug_target=debug_target, request_single_goal=request_single_goal, emotion_only=emotion_only)
else:
delay_alarm = alarms.add_alarm(self, create_time_span(minutes=request_single_delay), self._delayed_offer_goals, False)
self.delay_alarm_handles.append(delay_alarm)
self._send_goals_update()
示例12: publish_shared_inventory_items
def publish_shared_inventory_items(self):
distributor = Distributor.instance()
for (inventory_type, inventory_object) in self.inv_objs.items():
if inventory_type == InventoryType.HIDDEN:
pass
for (obj, message_op) in inventory_object.get_item_update_ops_gen():
distributor.add_op(obj, message_op)
inventory_object.update_inventory_count()
示例13: distribute_dialog
def distribute_dialog(self, _, dialog_msg):
distributor_inst = Distributor.instance()
op = distributor.shared_messages.create_message_op(dialog_msg, Consts_pb2.MSG_SHOW_MAP_VIEW)
owner = self.owner
if owner is not None:
distributor_inst.add_op(owner, op)
else:
distributor_inst.add_op_with_no_owner(op)
示例14: _removed_ui_update
def _removed_ui_update(self, obj):
msg = UI_pb2.InventoryItemUpdate()
msg.type = UI_pb2.InventoryItemUpdate.TYPE_REMOVE
msg.inventory_id = self._get_inventory_id()
msg.inventory_type = self._get_inventory_ui_type()
msg.object_id = obj.id
msg.stack_id = obj.inventoryitem_component.get_stack_id()
distributor = Distributor.instance()
distributor.add_op(obj, GenericProtocolBufferOp(Operation.INVENTORY_ITEM_UPDATE, msg))
示例15: _send_objectives_update_to_client
def _send_objectives_update_to_client(self):
owner = self.owner_sim_info
if owner is None or owner.is_npc or owner.manager is None:
return
msg = Sims_pb2.GoalsStatusUpdate()
if self._update_objectives_msg_for_client(msg):
msg.sim_id = owner.id
distributor = Distributor.instance()
distributor.add_op(owner, GenericProtocolBufferOp(Operation.SIM_GOALS_STATUS_UPDATE, msg))