From 04d5c84eb1015e2d9f34d6043b21bd89e217d640 Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Sun, 20 Oct 2024 18:11:17 +0200 Subject: [PATCH] Add navigation speech command --- .../MixedRealitySpeechCommandsProfile.asset | 7 ++ Assets/Scenes/WebView.unity | 73 ++++++++++++++++++- Assets/Scripts/ConfigureNavBar.cs | 25 +++++++ Assets/Scripts/ConfigureNavBar.cs.meta | 11 +++ ProjectSettings/ProjectSettings.asset | 4 +- 5 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 Assets/Scripts/ConfigureNavBar.cs create mode 100644 Assets/Scripts/ConfigureNavBar.cs.meta diff --git a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset index 7285a04..ef2fab4 100644 --- a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset +++ b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset @@ -30,3 +30,10 @@ MonoBehaviour: id: 0 description: None axisConstraint: 0 + - localizationKey: + keyword: Navigation + keyCode: 0 + action: + id: 0 + description: None + axisConstraint: 0 diff --git a/Assets/Scenes/WebView.unity b/Assets/Scenes/WebView.unity index 593fcd1..47ffea8 100644 --- a/Assets/Scenes/WebView.unity +++ b/Assets/Scenes/WebView.unity @@ -194,7 +194,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &102826382 MonoBehaviour: m_ObjectHideFlags: 0 @@ -535,6 +535,7 @@ Transform: - {fileID: 704152376} - {fileID: 491721037} - {fileID: 2018722011} + - {fileID: 1017185579} m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1131,7 +1132,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &923220796 RectTransform: m_ObjectHideFlags: 0 @@ -1399,6 +1400,54 @@ MonoBehaviour: m_TrackingType: 0 m_UpdateType: 0 m_UseRelativeTransform: 0 +--- !u!1 &1017185578 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1017185579} + - component: {fileID: 1017185580} + m_Layer: 0 + m_Name: ConfigureNavBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1017185579 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1017185578} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 425776887} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1017185580 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1017185578} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2692de2cb7707be478671c78efb37020, type: 3} + m_Name: + m_EditorClassIdentifier: + addressField1: {fileID: 1464706738} + goButton1: {fileID: 923220795} + addressField2: {fileID: 102826381} + goButton2: {fileID: 1398365136} --- !u!1 &1041187335 GameObject: m_ObjectHideFlags: 0 @@ -1605,7 +1654,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &1398365137 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1727,7 +1776,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1464706739 RectTransform: m_ObjectHideFlags: 0 @@ -2683,6 +2732,22 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 + - keyword: Navigation + response: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1017185580} + m_TargetAssemblyTypeName: ConfigureNavBar, Assembly-CSharp + m_MethodName: ToggleVisibilityMethod + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 persistentKeywords: 0 speechConfirmationTooltipPrefab: {fileID: 8046114618238072051, guid: 271778f6c957b524981067a81d238394, type: 3} --- !u!21 &2059116078 diff --git a/Assets/Scripts/ConfigureNavBar.cs b/Assets/Scripts/ConfigureNavBar.cs new file mode 100644 index 0000000..52f633c --- /dev/null +++ b/Assets/Scripts/ConfigureNavBar.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class ConfigureNavBar : MonoBehaviour +{ + public GameObject addressField1; + public GameObject goButton1; + + public GameObject addressField2; + public GameObject goButton2; + + private bool isVisible = false; + + public void ToggleVisibilityMethod() + { + isVisible = !isVisible; + addressField1.SetActive(isVisible); + goButton1.SetActive(isVisible); + addressField2.SetActive(isVisible); + goButton2.SetActive(isVisible); + } +} + diff --git a/Assets/Scripts/ConfigureNavBar.cs.meta b/Assets/Scripts/ConfigureNavBar.cs.meta new file mode 100644 index 0000000..5d0c4e1 --- /dev/null +++ b/Assets/Scripts/ConfigureNavBar.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2692de2cb7707be478671c78efb37020 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 9edf22e..1a301bd 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -138,7 +138,9 @@ PlayerSettings: 16:9: 1 Others: 1 bundleVersion: 0.1 - preloadedAssets: [] + preloadedAssets: + - {fileID: 3919825601010146741, guid: 3f9164acd8abd4446a837f0de5c295d6, type: 2} + - {fileID: -8850236580838408871, guid: c00f5eb6c0921504a9911f55c664e377, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1