Example #1
0
    public void ChangeNameHero()
    {
        string newName = _nameHero.text;

        if (!string.IsNullOrEmpty(newName) && newName.Length >= 6 && newName.Length <= 20)
        {
            StartCoroutine(ServerAdapter.ChangeName(newName, CharacterInfo._instance._baseProperties.idCodeHero, CharacterInfo._instance._baseProperties.idHero, result =>
            {
                if (result.StartsWith("Error"))
                {
                    MainMenuUI._instance.ShowErrorPopup(9);
                }
                else
                {
                    SplitDataFromServe._heroCurrentPLay.name     = newName;
                    CharacterInfo._instance._baseProperties.name = newName;
                    _changeNamePanel.SetActive(false);
                    nameText.text = CharacterInfo._instance._baseProperties.name.ToString();
                    this.PostEvent(EventID.OnPropertiesChange);
                    //SplitDataFromServe.ReadInitData(result);
                }
            }));
        }
        else
        {
            MainMenuUI._instance.ShowErrorPopup(8);
        }
    }