From a1f5323758553c0ad63f5499c1e6751e76f77e9d Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Sun, 3 Nov 2024 16:17:35 +0100 Subject: [PATCH] Add service speech command --- .../MixedRealitySpeechCommandsProfile.asset | 2 +- Assets/Scripts/ServicesListPopulator.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset index 9890300..2ffd1cb 100644 --- a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset +++ b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset @@ -38,7 +38,7 @@ MonoBehaviour: description: None axisConstraint: 0 - localizationKey: - keyword: Hello + keyword: Service keyCode: 0 action: id: 0 diff --git a/Assets/Scripts/ServicesListPopulator.cs b/Assets/Scripts/ServicesListPopulator.cs index ac105e9..1b9d52b 100644 --- a/Assets/Scripts/ServicesListPopulator.cs +++ b/Assets/Scripts/ServicesListPopulator.cs @@ -16,6 +16,8 @@ public class ServicesListPopulator : MonoBehaviour [SerializeField] private GridObjectCollection gridObjectCollection; + private bool isVisible = true; + public void AddItemFromService(MdnsService service, Action action) { GameObject itemInstance = Instantiate(dynamicItem, gridObjectCollection.transform); @@ -29,8 +31,20 @@ public class ServicesListPopulator : MonoBehaviour { Debug.Log($"Clicked on service: {service.Host}"); action.Invoke(); + ToggleVisibility(); }); gridObjectCollection.UpdateCollection(); + scrollView.UpdateContent(); + } + + public void ToggleVisibility() + { + isVisible = !isVisible; + + foreach (Renderer renderer in GetComponentsInChildren()) + { + renderer.enabled = isVisible; + } } } \ No newline at end of file