From 751fcc90b5ee0e91f8ac2db710670e39d2a7ae93 Mon Sep 17 00:00:00 2001 From: Nakarin Srijumrat Date: Mon, 7 Mar 2022 03:37:34 +0100 Subject: [PATCH 1/4] began work on first iteration of virtual keyboard --- .../Scripts/VitrivrVR/VR Open Text Input.meta | 8 ++++ .../VR Open Text Input/KeyAudioFeedback.cs | 19 +++++++++ .../KeyAudioFeedback.cs.meta | 11 +++++ .../VR Open Text Input/KeyVisualFeedback.cs | 41 +++++++++++++++++++ .../KeyVisualFeedback.cs.meta | 11 +++++ Packages/manifest.json | 1 + Packages/packages-lock.json | 6 +++ 7 files changed, 97 insertions(+) create mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input.meta create mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs create mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta create mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs create mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input.meta b/Assets/Scripts/VitrivrVR/VR Open Text Input.meta new file mode 100644 index 0000000..96c43a6 --- /dev/null +++ b/Assets/Scripts/VitrivrVR/VR Open Text Input.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f9b1a5dc80df9046b22158ccbbf56ad +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs new file mode 100644 index 0000000..31f93ac --- /dev/null +++ b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class KeyAudioFeedback : MonoBehaviour +{ + public AudioClip keyClick; + private AudioSource clickSource; + // Start is called before the first frame update + void Start() + { + clickSource = gameObject.AddComponent(); + } + + public void PlayKeyClick() + { + clickSource.PlayOneShot(keyClick); + } +} diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta new file mode 100644 index 0000000..1e6601a --- /dev/null +++ b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d660250a948e47e4186fbacab50dcdc4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs new file mode 100644 index 0000000..905c538 --- /dev/null +++ b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class KeyVisualFeedback : MonoBehaviour +{ + private KeyAudioFeedback soundHandler; + public bool keyHit = false; + public bool keyReset = false; + + private float originalY; + // Start is called before the first frame update + void Start() + { + soundHandler = GameObject.FindGameObjectWithTag("SoundHandler").GetComponent(); + originalY = transform.position.y; + } + + // Update is called once per frame + void Update() + { + if (keyHit) + { + originalY = transform.position.y; + soundHandler.PlayKeyClick(); + keyReset = false; + keyHit = false; + transform.position += new Vector3(0, -0.01f, 0); + } + + if (transform.position.y < originalY) + { + transform.position += new Vector3(0, 0.002f, 0); + } + else + { + keyReset = true; + } + } +} diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta new file mode 100644 index 0000000..9cf919d --- /dev/null +++ b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b410707a5a33a4a4e99bb3ba93078457 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 4a82b6d..1779dda 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,6 +1,7 @@ { "dependencies": { "ch.unibas.vr-multimedia-interfaces": "https://github.com/Spiess/vr-multimedia-interfaces.git", + "ch.unibas.vr-open-text-input": "file:C:/Users/nakar/vr-open-text-input", "com.mapbox.mapbox-sdk": "https://github.com/Spiess/mapbox-upm-sdk.git", "com.unity.ide.rider": "3.0.12", "com.unity.ide.visualstudio": "2.0.14", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 1e58ea5..d5b4ee1 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -9,6 +9,12 @@ }, "hash": "ec0eb5cae8287651e07c32a3309d0668d53271ab" }, + "ch.unibas.vr-open-text-input": { + "version": "file:C:/Users/nakar/vr-open-text-input", + "depth": 0, + "source": "local", + "dependencies": {} + }, "com.mapbox.mapbox-sdk": { "version": "https://github.com/Spiess/mapbox-upm-sdk.git", "depth": 0, From 3a07354cb5d75b5bfa8c09731d6089b3bf9df586 Mon Sep 17 00:00:00 2001 From: Nakarin Srijumrat Date: Tue, 8 Mar 2022 01:06:56 +0100 Subject: [PATCH 2/4] removed all VR Open Text Input Scripts from the Assets folder (all scripts are now in the corresponding package repository) --- .../VR Open Text Input/KeyAudioFeedback.cs | 19 --------- .../KeyAudioFeedback.cs.meta | 11 ----- .../VR Open Text Input/KeyVisualFeedback.cs | 41 ------------------- .../KeyVisualFeedback.cs.meta | 11 ----- 4 files changed, 82 deletions(-) delete mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs delete mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta delete mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs delete mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs deleted file mode 100644 index 31f93ac..0000000 --- a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class KeyAudioFeedback : MonoBehaviour -{ - public AudioClip keyClick; - private AudioSource clickSource; - // Start is called before the first frame update - void Start() - { - clickSource = gameObject.AddComponent(); - } - - public void PlayKeyClick() - { - clickSource.PlayOneShot(keyClick); - } -} diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta deleted file mode 100644 index 1e6601a..0000000 --- a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyAudioFeedback.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d660250a948e47e4186fbacab50dcdc4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs deleted file mode 100644 index 905c538..0000000 --- a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class KeyVisualFeedback : MonoBehaviour -{ - private KeyAudioFeedback soundHandler; - public bool keyHit = false; - public bool keyReset = false; - - private float originalY; - // Start is called before the first frame update - void Start() - { - soundHandler = GameObject.FindGameObjectWithTag("SoundHandler").GetComponent(); - originalY = transform.position.y; - } - - // Update is called once per frame - void Update() - { - if (keyHit) - { - originalY = transform.position.y; - soundHandler.PlayKeyClick(); - keyReset = false; - keyHit = false; - transform.position += new Vector3(0, -0.01f, 0); - } - - if (transform.position.y < originalY) - { - transform.position += new Vector3(0, 0.002f, 0); - } - else - { - keyReset = true; - } - } -} diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta b/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta deleted file mode 100644 index 9cf919d..0000000 --- a/Assets/Scripts/VitrivrVR/VR Open Text Input/KeyVisualFeedback.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b410707a5a33a4a4e99bb3ba93078457 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From 01ff399f4e63d5d677670f29f104326eededfae8 Mon Sep 17 00:00:00 2001 From: N4karin Date: Wed, 16 Mar 2022 02:50:28 +0100 Subject: [PATCH 3/4] added ability to input Tab, Left/Right arrow and Return KeyboardEvents --- .../Input/Text/InputFieldController.cs | 24 ++++++++++ .../Input/Text/SceneTextInputController.cs | 23 +++++++++ .../VitrivrVR/Input/Text/TextInputManager.cs | 48 +++++++++++++++++++ 3 files changed, 95 insertions(+) diff --git a/Assets/Scripts/VitrivrVR/Input/Text/InputFieldController.cs b/Assets/Scripts/VitrivrVR/Input/Text/InputFieldController.cs index a9e5a8d..fbf1c5d 100644 --- a/Assets/Scripts/VitrivrVR/Input/Text/InputFieldController.cs +++ b/Assets/Scripts/VitrivrVR/Input/Text/InputFieldController.cs @@ -42,5 +42,29 @@ public void InputBackspace() _inputField.ProcessEvent(Event.KeyboardEvent("backspace")); _inputField.ForceLabelUpdate(); } + + public void InputLeftArrow() + { + _inputField.ProcessEvent(Event.KeyboardEvent("LeftArrow")); + _inputField.ForceLabelUpdate(); + } + + public void InputRightArrow() + { + _inputField.ProcessEvent(Event.KeyboardEvent("RightArrow")); + _inputField.ForceLabelUpdate(); + } + + public void InputReturn() + { + _inputField.ProcessEvent(Event.KeyboardEvent('\n'.ToString())); + _inputField.ForceLabelUpdate(); + } + + public void InputTabulator() + { + _inputField.ProcessEvent(Event.KeyboardEvent('\t'.ToString())); + _inputField.ForceLabelUpdate(); + } } } \ No newline at end of file diff --git a/Assets/Scripts/VitrivrVR/Input/Text/SceneTextInputController.cs b/Assets/Scripts/VitrivrVR/Input/Text/SceneTextInputController.cs index 50a587b..5191d54 100644 --- a/Assets/Scripts/VitrivrVR/Input/Text/SceneTextInputController.cs +++ b/Assets/Scripts/VitrivrVR/Input/Text/SceneTextInputController.cs @@ -21,6 +21,29 @@ public void InputBackspace() TextInputManager.InputBackspace(); DresClientManager.LogInteraction("keyboard", "backspace", QueryEvent.CategoryEnum.TEXT); } + + public void InputReturn() + { + TextInputManager.InputReturn(); + DresClientManager.LogInteraction("keyboard", "return", QueryEvent.CategoryEnum.TEXT); + } + + public void InputLeftArrow() + { + TextInputManager.InputLeftArrow(); + DresClientManager.LogInteraction("keyboard", "ArrowLeft", QueryEvent.CategoryEnum.TEXT); + } + + public void InputRightArrow() + { + TextInputManager.InputRightArrow(); + DresClientManager.LogInteraction("keyboard", "ArrowRight", QueryEvent.CategoryEnum.TEXT); + } + public void InputTabulator() + { + TextInputManager.InputTabulator(); + DresClientManager.LogInteraction("keyboard", "Tabulator", QueryEvent.CategoryEnum.TEXT); + } public void ReceiveDictationResult(string text) { diff --git a/Assets/Scripts/VitrivrVR/Input/Text/TextInputManager.cs b/Assets/Scripts/VitrivrVR/Input/Text/TextInputManager.cs index bba9560..4a2f6ea 100644 --- a/Assets/Scripts/VitrivrVR/Input/Text/TextInputManager.cs +++ b/Assets/Scripts/VitrivrVR/Input/Text/TextInputManager.cs @@ -50,6 +50,54 @@ public static void InputBackspace() inputField.InputBackspace(); } + + public static void InputReturn() + { + var inputField = GETSelectedInputField(); + + if (inputField == null) + { + return; // No text field selected, nothing to do + } + + inputField.InputReturn(); + } + + public static void InputLeftArrow() + { + var inputField = GETSelectedInputField(); + + if (inputField == null) + { + return; // No text field selected, nothing to do + } + + inputField.InputLeftArrow(); + } + + public static void InputRightArrow() + { + var inputField = GETSelectedInputField(); + + if (inputField == null) + { + return; // No text field selected, nothing to do + } + + inputField.InputRightArrow(); + } + + public static void InputTabulator() + { + var inputField = GETSelectedInputField(); + + if (inputField == null) + { + return; // No text field selected, nothing to do + } + + inputField.InputTabulator(); + } private static InputFieldController GETSelectedInputField() { From bc657d2969b78497f898de7be6a2879a6241bd53 Mon Sep 17 00:00:00 2001 From: N4karin Date: Thu, 17 Mar 2022 15:43:53 +0100 Subject: [PATCH 4/4] removed traces of VR Open Text Input --- Assets/Scripts/VitrivrVR/VR Open Text Input.meta | 8 -------- Packages/manifest.json | 1 - Packages/packages-lock.json | 6 ------ 3 files changed, 15 deletions(-) delete mode 100644 Assets/Scripts/VitrivrVR/VR Open Text Input.meta diff --git a/Assets/Scripts/VitrivrVR/VR Open Text Input.meta b/Assets/Scripts/VitrivrVR/VR Open Text Input.meta deleted file mode 100644 index 96c43a6..0000000 --- a/Assets/Scripts/VitrivrVR/VR Open Text Input.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8f9b1a5dc80df9046b22158ccbbf56ad -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 1779dda..4a82b6d 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,7 +1,6 @@ { "dependencies": { "ch.unibas.vr-multimedia-interfaces": "https://github.com/Spiess/vr-multimedia-interfaces.git", - "ch.unibas.vr-open-text-input": "file:C:/Users/nakar/vr-open-text-input", "com.mapbox.mapbox-sdk": "https://github.com/Spiess/mapbox-upm-sdk.git", "com.unity.ide.rider": "3.0.12", "com.unity.ide.visualstudio": "2.0.14", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index d5b4ee1..1e58ea5 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -9,12 +9,6 @@ }, "hash": "ec0eb5cae8287651e07c32a3309d0668d53271ab" }, - "ch.unibas.vr-open-text-input": { - "version": "file:C:/Users/nakar/vr-open-text-input", - "depth": 0, - "source": "local", - "dependencies": {} - }, "com.mapbox.mapbox-sdk": { "version": "https://github.com/Spiess/mapbox-upm-sdk.git", "depth": 0,