public void OnSceneGUI() { bool wasChange = false; tk2dUITextInput textInput = (tk2dUITextInput)target; if (textInput.inputLabel == null) { return; } // Get rescaled transforms Matrix4x4 m = textInput.inputLabel.transform.localToWorldMatrix; Vector3 right = m.MultiplyVector(Vector3.right); float newFieldLength = tk2dUIControlsHelperEditor.DrawLengthHandles("Field Length", textInput.fieldLength, textInput.inputLabel.transform.position, right, Color.red, -.1f, .25f, 0); if (newFieldLength != textInput.fieldLength) { tk2dUndo.RecordObject(textInput, "Field length changed"); textInput.fieldLength = newFieldLength; wasChange = true; } if (wasChange) { EditorUtility.SetDirty(textInput); } }
void saveButtonClicked() { string nameUser = ScoreUtils.DEFAULT_STR_PLAYER_NAME; foreach (GameObject buttonGO in buttonsPlayerNameGO) { if (buttonGO.name.Equals(NameUtils.NAME_INPUT_LEADERBOARD)) { tk2dUITextInput textInput = buttonGO.GetComponent <tk2dUITextInput>(); nameUser = textInput.Text; if (nameUser.Length < ScoreUtils.TOTAL_CHARACTERS_NAME) { Debug.Log(nameUser); return; } nameUser = nameUser.ToUpper(); } } foreach (GameObject buttonGO in buttonsGO) { buttonGO.SetActive(true); } foreach (GameObject buttonGO in buttonsPlayerNameGO) { buttonGO.SetActive(false); } ScoreUtils.addUserLeaderboard(nameUser, score, position, leaderboard); }
public override void OnInspectorGUI() { tk2dGuiUtility.LookLikeInspector(); base.OnInspectorGUI(); tk2dUITextInput textInput = (tk2dUITextInput)target; textInput.LayoutItem = EditorGUILayout.ObjectField("LayoutItem", textInput.LayoutItem, typeof(tk2dUILayout), true) as tk2dUILayout; tk2dUIMethodBindingHelper methodBindingUtil = new tk2dUIMethodBindingHelper(); textInput.SendMessageTarget = methodBindingUtil.BeginMessageGUI(textInput.SendMessageTarget); methodBindingUtil.MethodBinding("On Text Change", typeof(tk2dUITextInput), textInput.SendMessageTarget, ref textInput.SendMessageOnTextChangeMethodName); methodBindingUtil.EndMessageGUI(); if (GUI.changed) { tk2dUtil.SetDirty(textInput); } }
void InitServerDisplay() { if (serverChatObject) { tk2dUITextInput serverDisplayScript = serverChatObject.GetComponent <tk2dUITextInput>(); serverDisplayScript.Text = "Server message: Game Started.\nEnjoy!"; } }
public void DisplayKillMessage(string killMessage) { Debug.Log("KILL MESSAGE IS: " + killMessage); if (serverChatObject) { tk2dUITextInput serverDisplayScript = serverChatObject.GetComponent <tk2dUITextInput>(); serverDisplayScript.Text = killMessage; } }
public override void Enter() { switch (focusIndex) { case 0: showKeyboardCall(7, false); curInput = userTextInput; break; case 1: showKeyboardCall(6.17f, false); curInput = pwdTextInput; break; case 2: if (userTextInput.Text != WXProtocol.userName || pwdTextInput.Text != WXProtocol.userPwd) { if (userTextInput.Text == "") { WXLoginInfoPanel.instance.Tips("请输入用户名"); return; } if (pwdTextInput.Text.Length < 6 || pwdTextInput.Text.Length > 12) { WXLoginInfoPanel.instance.Tips("密码请设置为6-12位"); return; } loadingCall(true); WXProtocol.instance.login.ChangeUserAndPwd(userTextInput.Text, pwdTextInput.Text, (d) => { loadingCall(false); if (d.success) { WXLoginInfoPanel.instance.Tips("修改用户名密码成功!"); } else { WXLoginInfoPanel.instance.Tips(d.reason); } }); } else { WXLoginInfoPanel.instance.Tips("你可以修改用户名密码后按OK键更改"); } break; case 3: refreshText = true; break; } }
private void Start() { if (this.textInput == null) { this.textInput = base.GetComponent<tk2dUITextInput>(); } this.textInput.OnTextChange = (Action<tk2dUITextInput>) Delegate.Combine(this.textInput.OnTextChange, new Action<tk2dUITextInput>(this.OnTextChange)); this.isPassword = this.textInput.isPasswordField; if (!string.IsNullOrEmpty(this.emptyGuideKey)) { this.textInput.emptyDisplayText = Localization.Localize(this.emptyGuideKey); this.textInput.emptyDisplayLabel.color = Color.gray; this.textInput.emptyDisplayLabel.text = this.textInput.emptyDisplayText; this.textInput.emptyDisplayLabel.Commit(); } }
void ToogleChatDisplay() { if (isChatMode) { tk2dUITextInput textboxScript = chatTextboxObject.GetComponent <tk2dUITextInput>(); string userInput = textboxScript.Text; // Send chat to server sceneManager.SendChatToServer(userInput); textboxScript.Text = ""; chatTextboxObject.SetActive(false); setVisibleOnce = 0; isChatMode = false; } else { chatTextboxObject.SetActive(true); tk2dUITextInput textboxScript = chatTextboxObject.GetComponent <tk2dUITextInput>(); textboxScript.SetFocus(); isChatMode = true; } }
private void OnTextChange(tk2dUITextInput input) { input.Text = this.StripIllegalChars(input.Text); }
public override void Enter() { base.Enter(); switch (focusIndex) { case 0: curInput = userTextInput; showKeyboardCall(7, false); break; case 1: curInput = pwdTextInput; showKeyboardCall(6.17f, false); break; case 2: loadingCall(true); if (userTextInput.Text == "" && pwdTextInput.Text == "") { WXProtocol.instance.login.SwitchUser(WXProtocol.macUID, (data) => { if (data.success) { switchComplete(data.data); WXLoginInfoPanel.instance.Tips("切换用户成功!"); } else { WXLoginInfoPanel.instance.Tips(data.reason); } loadingCall(false); }); } else if (userTextInput.Text != "") { WXProtocol.instance.login.SwitchUser(userTextInput.Text, pwdTextInput.Text, (data) => { if (data.success) { switchComplete(data.data); WXLoginInfoPanel.instance.Tips("切换用户成功!"); userTextInput.Text = ""; pwdTextInput.Text = ""; } else { WXLoginInfoPanel.instance.Tips(data.reason); } loadingCall(false); }); } else { WXLoginInfoPanel.instance.Tips("请填写用户名及密码"); } break; case 3: pwdTextInput.Text = userTextInput.Text = ""; break; } }