From bccf6777ad9c0979a3104145749718180aba1d69 Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Sun, 20 Oct 2024 16:47:23 +0200 Subject: [PATCH] Add reload speech command --- .../MixedRealitySpeechCommandsProfile.asset | 7 +++++++ Assets/Scripts/EndpointLoader.cs | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset index 5864837..7285a04 100644 --- a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset +++ b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset @@ -23,3 +23,10 @@ MonoBehaviour: id: 0 description: None axisConstraint: 0 + - localizationKey: + keyword: Reload + keyCode: 0 + action: + id: 0 + description: None + axisConstraint: 0 diff --git a/Assets/Scripts/EndpointLoader.cs b/Assets/Scripts/EndpointLoader.cs index b52b0c0..24deebd 100644 --- a/Assets/Scripts/EndpointLoader.cs +++ b/Assets/Scripts/EndpointLoader.cs @@ -4,14 +4,12 @@ using UnityEngine.Networking; using System; using System.Collections; using System.Collections.Generic; -// using TMPro; using Microsoft.MixedReality.WebView; public class EndpointLoader : MonoBehaviour { public WebView webView1; public WebView webView2; - // public Button ReloadButton; private const string apiUrl = "http://windows.local:5000/api/endpoints"; private const string defaultEndpoint1 = "http://windows.local:8100/mystream/"; @@ -19,7 +17,6 @@ public class EndpointLoader : MonoBehaviour private void Start() { - // ReloadButton.onClick.AddListener(() => StartCoroutine(LoadEndpoints())); StartCoroutine(LoadEndpoints()); } @@ -48,7 +45,6 @@ public class EndpointLoader : MonoBehaviour { Debug.LogError("Parsed endpoints are empty. Using default endpoints"); UseDefaultEndpoints(); - // yield return null; } else { @@ -57,6 +53,11 @@ public class EndpointLoader : MonoBehaviour } } + public void ReloadEndpoints() + { + StartCoroutine(LoadEndpoints()); + } + private void UseDefaultEndpoints() { webView1.Load(defaultEndpoint1);