示例#1
0
        private void OnDesync(string message, uint status, ProtocolResult result)
        {
            ServerAPI serverAPI = Service.ServerAPI;

            if (result == ProtocolResult.Match)
            {
                string title = null;
                Lang   lang  = Service.Lang;
                if (this.hasSecondary && serverAPI.GetDispatcher().Url.StartsWith("https://starts-integration-prod.disney.io/starts") && message.StartsWith(lang.Get(LangUtils.DESYNC_BATCH_MAX_RETRY, new object[0])))
                {
                    title   = lang.Get("UPDATE_COMING_TITLE", new object[0]);
                    message = lang.Get("UPDATE_COMING_MESSAGE", new object[0]);
                    Service.Logger.Warn("Maintenance message shown due to client update before server deploy");
                }
                if (status != 1999u)
                {
                    AlertScreen.ShowModalWithBI(true, title, message, message);
                }
                this.KillStartup();
                return;
            }
            if (this.isHandlingMismatch)
            {
                return;
            }
            this.isHandlingMismatch = true;
            this.protocolResult     = result;
            if (result == ProtocolResult.Higher && !serverAPI.GetDispatcher().Url.StartsWith("https://starts-integration-prod.disney.io/starts") && this.hasSecondary && this.isAttemptingAuth)
            {
                Service.Logger.WarnFormat("Trying secondary API due to higher protocol", new object[0]);
                if (this.getAuthTokenCommand != null)
                {
                    this.getAuthTokenCommand.RemoveAllCallbacks();
                }
                if (this.generatePlayerCommand != null)
                {
                    this.generatePlayerCommand.RemoveAllCallbacks();
                }
                serverAPI.SetDispatcher("https://starts-integration-prod.disney.io/starts", Service.Engine);
                this.GetOrCreatePlayer();
                return;
            }
            IState currentState = Service.GameStateMachine.CurrentState;

            if (currentState is BattleStartState || currentState is BattlePlayState || currentState is BattleEndState)
            {
                this.isHandlingMismatch = false;
                return;
            }
            if (result != ProtocolResult.Higher)
            {
                if (result == ProtocolResult.Lower)
                {
                    Service.Logger.Warn(message);
                }
            }
            else
            {
                Service.Logger.Error(message);
            }
            this.DisplayUpdateWindow();
        }