Example #1
0
 def show_dialog(self, on_response=None, **kwargs):
     if self.audio_sting is not None:
         play_tunable_audio(self.audio_sting, None)
     if on_response is not None:
         self.add_listener(on_response)
     pythonutils.try_highwater_gc()
     services.ui_dialog_service().dialog_show(self, self.phone_ring_type, **kwargs)
Example #2
0
 def do_auto_respond(self):
     if ButtonType.DIALOG_RESPONSE_CANCEL in self.responses:
         response = ButtonType.DIALOG_RESPONSE_CANCEL
     elif ButtonType.DIALOG_RESPONSE_OK in self.responses:
         response = ButtonType.DIALOG_RESPONSE_OK
     else:
         response = ButtonType.DIALOG_RESPONSE_CLOSED
     services.ui_dialog_service().dialog_respond(self.dialog_id, response)
Example #3
0
 def show_dialog(self, on_response=None, **kwargs):
     if self.audio_sting is not None:
         play_tunable_audio(self.audio_sting, None)
     if on_response is not None:
         self.add_listener(on_response)
     pythonutils.try_highwater_gc()
     services.ui_dialog_service().dialog_show(self, self.phone_ring_type,
                                              **kwargs)
Example #4
0
 def do_auto_respond(self):
     if ButtonType.DIALOG_RESPONSE_CANCEL in self.responses:
         response = ButtonType.DIALOG_RESPONSE_CANCEL
     elif ButtonType.DIALOG_RESPONSE_OK in self.responses:
         response = ButtonType.DIALOG_RESPONSE_OK
     else:
         response = ButtonType.DIALOG_RESPONSE_CLOSED
     services.ui_dialog_service().dialog_respond(self.dialog_id, response)
 def do_auto_respond(self):
     if ButtonType.DIALOG_RESPONSE_CANCEL in self.responses:
         response = ButtonType.DIALOG_RESPONSE_CANCEL
     elif ButtonType.DIALOG_RESPONSE_OK in self.responses:
         for (text_input_name, text_input_tuning) in self.text_inputs.items():
             text = '*'*text_input_tuning.min_length.length
             self.on_text_input(text_input_name, text)
         response = ButtonType.DIALOG_RESPONSE_OK
     else:
         response = ButtonType.DIALOG_RESPONSE_CLOSED
     services.ui_dialog_service().dialog_respond(self.dialog_id, response)
 def do_auto_respond(self):
     if ButtonType.DIALOG_RESPONSE_CANCEL in self.responses:
         response = ButtonType.DIALOG_RESPONSE_CANCEL
     elif ButtonType.DIALOG_RESPONSE_OK in self.responses:
         for (text_input_name,
              text_input_tuning) in self.text_inputs.items():
             text = '*' * text_input_tuning.min_length.length
             self.on_text_input(text_input_name, text)
         response = ButtonType.DIALOG_RESPONSE_OK
     else:
         response = ButtonType.DIALOG_RESPONSE_CLOSED
     services.ui_dialog_service().dialog_respond(self.dialog_id, response)
 def do_auto_respond(self, auto_response=DEFAULT):
     dialog_response_ids = set(r.dialog_response_id for r in self.responses)
     if auto_response is not DEFAULT:
         response = auto_response
     elif ButtonType.DIALOG_RESPONSE_CANCEL in dialog_response_ids:
         response = ButtonType.DIALOG_RESPONSE_CANCEL
     elif ButtonType.DIALOG_RESPONSE_OK in dialog_response_ids:
         for (text_input_name,
              text_input_tuning) in self.text_inputs.items():
             if text_input_tuning.min_length != 0:
                 text = '*' * text_input_tuning.min_length.length
             else:
                 text = '*'
             self.on_text_input(text_input_name, text)
         response = ButtonType.DIALOG_RESPONSE_OK
     else:
         response = ButtonType.DIALOG_RESPONSE_CLOSED
     services.ui_dialog_service().dialog_respond(self.dialog_id, response)
Example #8
0
def ui_dialog_multi_picker_result(dialog_id: int,
                                  multi_picker_proto: str,
                                  _connection=None):
    response_proto = Dialog_pb2.MultiPickerResponse()
    text_format.Merge(multi_picker_proto, response_proto)
    ui_dialog_service = services.ui_dialog_service()
    if ui_dialog_service is not None:
        dialog = ui_dialog_service.get_dialog(dialog_id)
        if dialog is not None:
            dialog.multi_picker_result(response_proto)
def set_color_and_intensity(response_id: int,
                            r: int = None,
                            g: int = None,
                            b: int = None,
                            intensity: float = 1.0,
                            _connection=None):
    ui_dialog_service = services.ui_dialog_service()
    if ui_dialog_service is not None:
        dialog = ui_dialog_service.get_dialog(response_id)
        if dialog is not None:
            color = sims4.color.from_rgba_as_int(r, g, b)
            dialog.update_dialog_data(color=color, intensity=intensity)
    return True
Example #10
0
 def on_enter(self):
     super().on_enter()
     services.household_manager().load_households()
     zone = services.current_zone()
     zone_spin_up_service = zone.zone_spin_up_service
     household_id = zone_spin_up_service._client_connect_data.household_id
     household = zone.household_manager.get(household_id)
     client = zone_spin_up_service._client_connect_data.client
     services.account_service().on_load_options(client)
     for sim_info in household.sim_info_gen():
         client.add_selectable_sim_info(sim_info,
                                        send_relationship_update=False)
     zone.on_households_and_sim_infos_loaded()
     zone.service_manager.on_all_households_and_sim_infos_loaded(client)
     services.ui_dialog_service().send_dialog_options_to_client()
     client.clean_and_send_remaining_relationship_info()
     services.current_zone().lot.send_lot_display_info()
     for obj in itertools.chain(services.object_manager().values(),
                                services.inventory_manager().values()):
         while obj.live_drag_component is not None:
             obj.live_drag_component.set_active_household_live_drag_permission(
             )
     return _ZoneSpinUpStateResult.DONE
 def on_enter(self):
     super().on_enter()
     services.household_manager().load_households()
     zone = services.current_zone()
     zone_spin_up_service = zone.zone_spin_up_service
     household_id = zone_spin_up_service._client_connect_data.household_id
     household = zone.household_manager.get(household_id)
     client = zone_spin_up_service._client_connect_data.client
     services.account_service().on_load_options(client)
     for sim_info in household.sim_info_gen():
         client.add_selectable_sim_info(sim_info,
                                        send_relationship_update=False)
     zone.on_households_and_sim_infos_loaded()
     zone.service_manager.on_all_households_and_sim_infos_loaded(client)
     services.ui_dialog_service().send_dialog_options_to_client()
     client.clean_and_send_remaining_relationship_info()
     services.current_zone().lot.send_lot_display_info()
     for obj in itertools.chain(services.object_manager().values(),
                                services.inventory_manager().values()):
         while obj.live_drag_component is not None:
             obj.live_drag_component.set_active_household_live_drag_permission(
             )
     return _ZoneSpinUpStateResult.DONE
Example #12
0
 def on_enter(self):
     super().on_enter()
     services.household_manager().load_households()
     zone = services.current_zone()
     zone_spin_up_service = zone.zone_spin_up_service
     household_id = zone_spin_up_service._client_connect_data.household_id
     household = services.household_manager().get(household_id)
     client = zone_spin_up_service._client_connect_data.client
     account_service = services.account_service()
     account_service.on_load_options(client)
     zone.service_manager.on_zone_load()
     game_services.service_manager.on_zone_load()
     sims4.core_services.service_manager.on_zone_load()
     for sim_info in household.sim_info_gen():
         client.add_selectable_sim_info(sim_info,
                                        send_relationship_update=False)
     zone.on_households_and_sim_infos_loaded()
     zone.service_manager.on_all_households_and_sim_infos_loaded(client)
     game_services.service_manager.on_all_households_and_sim_infos_loaded(
         client)
     sims4.core_services.service_manager.on_all_households_and_sim_infos_loaded(
         client)
     organization_service = services.organization_service()
     if organization_service is not None:
         organization_service.post_game_services_zone_load()
     roommate_service = services.get_roommate_service()
     if roommate_service is not None:
         roommate_service.initialize_roommates()
     services.ui_dialog_service().send_dialog_options_to_client()
     client.clean_and_send_remaining_relationship_info()
     services.current_zone().lot.send_lot_display_info()
     for obj in itertools.chain(services.object_manager().values(),
                                services.inventory_manager().values()):
         if obj.live_drag_component is not None:
             obj.live_drag_component.resolve_live_drag_household_permission(
             )
     return _ZoneSpinUpStateResult.DONE
Example #13
0
def display_choices(choices,
                    choice_callback,
                    text: ParametrizedLocalizedString = None,
                    title: ParametrizedLocalizedString = None,
                    cancel: ParametrizedLocalizedString = None):
    try:
        client = services.client_manager().get_first_client()

        # Instantiates the dialog with the supplied title and text
        dlg = UiDialogChoices.TunableFactory().default(
            client.active_sim,
            text=text.localized_string,
            title=title.localized_string)

        # Creates a localized string for each choice contained within the dialog
        labels = [
            lambda choice=choice: _create_localized_string(choice)
            for choice in choices
        ]
        for idx, choice in enumerate(choices):
            dlg._choice_responses.append(
                UiDialogResponse(
                    dialog_response_id=idx,
                    text=labels[idx],
                    ui_request=UiDialogResponse.UiDialogUiRequest.NO_REQUEST))

        # Standard EA cancel choice
        dlg._choice_responses.append(
            UiDialogResponse(
                dialog_response_id=ButtonType.DIALOG_RESPONSE_CANCEL,
                text=cancel.localized_string,
                ui_request=UiDialogResponse.UiDialogUiRequest.NO_REQUEST))
    except Exception as e:
        raise e

    # Handles the callback response of the dialog
    def choice_response_callback(dialog):
        try:
            choice_callback(dialog.response)
        except Exception as e:
            raise e

    # Sets the dialog as the active one and displays it
    dlg.add_listener(choice_response_callback)
    dlg_service = services.ui_dialog_service()
    dlg_service._active_dialogs[dlg.dialog_id] = dlg
    dlg.show_dialog()
Example #14
0
 def _hard_stop(self):
     super()._hard_stop()
     if self._dialog is not None:
         services.ui_dialog_service().dialog_cancel(self._dialog.dialog_id)
         self._dialog = None
 def _hard_stop(self):
     super()._hard_stop()
     if self._dialog is not None:
         services.ui_dialog_service().dialog_cancel(self._dialog.dialog_id)
         self._dialog = None
Example #16
0
	def show_dialog (self, on_response = None, **kwargs):
		if on_response is not None:
			self.add_listener(on_response)
		pythonutils.try_highwater_gc()
		services.ui_dialog_service().dialog_show(self, self.get_phone_ring_type(), **kwargs)