Ejemplo n.º 1
0
 def perform(self, subject, target, resolver):
     if subject is None:
         logger.error(
             'Trying to perform UniversityDynamicSignView op but subject is None. Resolver {}.',
             resolver)
         return
     if not subject.is_sim:
         logger.error(
             'Trying to perform UniversityDynamicSignView op but subject {} is not Sim. Resolver {}.',
             subject, resolver)
         return
     sign_info = UI_pb2.DynamicSignView()
     sign_info.name = self.title
     sign_info.image = sims4.resources.get_protobuff_for_key(
         self.display_image)
     sign_info.background_image = sims4.resources.get_protobuff_for_key(
         self.background_image)
     for sub_info in self.sub_infos:
         with ProtocolBufferRollback(
                 sign_info.activities) as activity_msg:
             activity_msg.name = sub_info.name
             activity_msg.description = sub_info.desc.get_string(
                 subject.sim_info)
             activity_msg.icon = create_icon_info_msg(
                 IconInfoData(sub_info.icon))
     distributor = Distributor.instance()
     distributor.add_op(
         subject.sim_info,
         GenericProtocolBufferOp(Operation.DYNAMIC_SIGN_VIEW,
                                 sign_info))
Ejemplo n.º 2
0
 def display_scholarship_info(self, subject):
     if self.SCHOLARSHIP_INFORMATION_SIGN.display_image is None or self.SCHOLARSHIP_INFORMATION_SIGN.background_image is None:
         logger.error(
             'Attempting to show scholarship sign to ({}) when content is None.',
             subject)
         return
     sign_info = UI_pb2.DynamicSignView()
     sign_info.name = self.SCHOLARSHIP_INFORMATION_SIGN.title
     sign_info.image = sims4.resources.get_protobuff_for_key(
         self.SCHOLARSHIP_INFORMATION_SIGN.display_image)
     sign_info.background_image = sims4.resources.get_protobuff_for_key(
         self.SCHOLARSHIP_INFORMATION_SIGN.background_image)
     for sub_info in self.SCHOLARSHIP_INFORMATION_SIGN.sub_infos:
         with ProtocolBufferRollback(sign_info.activities) as activity_msg:
             if sub_info.icon is None:
                 logger.error(
                     'Attempting to show scholarship sign to ({}) when sub_info icon is None.',
                     subject)
                 continue
             activity_msg.name = sub_info.name
             activity_msg.description = sub_info.desc
             activity_msg.icon = create_icon_info_msg(
                 IconInfoData(sub_info.icon))
     distributor = Distributor.instance()
     distributor.add_op(
         subject.sim_info,
         GenericProtocolBufferOp(Operation.DYNAMIC_SIGN_VIEW, sign_info))
     services.get_event_manager().process_event(
         TestEvent.ScholarshipInfoSignShown, sim_info=subject)
Ejemplo n.º 3
0
 def show_festival_info(cls):
     if cls.festival_dynamic_sign_info is None:
         return
     ui_info = cls.festival_dynamic_sign_info
     festival_info = UI_pb2.DynamicSignView()
     festival_info.drama_node_guid = cls.guid64
     festival_info.name = ui_info.festival_name
     lot_id = cls.get_travel_lot_id()
     persistence_service = services.get_persistence_service()
     zone_id = persistence_service.resolve_lot_id_into_zone_id(lot_id, ignore_neighborhood_id=True)
     zone_protobuff = persistence_service.get_zone_proto_buff(zone_id)
     if zone_protobuff is not None:
         festival_info.venue = LocalizationHelperTuning.get_raw_text(zone_protobuff.name)
     festival_info.time = ui_info.festival_time
     festival_info.image = sims4.resources.get_protobuff_for_key(ui_info.display_image)
     festival_info.background_image = sims4.resources.get_protobuff_for_key(ui_info.background_image)
     festival_info.action_label = ui_info.travel_to_festival_text
     running_nodes = services.drama_scheduler_service().get_running_nodes_by_class(cls)
     active_sim_info = services.active_sim_info()
     if all(active_node.is_during_pre_festival() for active_node in running_nodes):
         festival_info.disabled_tooltip = ui_info.festival_not_started_tooltip
     elif any(active_node.is_on_festival_street() for active_node in running_nodes):
         festival_info.disabled_tooltip = ui_info.on_street_tooltip
     elif active_sim_info.is_in_travel_group():
         festival_info.disabled_tooltip = ui_info.on_vacation_tooltip
     for activity in ui_info.activity_info:
         with ProtocolBufferRollback(festival_info.activities) as activity_msg:
             activity_msg.name = activity.activity_name
             activity_msg.description = activity.activity_description
             activity_msg.icon = create_icon_info_msg(IconInfoData(activity.icon))
     distributor = Distributor.instance()
     distributor.add_op(active_sim_info, GenericProtocolBufferOp(Operation.DYNAMIC_SIGN_VIEW, festival_info))