public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure) { string textPlaceholder = ""; bool alert = false; return(TouchScreenKeyboard.Open(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder)); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline) { string textPlaceholder = string.Empty; bool alert = false; bool secure = false; return Open(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder); }
bool ShowTouchScreenKeyboard(GUIBase_Button inInput, E_KeyBoardMode inMode, KeyboardClose inCloseDelegate, string inText, string inPlaceholder, int inMaxTextLength) { if (m_ActiveInput != null || inInput == null || inCloseDelegate == null) { return(false); } /// setup arguments for Touch keyboard... TouchScreenKeyboardType keyboardType = inMode == E_KeyBoardMode.Email ? TouchScreenKeyboardType.EmailAddress : inMode == E_KeyBoardMode.Password ? TouchScreenKeyboardType.Default : TouchScreenKeyboardType.ASCIICapable; bool autocorrection = false; //inMode != E_KeyBoardMode.Password; bool secure = inMode == E_KeyBoardMode.Password; // open keyboard... TouchScreenKeyboard keyboard = TouchScreenKeyboard.Open(inText, keyboardType, autocorrection, false, secure, false, inPlaceholder); if (keyboard == null) { return(false); } m_ActiveInput = inInput; StartCoroutine(ProcessKeyboardInput(keyboard, inCloseDelegate, inText, inMaxTextLength)); return(true); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure) { string empty = string.Empty; bool alert = false; return(TouchScreenKeyboard.Open(text, keyboardType, autocorrection, multiline, secure, alert, empty)); }
protected string TextField(string controlName, Rect rect, string text, TouchScreenKeyboardType type) { GUI.SetNextControlName(controlName); if (rect.Contains(Event.current.mousePosition)) { if (Input.GetMouseButtonDown(0)) { GUI.color = new Color(1, 1, 1, 2); GUI.enabled = false; } else if (Input.GetMouseButtonUp(0) && !dragging) { GUI.color = Color.white; GUI.enabled = true; FocusField(controlName, text, type); } } if (currentFocusedControl == controlName) { text = updatedTextValue; currentFocusedControl = ""; updatedTextValue = ""; } return(GUI.TextField(rect, text)); }
void Start() { TouchScreenKeyboard.hideInput = true; keyboardType = isPassword ? TouchScreenKeyboardType.NamePhonePad : TouchScreenKeyboardType.EmailAddress; caret.SetActive(false); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert) { int characterLimit = 0; string textPlaceholder = ""; return(Open(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder, characterLimit)); }
public static void OnInput(string str, TouchScreenKeyboardType type, bool multiLine, bool passward, int limit) { if (_touch) { m_touch = TouchScreenKeyboard.Open("", type, true, multiLine, passward); m_touch.characterLimit = limit; } }
public void DrawKeyboard(string text, bool hideInput = false, TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default, bool autocorrection = true, bool multiline = false, bool secure = false) { HideKeyboard(false, false); TouchScreenKeyboard.hideInput = hideInput; _currentKeyboard = TouchScreenKeyboard.Open(text, keyboardType, autocorrection, multiline, secure, false, string.Empty); }
// Token: 0x06000101 RID: 257 RVA: 0x0000B62C File Offset: 0x0000982C public static void openKeyBoard(string caption, int type, string text, Command action) { ipKeyboard.act = action; TouchScreenKeyboardType t = (type != 0 && type != 2) ? TouchScreenKeyboardType.NumberPad : TouchScreenKeyboardType.ASCIICapable; TouchScreenKeyboard.hideInput = false; ipKeyboard.tk = TouchScreenKeyboard.Open(text, t, false, false, type == 2, false, caption); }
public override void Reset() { keyBoardType = TouchScreenKeyboardType.Default; autoCorrection = true; multiLine = false; secure = false; alert = false; textPlaceHolder = ""; }
public override void Copy(SpriteRoot s, ControlCopyFlags flags) { base.Copy(s, flags); if (!(s is UITextField)) { return; } UITextField b = (UITextField)s; if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings) { maxLength = b.maxLength; multiline = b.multiline; password = b.password; maskingCharacter = b.maskingCharacter; customKeyboard = b.customKeyboard; customFocusEvent = b.customFocusEvent; margins = b.margins; #if UNITY_IPHONE || UNITY_ANDROID type = b.type; autoCorrect = b.autoCorrect; alert = b.alert; hideInput = b.hideInput; #endif typingSoundEffect = b.typingSoundEffect; fieldFullSound = b.fieldFullSound; } if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation) { scriptWithMethodToInvoke = b.scriptWithMethodToInvoke; methodToInvoke = b.methodToInvoke; } if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance) { caret.Copy(b.caret); caretSize = b.caretSize; caretOffset = b.caretOffset; caretAnchor = b.caretAnchor; showCaretOnMobile = b.showCaretOnMobile; } if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State) { insert = b.insert; Text = b.Text; } SetMargins(margins); }
void FocusField(string controlName, string text, TouchScreenKeyboardType type) { if (GUI.GetNameOfFocusedControl() == controlName) { return; } GUI.FocusControl(controlName); keyboard = TouchScreenKeyboard.Open(text, type); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType) { string textPlaceholder = string.Empty; bool alert = false; bool secure = false; bool multiline = false; bool autocorrection = true; return(Open(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder)); }
protected void TextFieldBaseSetting(EzGui_TextField _Field, TouchScreenKeyboardType _Type, int MaxLength, Color _Color) { _Field.GetUITextField().type = _Type; _Field.GetUITextField().hideInput = true; _Field.GetUITextField().autoCorrect = false; _Field.GetUITextField().alert = false; _Field.GetUITextField().maxLength = MaxLength; _Field.SetColor(_Color); }
public override void Reset() { _active = false; _done = false; keyBoardType = TouchScreenKeyboardType.Default; autoCorrection = true; multiLine = false; secure = false; alert = false; textPlaceHolder = ""; }
public TouchScreenKeyboard(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert, string textPlaceholder) { TouchScreenKeyboard_InternalConstructorHelperArguments arguments = new TouchScreenKeyboard_InternalConstructorHelperArguments { keyboardType = Convert.ToUInt32(keyboardType), autocorrection = Convert.ToUInt32(autocorrection), multiline = Convert.ToUInt32(multiline), secure = Convert.ToUInt32(secure), alert = Convert.ToUInt32(alert) }; this.TouchScreenKeyboard_InternalConstructorHelper(ref arguments, text, textPlaceholder); }
public TouchScreenKeyboard(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert, string textPlaceholder) { this.TouchScreenKeyboard_InternalConstructorHelper(ref new TouchScreenKeyboard_InternalConstructorHelperArguments() { keyboardType = Convert.ToUInt32((object)keyboardType), autocorrection = Convert.ToUInt32(autocorrection), multiline = Convert.ToUInt32(multiline), secure = Convert.ToUInt32(secure), alert = Convert.ToUInt32(alert) }, text, textPlaceholder); }
public static void OpenKeyboard(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert, bool hideInput) { #if UNITY_IPHONE || UNITY_ANDROID if( !Application.isEditor ) { keyboard = TouchScreenKeyboard.Open(text, keyboardType, autocorrection, multiline, secure, alert); TouchScreenKeyboard.hideInput = hideInput; lastMobileKeyboardText = ""; } #endif }
public static TouchScreenKeyboard Open(string text) { string empty = string.Empty; bool alert = false; bool secure = false; bool multiline = false; bool autocorrection = true; TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default; return(Open(text, keyboardType, autocorrection, multiline, secure, alert, empty)); }
public TouchScreenKeyboard(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert, string textPlaceholder) { TouchScreenKeyboard_InternalConstructorHelperArguments touchScreenKeyboard_InternalConstructorHelperArguments = default(TouchScreenKeyboard_InternalConstructorHelperArguments); touchScreenKeyboard_InternalConstructorHelperArguments.keyboardType = Convert.ToUInt32(keyboardType); touchScreenKeyboard_InternalConstructorHelperArguments.autocorrection = Convert.ToUInt32(autocorrection); touchScreenKeyboard_InternalConstructorHelperArguments.multiline = Convert.ToUInt32(multiline); touchScreenKeyboard_InternalConstructorHelperArguments.secure = Convert.ToUInt32(secure); touchScreenKeyboard_InternalConstructorHelperArguments.alert = Convert.ToUInt32(alert); this.TouchScreenKeyboard_InternalConstructorHelper(ref touchScreenKeyboard_InternalConstructorHelperArguments, text, textPlaceholder); }
public static TouchScreenKeyboard Open(string text) { int characterLimit = 0; string textPlaceholder = ""; bool alert = false; bool secure = false; bool multiline = false; bool autocorrection = true; TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default; return(Open(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder, characterLimit)); }
public TouchScreenKeyboard(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert, string textPlaceholder, int characterLimit) { TouchScreenKeyboard_InternalConstructorHelperArguments arguments = new TouchScreenKeyboard_InternalConstructorHelperArguments(); arguments.keyboardType = Convert.ToUInt32(keyboardType); arguments.autocorrection = Convert.ToUInt32(autocorrection); arguments.multiline = Convert.ToUInt32(multiline); arguments.secure = Convert.ToUInt32(secure); arguments.alert = Convert.ToUInt32(alert); arguments.characterLimit = characterLimit; TouchScreenKeyboard_InternalConstructorHelper(ref arguments, text, textPlaceholder); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure) { TouchScreenKeyboard kb = TouchScreenKeyboard.Open(text, keyboardType, autocorrection, multiline, secure); #if UNITY_IPHONE bool autoCapitalization = (keyboardType != TouchScreenKeyboardType.EmailAddress) && (secure != true); Debug.LogWarning("AutoCap = " + autoCapitalization.ToString() + ": " + (secure != true).ToString() + " && " + (keyboardType != TouchScreenKeyboardType.EmailAddress).ToString()); _SetAutoCapitalization(autoCapitalization); #endif return(kb); }
// returns the modified string public static string InputField(Rect rect // standard positioning rectangle , string text // the string to start with , string textDefault // the string to default , int maxLength // 0 indicates infinite , TouchScreenKeyboardType keyboardType , bool secure // true will cause the keyboard to go in to password mode and the field to show only asterisks , bool autocorrect // false will disable autocorrect, useful for fields where a user types in a name , bool multiline , GUIStyle style ) { string displayText ; if(secure) { displayText = ""; for(int i = 0; i < text.Length; ++i) {displayText += "*";} } else { if(text==""){ displayText = textDefault; }else{ displayText = text; } } if(GUI.Button(rect, displayText, style)) { if(text==textDefault){ kb = TouchScreenKeyboard.Open("", keyboardType, autocorrect, multiline, secure, false, textDefault); }else{ kb = TouchScreenKeyboard.Open(text, keyboardType, autocorrect, multiline, secure, false, textDefault); } } if(kb!= null && kb.done &&!kb.wasCanceled) { if(maxLength == 0 || text.Length <= maxLength) { text = kb.text; } else { text = kb.text.Substring(0, maxLength); } } return text; }
private static int get_keyboardType(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); InputField inputField = (InputField)obj; TouchScreenKeyboardType keyboardType = inputField.keyboardType; ToLua.Push(L, keyboardType); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index keyboardType on a nil value"); } return(result); }
// Token: 0x060000E6 RID: 230 RVA: 0x0000B314 File Offset: 0x00009514 public void setFocusWithKb(bool isFocus) { if (this.isFocus != isFocus) { TField.mode = 0; } TField.lastKey = -1984; TField.timeChangeMode = (long)((int)(DateTime.Now.Ticks / 1000L)); this.isFocus = isFocus; if (isFocus) { TField.currentTField = this; } else if (TField.currentTField == this) { TField.currentTField = null; } if (Thread.CurrentThread.Name == Main.mainThreadName && TField.currentTField != null) { isFocus = true; TouchScreenKeyboard.hideInput = !TField.currentTField.showSubTextField; TouchScreenKeyboardType t = TouchScreenKeyboardType.ASCIICapable; if (this.inputType == TField.INPUT_TYPE_NUMERIC) { t = TouchScreenKeyboardType.NumberPad; } bool type = false; if (this.inputType == TField.INPUT_TYPE_PASSWORD) { type = true; } TField.kb = TouchScreenKeyboard.Open(TField.currentTField.text, t, false, false, type, false, TField.currentTField.name); if (TField.kb != null) { TField.kb.text = TField.currentTField.text; } Cout.LogWarning("SHOW KEYBOARD FOR " + TField.currentTField.text); } }
protected string TextField(string controlName, Rect rect, string text, TouchScreenKeyboardType type) { GUI.SetNextControlName(controlName); if (rect.Contains(Event.current.mousePosition)) { if (Input.GetMouseButtonDown(0)) { GUI.color = new Color(1,1,1,2); GUI.enabled = false; } else if (Input.GetMouseButtonUp(0) && !dragging) { GUI.color = Color.white; GUI.enabled = true; FocusField(controlName, text, type); } } if (currentFocusedControl == controlName) { text = updatedTextValue; currentFocusedControl = ""; updatedTextValue = ""; } return GUI.TextField(rect, text); }
protected void EnforceContentType() { switch (contentType) { case InputField.ContentType.Standard: { // Don't enforce line type for this content type. m_InputType = InputField.InputType.Standard; m_KeyboardType = TouchScreenKeyboardType.Default; m_CharacterValidation = InputField.CharacterValidation.None; return; } case InputField.ContentType.Autocorrected: { // Don't enforce line type for this content type. m_InputType = InputField.InputType.AutoCorrect; m_KeyboardType = TouchScreenKeyboardType.Default; m_CharacterValidation = InputField.CharacterValidation.None; return; } case InputField.ContentType.IntegerNumber: { m_LineType = InputField.LineType.SingleLine; SetTextComponentWrapMode(false); m_InputType = InputField.InputType.Standard; m_KeyboardType = TouchScreenKeyboardType.NumberPad; m_CharacterValidation = InputField.CharacterValidation.Integer; return; } case InputField.ContentType.DecimalNumber: { m_LineType = InputField.LineType.SingleLine; SetTextComponentWrapMode(false); m_InputType = InputField.InputType.Standard; m_KeyboardType = TouchScreenKeyboardType.NumbersAndPunctuation; m_CharacterValidation = InputField.CharacterValidation.Decimal; return; } case InputField.ContentType.Alphanumeric: { m_LineType = InputField.LineType.SingleLine; SetTextComponentWrapMode(false); m_InputType = InputField.InputType.Standard; m_KeyboardType = TouchScreenKeyboardType.ASCIICapable; m_CharacterValidation = InputField.CharacterValidation.Alphanumeric; return; } case InputField.ContentType.Name: { m_LineType = InputField.LineType.SingleLine; SetTextComponentWrapMode(false); m_InputType = InputField.InputType.Standard; m_KeyboardType = TouchScreenKeyboardType.Default; m_CharacterValidation = InputField.CharacterValidation.Name; return; } case InputField.ContentType.EmailAddress: { m_LineType = InputField.LineType.SingleLine; SetTextComponentWrapMode(false); m_InputType = InputField.InputType.Standard; m_KeyboardType = TouchScreenKeyboardType.EmailAddress; m_CharacterValidation = InputField.CharacterValidation.EmailAddress; return; } case InputField.ContentType.Password: { m_LineType = InputField.LineType.SingleLine; SetTextComponentWrapMode(false); m_InputType = InputField.InputType.Password; m_KeyboardType = TouchScreenKeyboardType.Default; m_CharacterValidation = InputField.CharacterValidation.None; return; } case InputField.ContentType.Pin: { m_LineType = InputField.LineType.SingleLine; SetTextComponentWrapMode(false); m_InputType = InputField.InputType.Password; m_KeyboardType = TouchScreenKeyboardType.NumberPad; m_CharacterValidation = InputField.CharacterValidation.Integer; return; } default: { // Includes Custom type. Nothing should be enforced. return; } } }
void FocusField(string controlName, string text, TouchScreenKeyboardType type) { if (GUI.GetNameOfFocusedControl() == controlName) return; GUI.FocusControl(controlName); keyboard = TouchScreenKeyboard.Open(text, type); }
public TouchScreenKeyboard(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert, string textPlaceholder){}
public void SetType(TouchScreenKeyboardType t) { EZGUI_TextField.type = t; }
public void SetKeyboardType(TouchScreenKeyboardType _keyboardType) { inputField.keyboardType = _keyboardType; Debug.Log("TIPO: " + _keyboardType.ToString()); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType) { string empty = string.Empty; bool alert = false; bool secure = false; bool multiline = false; bool autocorrection = true; return TouchScreenKeyboard.Open(text, keyboardType, autocorrection, multiline, secure, alert, empty); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType){}
public override void Copy(SpriteRoot s, ControlCopyFlags flags) { base.Copy(s, flags); if (!(s is UITextField)) return; UITextField b = (UITextField)s; if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings) { maxLength = b.maxLength; multiline = b.multiline; password = b.password; maskingCharacter = b.maskingCharacter; customKeyboard = b.customKeyboard; customFocusEvent = b.customFocusEvent; margins = b.margins; #if UNITY_IPHONE || UNITY_ANDROID type = b.type; autoCorrect = b.autoCorrect; alert = b.alert; hideInput = b.hideInput; #endif typingSoundEffect = b.typingSoundEffect; fieldFullSound = b.fieldFullSound; } if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation) { scriptWithMethodToInvoke = b.scriptWithMethodToInvoke; methodToInvoke = b.methodToInvoke; } if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance) { caret.Copy(b.caret); caretSize = b.caretSize; caretOffset = b.caretOffset; caretAnchor = b.caretAnchor; showCaretOnMobile = b.showCaretOnMobile; } if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State) { insert = b.insert; Text = b.Text; } SetMargins(margins); }
/// <summary> /// Displays this screen. /// </summary> /// <param name="infoText">The text that should be displayed in the screen.</param> /// <param name="minTextLength">The lowest acceptable letter-count in input.</param> /// <param name="maxTextLength">The maximum acceptable letter-count in input.</param> /// <param name="allowCancel">Whether to allow cancelling or not.</param> /// <param name="callbackConfirm">Callback for what happens when confirming.</param> /// <param name="keyboardType">The type of keyboard to be displayed when inputting. Should preferably match the content type.</param> /// <param name="startValue">Start text value.</param> /// <param name="inputType">The input type.</param> /// <param name="lineType">The line type.</param> public virtual void Set(string infoText, int minTextLength, int maxTextLength, bool allowCancel, System.Action <string> callbackConfirm = null, TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default, string startValue = "", InputField.LineType lineType = InputField.LineType.MultiLineSubmit, InputField.ContentType contentType = InputField.ContentType.Standard, string promptText = "Enter Text") { this.displayText.text = infoText; this.startValue = startValue; this.minTextLength = minTextLength; this.maxTextLength = maxTextLength; this.defaultErrorDisplayText = "Must be between " + minTextLength.ToString() + " and " + maxTextLength.ToString() + " characters long"; this.input.onValueChanged.AddListener(delegate { OnInputChange(); }); this.input.keyboardType = keyboardType; this.input.colors = GetColorBlock(); this.input.contentType = contentType; this.input.lineType = lineType; this.input.characterLimit = maxTextLength; this.input.SetTextWithoutNotify(startValue); this.input.placeholder.GetComponent <Text>().text = promptText; this.input.Select(); OnInputChange(); // Makes sure buttons and requirements text is properly enabled/disabled. this.cancelButton.gameObject.SetActive(allowCancel); this.callbackConfirm = callbackConfirm; }
public static void Open(UIElement focused_) { string text = ""; TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default; bool multiline = false; bool secure = false; int characterLimit = 0; if (focused_ is FrameworkElement) { switch (((FrameworkElement)focused_).InputScope) { case InputScope.Url: keyboardType = TouchScreenKeyboardType.URL; break; case InputScope.Digits: case InputScope.Number: case InputScope.NumberFullWidth: keyboardType = TouchScreenKeyboardType.NumbersAndPunctuation; break; case InputScope.TelephoneNumber: case InputScope.TelephoneLocalNumber: keyboardType = TouchScreenKeyboardType.PhonePad; break; case InputScope.AlphanumericFullWidth: case InputScope.AlphanumericHalfWidth: keyboardType = TouchScreenKeyboardType.NamePhonePad; break; case InputScope.EmailSmtpAddress: keyboardType = TouchScreenKeyboardType.EmailAddress; break; case InputScope.RegularExpression: keyboardType = TouchScreenKeyboardType.Search; break; default: keyboardType = TouchScreenKeyboardType.Default; break; } } TextBox textBox = focused_ as TextBox; PasswordBox passwordBox = focused_ as PasswordBox; if (textBox != null) { text = textBox.Text; multiline = textBox.TextWrapping == TextWrapping.Wrap && textBox.AcceptsReturn; characterLimit = textBox.MaxLength; textBox.HideCaret(); } else if (passwordBox != null) { text = passwordBox.Password; secure = true; passwordBox.HideCaret(); } #if UNITY_2018_1_OR_NEWER keyboard = TouchScreenKeyboard.Open(text, keyboardType, true, multiline, secure, false, "", characterLimit); #else keyboard = TouchScreenKeyboard.Open(text, keyboardType, true, multiline, secure, false, ""); #endif focused = focused_; undoString = text; }
public static SCKeyboardBase Open(SCKeyboardEnum sckeyboardEnum, string text, TouchScreenKeyboardType touchScreenKeyboardType, Transform parent, Vector3 position, Quaternion rotation, Vector3 scale) { if (keyboardCacheDic.ContainsKey(parent)) { Dictionary <SCKeyboardEnum, SCKeyboardBase> keyboardEnumDic = keyboardCacheDic[parent]; if (keyboardEnumDic != null && keyboardEnumDic.ContainsKey(sckeyboardEnum)) { SCKeyboardBase keyboardCache = keyboardEnumDic[sckeyboardEnum]; keyboardCache.ResetKeyboard(); keyboardCache.SetKeyboardTransform(parent, position, rotation, scale); return(keyboardCache); } } if (!keyboardTypeDic.ContainsKey(sckeyboardEnum)) { DebugMy.LogError("This SCKeyboardEnum do not exist", sckeyboardEnum); return(null); } SCKeyboardBase keyboard = Activator.CreateInstance(keyboardTypeDic[sckeyboardEnum], parent, position, rotation, scale) as SCKeyboardBase; if (!keyboardCacheDic.ContainsKey(parent)) { keyboardCacheDic[parent] = new Dictionary <SCKeyboardEnum, SCKeyboardBase>(); } keyboardCacheDic[parent][sckeyboardEnum] = keyboard; return(keyboard); }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure){}
public static TouchScreenKeyboard Open(string text, [uei.DefaultValue("TouchScreenKeyboardType.Default")] TouchScreenKeyboardType keyboardType, [uei.DefaultValue("true")] bool autocorrection, [uei.DefaultValue("false")] bool multiline, [uei.DefaultValue("false")] bool secure, [uei.DefaultValue("false")] bool alert, [uei.DefaultValue("\"\"")] string textPlaceholder, [uei.DefaultValue("0")] int characterLimit) { return(new TouchScreenKeyboard(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder, characterLimit)); }
private void Open_Private(string tText, string tTextPlaceholder, KeyboardType tKeyboardType, bool tIsMultiLine, bool tIsSecure, bool tHideInput, Action <State, string> tOnValueChaned) { // コールバックを登録する m_OnValueChanged = tOnValueChaned; // 初期の文字列を保存する m_InitialText = tText; // 現在の文字列を保存する m_ActiveText = tText; //------------------------------------------------- #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS) // 実機 TouchScreenKeyboardType tMobileKeyboardType = TouchScreenKeyboardType.Default; if (tKeyboardType == KeyboardType.Default) { tMobileKeyboardType = TouchScreenKeyboardType.Default; } else if (tKeyboardType == KeyboardType.ASCIICapable) { tMobileKeyboardType = TouchScreenKeyboardType.ASCIICapable; } else if (tKeyboardType == KeyboardType.NumbersAndPunctuation) { tMobileKeyboardType = TouchScreenKeyboardType.NumbersAndPunctuation; } else if (tKeyboardType == KeyboardType.URL) { tMobileKeyboardType = TouchScreenKeyboardType.URL; } else if (tKeyboardType == KeyboardType.NumberPad) { tMobileKeyboardType = TouchScreenKeyboardType.NumberPad; } else if (tKeyboardType == KeyboardType.PhonePad) { tMobileKeyboardType = TouchScreenKeyboardType.PhonePad; } else if (tKeyboardType == KeyboardType.NamePhonePad) { tMobileKeyboardType = TouchScreenKeyboardType.NamePhonePad; } else if (tKeyboardType == KeyboardType.EmailAddress) { tMobileKeyboardType = TouchScreenKeyboardType.EmailAddress; } TouchScreenKeyboard.hideInput = tHideInput; m_VirtualKeyboard = TouchScreenKeyboard.Open ( tText, tMobileKeyboardType, true, tIsMultiLine, tIsSecure, false, tTextPlaceholder ); #else // PC // フルスクリーンのキャンバスを生成する UICanvas tCanvas = UICanvas.CreateWithCamera(transform, 0, 0); // キャンバスのカメラを取得する Camera tCamera = tCanvas.GetCanvasCamera(); // キャンバスのカメラをかなり手前に設定する tCamera.depth = 32767; // カメラを塗りつぶさないようにする tCamera.clearFlags = CameraClearFlags.Nothing; // 全画面用のイメージを追加する UIImage tScreen = tCanvas.AddView <UIImage>("Virtaul Keyboard Screen"); tScreen.SetAnchorToStretch(); // 全画面表示にする tScreen.isMask = true; tScreen._mask.showMaskGraphic = false; Vector2 tCanvasSize = tScreen.GetCanvasSize(); float cw = tCanvasSize.x; // tCanvas._w ; float ch = tCanvasSize.y; // tCanvas._h ; // 最も基本的な縦の長さ float bw = cw; float bh = ch * 0.1f; int tFontSize = ( int )(bh * 0.4f); //--------------------------------------------------------- // 土台部分を作る UIImage tBase = tScreen.AddView <UIImage>("Base"); tBase.SetAnchorToStretchBottom(); tBase.SetPivotToCenterBottom(); if (tIsMultiLine == false) { // シングル tBase._h = bh * 2; } else { // マルチ tBase._h = bh * 6; } // テキスト入力部を作る string tOption = ""; if (tIsMultiLine == true) { tOption = "MultiLine"; } UIInputField tInputField = tBase.AddView <UIInputField>("Input", tOption); tInputField.SetAnchorToStretchTop(); tInputField.SetPivotToCenterTop(); tInputField.SetMarginX(2, 2); tInputField._y = -2; tInputField.text = tText; tInputField.placeholder.text = tTextPlaceholder; if (tIsMultiLine == false) { tInputField._h = (bh * 1) - 4; } else { tInputField._h = (bh * 5) - 4; // デフォルトでニューラインになっているのでサブミットに変える tInputField.lineType = UnityEngine.UI.InputFieldPlus.LineType.MultiLineSubmit; } tInputField.SetFontSize(tFontSize); if (tKeyboardType == KeyboardType.Default) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.Standard; } else if (tKeyboardType == KeyboardType.ASCIICapable) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.Alphanumeric; } else if (tKeyboardType == KeyboardType.NumbersAndPunctuation) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.IntegerNumber; } else if (tKeyboardType == KeyboardType.URL) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.Autocorrected; } else if (tKeyboardType == KeyboardType.NumberPad) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.DecimalNumber; } else if (tKeyboardType == KeyboardType.PhonePad) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.Pin; } else if (tKeyboardType == KeyboardType.NamePhonePad) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.Name; } else if (tKeyboardType == KeyboardType.EmailAddress) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.EmailAddress; } if (tIsSecure == true) { tInputField.contentType = UnityEngine.UI.InputFieldPlus.ContentType.Password; } // 状態が変化した際に呼び出される tInputField.SetOnValueChanged(OnValueChanged); // リターンキーによる決定時に呼び出される // tInputField.SetOnEndEditDelegate( OnEndEdit ) ; tInputField.SetOnEnterKeyPressed(OnEndEdit); // OKボタンを作る UIButton tButton_OK = tBase.AddView <UIButton>("OK"); tButton_OK.SetAnchorToLeftBottom(); tButton_OK.SetSize(bw * 0.5f - 4, bh - 4); tButton_OK.SetPosition(bw * 0.25f, bh * 0.5f); tButton_OK.AddLabel("OK", 0xFFFFFFFF, tFontSize); tButton_OK.SetOnButtonClick(OnClick); // CANCELボタンを作る UIButton tButton_Cancel = tBase.AddView <UIButton>("Cancel"); tButton_Cancel.SetAnchorToRightBottom(); tButton_Cancel.SetSize(bw * 0.5f - 4, bh - 4); tButton_Cancel.SetPosition(-bw * 0.25f, bh * 0.5f); tButton_Cancel.AddLabel("CANCEL", 0xFFFFFFFF, tFontSize); tButton_Cancel.SetOnButtonClick(OnClick); float tH = tBase._h; UITween tTweenUp = tBase.AddTween("Up"); tTweenUp.delay = 0; tTweenUp.duration = 0.25f; tTweenUp.positionEnabled = true; tTweenUp.positionEaseType = UITween.EaseType.easeOutQuad; tTweenUp.positionFromY = -tH; tTweenUp.playOnAwake = false; UITween tTweenDown = tBase.AddTween("Down"); tTweenDown.delay = 0; tTweenDown.duration = 0.25f; tTweenDown.positionEnabled = true; tTweenDown.positionEaseType = UITween.EaseType.easeOutQuad; tTweenDown.positionToY = -tH; tTweenDown.playOnAwake = false; tTweenDown.SetOnFinished((string tIdentity, UITween tTween) => { Destroy(gameObject); }); tBase.PlayTween("Up"); m_Base = tBase; #endif }
public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType, bool autocorrection){}