Ejemplo n.º 1
0
        // 名前入力
        void Validate(GameObject obj)
        {
            var com = obj.GetComponent <InputField>();

            Debug.Log(com.text);
            // 名前を検証
            var userName = new Liver.UserName();

            if (!userName.Validate(com.text))
            {
                Debug.Log("No use this id.");
            }
        }
Ejemplo n.º 2
0
        public override void OnClickButtonEvent(Transform button)
        {
            switch (button.name)
            {
            case "OkButton":
                var  nameChk     = new Liver.UserName();
                bool nameSuccess = nameChk.Validate(this.isNew ? this.NewNameInput.text : this.NameInput.text);

                if (this.isNew)
                {
                    this.ErrorNewText.gameObject.SetActive(!nameSuccess);
                }
                else
                {
                    this.ErrorChangeText.gameObject.SetActive(!nameSuccess);
                }

                if (!nameSuccess)
                {
                    break;
                }

                var playerName = this.isNew ? NewNameInput.text : NameInput.text;
                PlayerDataManager.PlayerData.SetPlayerName(playerName);
                StartCoroutine(
                    Tsl.Network.GameServer.Instance.SignUpCoroutine(PlayerDataManager.PlayerData, (r) =>
                {
                    Debug.Log(string.Format("SignUp Accepted? ({0})", r.Accepted));
                }));

                if (this.isNew)
                {
                    this.BaseScene.ChangeScene("Menu", 1.0f);
                }
                else
                {
                    onClose();
                }

                break;

            case "CloseButton":
                onClose();
                break;

            default:
                base.OnClickButtonEvent(button);
                break;
            }
        }