-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubmitNameCheck_Phone.cs
100 lines (92 loc) · 3.73 KB
/
SubmitNameCheck_Phone.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using UnityEngine;
using System.Collections;
public class SubmitNameCheck_Phone : MonoBehaviour {
// Use this for initialization
void Start ()
{
if (gameObject.GetComponent<GUIText>())
{
Statics.gt_SubmitNameTextBox = gameObject.GetComponent<GUIText>();
}
else if (gameObject.GetComponent<GUITexture>())
{
Statics.gt_SubmitNameBox = gameObject.GetComponent<GUITexture>();
}
}
/*protected void NamePressed()
{
string s = gameObject.name.Remove(0, 4);
Statics.GuiTouch.StartCoroutine("RunFunction", s);
}*/
TouchScreenKeyboard Keyboard = null;
string name = "";
bool Open = false;
protected IEnumerator NameText()
{
Debug.Log("We have executed NameText");
yield return 0;
Keyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, false, false, "Enter Text");
Open = true;
//Statics.GuiTouch.ToggleTouch(false);
//Reset();
}
void Update()
{
if (Open)
{
Debug.Log("Keyboard is now Open");
if (Keyboard.active)
{
if (Keyboard.text.Length > 15)
Keyboard.text = Keyboard.text.Substring(0, 15);
else
{
name = Keyboard.text;
Statics.gt_SubmitNameTextBox.text = Keyboard.text;
}
}
if (Keyboard.wasCanceled || Keyboard.done)
{
name = Keyboard.text;
Statics.gt_SubmitNameTextBox.text = Keyboard.text;
Open = false;
//Statics.GuiTouch.ToggleTouch(true);
}
}
else
{
if (G_Notifications.ActiveNotificationGame == eNotificationTypeGame.EnterName)
{
int count = Input.touchCount; //How many touch's are on the screen
if (count < 2) //Checks to make sure there is only 1 touch at a time
for (int i = 0; i < count; i++) //Makes Cycles through all the touches in this case the first
{
Touch touch = Input.GetTouch(i); //Gets the touch information
//Debug.Log("Touch for Dice Aquired");
if (gameObject.GetComponent<GUITexture>())
{
if (gameObject.GetComponent<GUITexture>().HitTest(touch.position)) //Does a hit test for the specifc texture associates with this class instance
{
Debug.Log("Target Defined " + gameObject.name);
if (touch.phase == TouchPhase.Ended) // Makes sure the guiTexture in enabled and the finger has left the Device
{
StartCoroutine(NameText());
}
}
}
else if (gameObject.GetComponent<GUIText>())
{
if (gameObject.GetComponent<GUIText>().HitTest(touch.position)) //Does a hit test for the specifc texture associates with this class instance
{
Debug.Log("Target Defined " + gameObject.name);
if (touch.phase == TouchPhase.Ended) // Makes sure the guiTexture in enabled and the finger has left the Device
{
StartCoroutine(NameText());
}
}
}
}
}
}
}
}