public void SendChangeNameC2S(string name)
        {
            if (name == DataManager.GetInstance().GetPlayerNickName())
            {
                MessageDispatcher.PostMessage(MessageType.OpenAlertWindow, null, UI.AlertType.ConfirmAlone, sameName, popUpTitle);
                view.CloseChangeNameUI();
                return;
            }
            if (DataManager.GetInstance().GetPlayerDiamond() < 20)
            {
                MessageDispatcher.PostMessage(MessageType.OpenAlertWindow, null, UI.AlertType.ConfirmAlone, notEnough, popUpTitle);
                view.CloseChangeNameUI();
                return;
            }
            if (!InputUtil.IsValidInput(name))
            {
                MessageDispatcher.PostMessage(MessageType.OpenAlertWindow, null, UI.AlertType.ConfirmAlone, inputInvalid, popUpTitle);
                view.CloseChangeNameUI();
                return;
            }

            changeName = name;

            ChangeNickNameC2S message = new ChangeNickNameC2S();

            message.nickName = name;

            byte[] data = ProtobufUtils.Serialize(message);
            NetworkManager.SendRequest(MsgCode.ChangeNickNameMessage, data);
        }
Example #2
0
        private bool CheckInput(string userID, string password, string verification = "")
        {
            if (!InputUtil.IsValidInput(userID))
            {
                HandleInvalidUserID();
                return(false);
            }

            if (register && (string.IsNullOrEmpty(verification) || !password.Equals(verification)))
            {
                HandleNotMatchingPasswords();
                return(false);
            }

            string passwordError;

            if (!Utils.InputUtil.IsValidPassword(password, userID, out passwordError))
            {
                if (string.IsNullOrEmpty(passwordError))
                {
                    passwordError = "密码应大于6个字符";
                }

                HandleInvalidPassword(passwordError);
                return(false);
            }
            return(true);
        }
Example #3
0
 private void OnClickCreateButton()
 {
     if (!InputUtil.IsValidInput(nameText.text) || currChosenAvatar < 0)
     {
         return;
     }
     controller.SendRegisterChoice(nameText.text, ActiveAvatar);
 }
Example #4
0
        private void NameInputValueChange(string input)
        {
            bool nameApproved = InputUtil.IsValidInput(input);

            SetCreateButton(nameApproved);
        }