HoloLens 2 Gait Training
The purpose of this project is to create gait training application.
Loading...
Searching...
No Matches
HandleKeyboard.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using TMPro;
4using UnityEngine;
5
9public class HandleKeyboard : MonoBehaviour
10{
11
14 private bool m_KeyboardToggle = false;
15
17 private TouchScreenKeyboard m_Keyboard;
18
20 private string m_Text = "";
21
23 [SerializeField] private TextMeshPro m_MeanPeriod;
24
26 [SerializeField] private TextMeshPro m_SDPeriod;
27
29 [SerializeField] private TextMeshPro m_SampleSize;
30
32 [SerializeField] private TextMeshPro m_InputString;
33
35 [SerializeField] private TextMeshPro m_NoiseLbl;
36
38 [SerializeField] private TextMeshPro m_PreferredWalkingSpeed;
39
43 void Start()
44 {
45 m_Keyboard = TouchScreenKeyboard.Open( m_Text, TouchScreenKeyboardType.NumberPad, false, true, false, false );
46 }
47
51 void Update()
52 {
53 if( m_KeyboardToggle == false )
54 {
55 m_Keyboard.active = false;
56 return;
57 }
58
59 if( ( m_Keyboard != null ) && ( m_Keyboard.status == TouchScreenKeyboard.Status.Visible ) && ( m_KeyboardToggle == true ) )
60 {
61 m_Text = m_Keyboard.text;
62 m_InputString.text = "Input = " + m_Text;
63
64 if( m_Text != "" && m_NoiseLbl.text.Equals("Noise: Pink") )
65 {
66 string[] line = m_Text.Split( char.Parse(" ") );
67 m_MeanPeriod.text = "Mean Period = " + line[0];
68 m_SDPeriod.text = "SD Period = " + line[1];
69 m_SampleSize.text = "Sample Size = " + line[2];
70 }
71 else if( m_Text != "" && m_NoiseLbl.text.Equals("Noise: ISO") )
72 {
73 string[] line = m_Text.Split(char.Parse(" "));
74 m_PreferredWalkingSpeed.text = "Preferred Speed = " + line[0];
75 m_SampleSize.text = "Sample Size = " + line[1];
76 }
77 else if( m_Text != "" && m_NoiseLbl.text.Equals("Noise: Random") )
78 {
79 string[] line = m_Text.Split(char.Parse(" "));
80 m_MeanPeriod.text = "Mean Period = " + line[0];
81 m_SDPeriod.text = "SD Period = " + line[1];
82 m_SampleSize.text = "Sample Size = " + line[2];
83 }
84
85 }
86
87 }
88
92 public void GetKeyboard()
93 {
95
96 if ( m_KeyboardToggle )
97 {
98 m_Keyboard.active = true;
99 }
100 else
101 {
102 m_Keyboard.active = false;
103 }
104 }
105
106}
Allow touch screen keyboard to enter noise related data.
TextMeshPro m_SDPeriod
Reference to SD Period label in noise data panel.
TouchScreenKeyboard m_Keyboard
Instance of the touch screen keyboard.
TextMeshPro m_InputString
Reference to the inputstring label in the data panel.
bool m_KeyboardToggle
Flag to toggle keyboard. When set to true, keyboard is not visible.
TextMeshPro m_PreferredWalkingSpeed
Reference to the user's preferred walking speed.
TextMeshPro m_SampleSize
Reference to sample size label in noise data panel.
TextMeshPro m_MeanPeriod
Reference to Mean Period label in noise data panel.
void Update()
Whenever use enters space separated noise values it will be set in the noise data panel.
string m_Text
This string will hold the keyboard entries.
TextMeshPro m_NoiseLbl
Reference to the noise label in the data panel.
void Start()
We instantiate keyboard instance.
void GetKeyboard()
Toggle keyboard and set it active or inactive.