|
|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
// Token: 0x02000174 RID: 372
|
|
|
|
|
@ -21,7 +23,11 @@ public class ScreenKeyboardManager : MonoBehaviour
|
|
|
|
|
gameObject = new GameObject("_ScreenKeyboardManager");
|
|
|
|
|
}
|
|
|
|
|
ScreenKeyboardManager.m_instance = gameObject.AddComponent<ScreenKeyboardManager>();
|
|
|
|
|
gameObject.AddComponent<EventSystem>();
|
|
|
|
|
gameObject.AddComponent<StandaloneInputModule>();
|
|
|
|
|
ScreenKeyboardManager.m_instance.m_inputText = string.Empty;
|
|
|
|
|
ScreenKeyboardManager.m_instance.m_inputTextLastName = string.Empty;
|
|
|
|
|
ScreenKeyboardManager.m_instance.isKeyboardActive = true;
|
|
|
|
|
}
|
|
|
|
|
return ScreenKeyboardManager.m_instance;
|
|
|
|
|
}
|
|
|
|
|
@ -47,6 +53,26 @@ public class ScreenKeyboardManager : MonoBehaviour
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x1700015B RID: 347
|
|
|
|
|
// (get) Token: 0x06000A94 RID: 2708 RVA: 0x0002EA98 File Offset: 0x0002CC98
|
|
|
|
|
public static string InputTextLastName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ScreenKeyboardManager.Instance.m_inputTextLastName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x1700015C RID: 348
|
|
|
|
|
// (set) Token: 0x06000A95 RID: 2709 RVA: 0x0002EAA4 File Offset: 0x0002CCA4
|
|
|
|
|
public static string DebugInputTextLastName
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ScreenKeyboardManager.Instance.m_inputTextLastName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x1700015D RID: 349
|
|
|
|
|
// (get) Token: 0x06000A96 RID: 2710 RVA: 0x0002EAB4 File Offset: 0x0002CCB4
|
|
|
|
|
public static bool IsCancel
|
|
|
|
|
@ -59,24 +85,54 @@ public class ScreenKeyboardManager : MonoBehaviour
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x06000A97 RID: 2711 RVA: 0x0002EAC8 File Offset: 0x0002CCC8
|
|
|
|
|
public static IEnumerator Open(string defaultString = "")
|
|
|
|
|
public static IEnumerator Open(string defaultString = "", string defaultString2 = "")
|
|
|
|
|
{
|
|
|
|
|
bool isKeyboardActive = true;
|
|
|
|
|
int width = 350;
|
|
|
|
|
int height = 50;
|
|
|
|
|
int fontSize = 24;
|
|
|
|
|
Color fontColor = Color.white;
|
|
|
|
|
Color inputBoxColor = new Color(87f/255f,48f / 255f, 55f / 255f, 255f / 255f);
|
|
|
|
|
|
|
|
|
|
GameObject manager= ScreenKeyboardManager.Instance.gameObject;
|
|
|
|
|
//ScreenKeyboardManager.m_instance.isKeyboardActive = true;
|
|
|
|
|
//Debug.LogWarning("Name: " + defaultString + " = " + defaultString2);
|
|
|
|
|
GameObject manager = ScreenKeyboardManager.Instance.gameObject;
|
|
|
|
|
|
|
|
|
|
Canvas canvas = manager.AddComponent<Canvas>();
|
|
|
|
|
canvas.gameObject.AddComponent<CanvasScaler>();
|
|
|
|
|
CanvasScaler scaler = canvas.gameObject.AddComponent<CanvasScaler>();
|
|
|
|
|
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
|
|
|
|
canvas.gameObject.AddComponent<GraphicRaycaster>();
|
|
|
|
|
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
|
|
|
|
|
|
|
|
|
InputField _inputFieldFirstName = createInputBox(canvas, "FirstName", defaultString, "Input First Name", new Vector3(-250, 50, 0));
|
|
|
|
|
InputField _inputFieldLastName = createInputBox(canvas, "LastName", defaultString2, "Input Last Name", new Vector3(0, 50, 0));
|
|
|
|
|
|
|
|
|
|
createEqualsBox(canvas, "Equals", new Vector3(-125, 50, 0));
|
|
|
|
|
createButton(canvas, "SubmitButton", new Vector3(-125, -35, 0));
|
|
|
|
|
|
|
|
|
|
string firstNameString = _inputFieldFirstName.text;
|
|
|
|
|
string lastNameString = _inputFieldLastName.text;
|
|
|
|
|
|
|
|
|
|
while (ScreenKeyboardManager.m_instance.isKeyboardActive)
|
|
|
|
|
{
|
|
|
|
|
yield return 0;
|
|
|
|
|
/*if (Input.GetKeyDown(KeyCode.Return))
|
|
|
|
|
{
|
|
|
|
|
firstNameString = _inputFieldFirstName.text;
|
|
|
|
|
lastNameString = _inputFieldLastName.text;
|
|
|
|
|
ScreenKeyboardManager.Instance.m_inputText = firstNameString;
|
|
|
|
|
ScreenKeyboardManager.Instance.m_inputTextLastName = lastNameString;
|
|
|
|
|
GameObject.Destroy(canvas.gameObject);
|
|
|
|
|
isKeyboardActive = false;
|
|
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
yield break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static InputField createInputBox(Canvas canvas, string objectName, string defaultString, string placeholderString, Vector3 position)
|
|
|
|
|
{
|
|
|
|
|
int width = 200;
|
|
|
|
|
int height = 50;
|
|
|
|
|
int fontSize = 24;
|
|
|
|
|
Color fontColor = Color.white;
|
|
|
|
|
Color inputBoxColor = new Color(87f / 255f, 48f / 255f, 55f / 255f, 255f / 255f);
|
|
|
|
|
|
|
|
|
|
GameObject container = new GameObject();
|
|
|
|
|
container.name = "InputField";
|
|
|
|
|
container.name = objectName;
|
|
|
|
|
container.transform.parent = canvas.transform;
|
|
|
|
|
container.AddComponent<CanvasRenderer>();
|
|
|
|
|
|
|
|
|
|
@ -90,6 +146,7 @@ public class ScreenKeyboardManager : MonoBehaviour
|
|
|
|
|
GameObject textContainer = new GameObject();
|
|
|
|
|
textContainer.name = "Text";
|
|
|
|
|
textContainer.transform.parent = container.transform;
|
|
|
|
|
container.transform.localScale = new Vector3(1, 1, 1);
|
|
|
|
|
Text _text = textContainer.AddComponent<Text>();
|
|
|
|
|
RectTransform _textTransform = _text.GetComponent<RectTransform>();
|
|
|
|
|
_textTransform.sizeDelta = new Vector2(width, height);
|
|
|
|
|
@ -112,7 +169,7 @@ public class ScreenKeyboardManager : MonoBehaviour
|
|
|
|
|
_placeholder.fontStyle = FontStyle.Italic;
|
|
|
|
|
_placeholder.supportRichText = false;
|
|
|
|
|
_placeholder.horizontalOverflow = HorizontalWrapMode.Overflow;
|
|
|
|
|
_placeholder.text = "Enter your Name";
|
|
|
|
|
_placeholder.text = placeholderString;
|
|
|
|
|
_placeholder.alignment = TextAnchor.MiddleCenter;
|
|
|
|
|
|
|
|
|
|
InputField _inputField = container.AddComponent<InputField>();
|
|
|
|
|
@ -120,43 +177,95 @@ public class ScreenKeyboardManager : MonoBehaviour
|
|
|
|
|
_inputField.textComponent = _text;
|
|
|
|
|
_inputField.placeholder = _placeholder;
|
|
|
|
|
RectTransform _inputFieldTransform = _inputField.GetComponent<RectTransform>();
|
|
|
|
|
_inputFieldTransform.localPosition = new Vector3(0, 0, 0);
|
|
|
|
|
_inputFieldTransform.localPosition = position;
|
|
|
|
|
_inputFieldTransform.sizeDelta = new Vector2(width, height);
|
|
|
|
|
_inputField.characterLimit = 7;
|
|
|
|
|
_inputField.characterValidation = InputField.CharacterValidation.Name;
|
|
|
|
|
_inputField.text = defaultString;
|
|
|
|
|
return _inputField;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string nameString = _inputField.text;
|
|
|
|
|
|
|
|
|
|
while (isKeyboardActive)
|
|
|
|
|
{
|
|
|
|
|
yield return 0;
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Return))
|
|
|
|
|
public static void createButton(Canvas canvas, string objectName, Vector3 position)
|
|
|
|
|
{
|
|
|
|
|
nameString = _inputField.text;
|
|
|
|
|
ScreenKeyboardManager.Instance.m_inputText = nameString;
|
|
|
|
|
GameObject.Destroy(canvas.gameObject);
|
|
|
|
|
isKeyboardActive = false;
|
|
|
|
|
int width = 150;
|
|
|
|
|
int height = 50;
|
|
|
|
|
int fontSize = 24;
|
|
|
|
|
Color fontColor = Color.white;
|
|
|
|
|
Color inputBoxColor = new Color(242f / 255f, 151f / 255f, 161f / 255f, 255f / 255f);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GameObject container = new GameObject();
|
|
|
|
|
container.name = objectName;
|
|
|
|
|
container.transform.parent = canvas.transform;
|
|
|
|
|
container.transform.localPosition = position;
|
|
|
|
|
container.AddComponent<CanvasRenderer>();
|
|
|
|
|
|
|
|
|
|
//TODO fix TouchScreenKeyboard issue
|
|
|
|
|
/*ScreenKeyboardManager.Instance.m_inputText = defaultString;
|
|
|
|
|
ScreenKeyboardManager.Instance.m_keyboard = TouchScreenKeyboard.Open(defaultString, TouchScreenKeyboardType.NamePhonePad);
|
|
|
|
|
while (!ScreenKeyboardManager.Instance.m_keyboard.active)
|
|
|
|
|
{
|
|
|
|
|
yield return 0;
|
|
|
|
|
|
|
|
|
|
Image _image = container.AddComponent<Image>();
|
|
|
|
|
_image.type = Image.Type.Sliced;
|
|
|
|
|
_image.color = inputBoxColor;
|
|
|
|
|
Button _button = container.AddComponent<Button>();
|
|
|
|
|
_button.onClick.AddListener(delegate { OnButtonClick(container.transform.parent.GetChild(0).gameObject.GetComponent<InputField>(), container.transform.parent.GetChild(1).gameObject.GetComponent<InputField>(), canvas); });
|
|
|
|
|
|
|
|
|
|
RectTransform _containerTransform = container.GetComponent<RectTransform>();
|
|
|
|
|
_containerTransform.sizeDelta = new Vector2(width, height);
|
|
|
|
|
|
|
|
|
|
Font font = (Font)Resources.Load("font/Cabin");
|
|
|
|
|
|
|
|
|
|
GameObject textContainer = new GameObject();
|
|
|
|
|
textContainer.name = "Text";
|
|
|
|
|
textContainer.transform.parent = container.transform;
|
|
|
|
|
textContainer.transform.localPosition = new Vector3(0,0,0);
|
|
|
|
|
container.transform.localScale = new Vector3(1, 1, 1);
|
|
|
|
|
Text _text = textContainer.AddComponent<Text>();
|
|
|
|
|
RectTransform _textTransform = _text.GetComponent<RectTransform>();
|
|
|
|
|
_textTransform.sizeDelta = new Vector2(width, height);
|
|
|
|
|
_text.supportRichText = false;
|
|
|
|
|
_text.color = fontColor;
|
|
|
|
|
_text.font = font;
|
|
|
|
|
_text.fontSize = fontSize;
|
|
|
|
|
_text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
|
|
|
|
_text.alignment = TextAnchor.MiddleCenter;
|
|
|
|
|
_text.text = "Confirm";
|
|
|
|
|
}
|
|
|
|
|
while (ScreenKeyboardManager.Instance.m_keyboard.active)
|
|
|
|
|
|
|
|
|
|
public static void createEqualsBox(Canvas canvas, string objectName, Vector3 position)
|
|
|
|
|
{
|
|
|
|
|
yield return 0;
|
|
|
|
|
int width = 50;
|
|
|
|
|
int height = 50;
|
|
|
|
|
int fontSize = 40;
|
|
|
|
|
Color fontColor = Color.white;
|
|
|
|
|
|
|
|
|
|
GameObject container = new GameObject();
|
|
|
|
|
container.name = objectName;
|
|
|
|
|
container.transform.parent = canvas.transform;
|
|
|
|
|
|
|
|
|
|
container.AddComponent<CanvasRenderer>();
|
|
|
|
|
|
|
|
|
|
Font font = (Font)Resources.Load("font/Cabin");
|
|
|
|
|
|
|
|
|
|
container.transform.localScale = new Vector3(1, 1, 1);
|
|
|
|
|
Text _text = container.AddComponent<Text>();
|
|
|
|
|
RectTransform _textTransform = _text.GetComponent<RectTransform>();
|
|
|
|
|
_textTransform.localPosition = position;
|
|
|
|
|
_textTransform.sizeDelta = new Vector2(width, height);
|
|
|
|
|
_text.supportRichText = false;
|
|
|
|
|
_text.color = fontColor;
|
|
|
|
|
_text.font = font;
|
|
|
|
|
_text.fontSize = fontSize;
|
|
|
|
|
_text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
|
|
|
|
_text.alignment = TextAnchor.MiddleCenter;
|
|
|
|
|
_text.text = "=";
|
|
|
|
|
}
|
|
|
|
|
if (ScreenKeyboardManager.Instance.m_keyboard.done)
|
|
|
|
|
|
|
|
|
|
public static void OnButtonClick(InputField firstname, InputField lastname, Canvas canvas )
|
|
|
|
|
{
|
|
|
|
|
ScreenKeyboardManager.Instance.m_inputText = ScreenKeyboardManager.Instance.m_keyboard.text;
|
|
|
|
|
}*/
|
|
|
|
|
yield break;
|
|
|
|
|
String firstNameString = firstname.text;
|
|
|
|
|
String lastNameString = lastname.text;
|
|
|
|
|
ScreenKeyboardManager.Instance.m_inputText = firstNameString;
|
|
|
|
|
ScreenKeyboardManager.Instance.m_inputTextLastName = lastNameString;
|
|
|
|
|
Debug.LogWarning("Name: " + firstNameString + " = " + lastNameString);
|
|
|
|
|
ScreenKeyboardManager.m_instance.isKeyboardActive = false;
|
|
|
|
|
GameObject.Destroy(canvas.gameObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x06000A98 RID: 2712 RVA: 0x0002EAEC File Offset: 0x0002CCEC
|
|
|
|
|
@ -177,4 +286,9 @@ public class ScreenKeyboardManager : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
// Token: 0x04000887 RID: 2183
|
|
|
|
|
private string m_inputText;
|
|
|
|
|
|
|
|
|
|
// Token: 0x04000887 RID: 2183
|
|
|
|
|
private string m_inputTextLastName;
|
|
|
|
|
|
|
|
|
|
private bool isKeyboardActive;
|
|
|
|
|
}
|
|
|
|
|
|