Exemplo n.º 1
0
        // --------------------------------------------------------------------------------------------
        private void AccountManager_AuthenticatedSuccessfully(object sender, AccountManager.AuthenticatedSuccessfullyEventArgs e)
        {
            UserData copy = LocalUserData;

            string displayName = e.accountData.playerProfileModel.DisplayName;

            if (!string.IsNullOrEmpty(displayName))
            {
                copy.name = displayName;
            }

            LocalUserData = copy;
        }
Exemplo n.º 2
0
        // --------------------------------------------------------------------------------------------
        private void AccountManager_AuthenticatedSuccessfully(object sender, AccountManager.AuthenticatedSuccessfullyEventArgs e)
        {
            Debug.Log("authenticated succesfully");

            if (e.accountData.titleData.TryGetValue("required_version", out string versionString))
            {
                if (Version.IsValid(versionString, AppVersion))
                {
                    ClientState = EClientState.Valid;
                }
                else
                {
                    ClientState = EClientState.NeedsUpdate;
                }
            }
            else
            {
                ClientState = EClientState.ValidationError;
                throw new System.Exception($"the key required_version wasn't found in the title data");
            }

            if (e.accountData.titleData.TryGetValue("game_config", out string serializedConfig))
            {
                // TODO: Does it matter to remove these characters? It makes the default config unreadable...
                //serializedConfig = serializedConfig.Replace(" ", "");
                //serializedConfig = serializedConfig.Replace("\t", "");
                //serializedConfig = serializedConfig.Replace("\r", "");
                //serializedConfig = serializedConfig.Replace("\n", "");

                Config = new Config(serializedConfig, true);
            }
            else
            {
                Debug.LogError("the key game_config wasn't found in the title data");
                Config = Config.DefaultConfig();
            }
        }