Example #1
0
    internal IEnumerator LoginByDefault()
    {
        _txtState.text = "Verifying account...";
        yield return(new WaitForSeconds(1));

        string deviceID     = SystemInfo.deviceUniqueIdentifier;
        int    typePlatform = 0;

#if UNITY_ANROID || UNITY_EDITOR
        typePlatform = 0;
#elif UNITY_IOS
        typePlatform = 1;
#endif
        string defaultName     = string.Format("Guest{0}", deviceID.Substring(0, 6));
        string defaultUserName = PlayerPrefs.GetString(Constant.USER_NAME);
        string defaultPassword = PlayerPrefs.GetString(Constant.PASSWORD);

        yield return(StartCoroutine(ServerAdapter.Login(defaultUserName, defaultPassword, defaultName, deviceID, typePlatform, result =>
        {
            if (result.StartsWith("Error"))
            {
                isHaveError = true;
                dataError = result;
                ShowPopupError(5);
            }
            else
            {
                ReadDataAccount(result);
            }
        })));
    }