Exemple #1
0
        protected override void DoUpdate(SAMTime gameTime, InputState istate)
        {
            if (_isDying || !Alive)
            {
                return;
            }

            _server.Update(gameTime, istate);

            if (_server.Mode == SAMNetworkConnection.ServerMode.Error)
            {
                Owner.HUD.ShowToast(null, L10NImpl.FormatNetworkErrorMessage(_server.Error, _server.ErrorData), 32, FlatColors.Flamingo, FlatColors.Foreground, 7f);

                Remove();
                return;
            }

            if (_server.Mode == SAMNetworkConnection.ServerMode.Stopped)
            {
                Remove();
            }

            if (_server.Mode == SAMNetworkConnection.ServerMode.InLobby)
            {
                _doNotStop = true;
                Remove();
                Owner.HUD.AddModal(new MultiplayerClientLobbyPanel(_server), true, 0.5f);
            }
        }
        protected override void DoUpdate(SAMTime gameTime, InputState istate)
        {
            if (_isDying || !Alive)
            {
                return;
            }

            Server.Update(gameTime, istate);

            if (Server.Mode == SAMNetworkConnection.ServerMode.Error)
            {
                Owner.HUD.ShowToast(null, L10NImplHelper.FormatNetworkErrorMessage(Server.Error, Server.ErrorData), 32, FlatColors.Flamingo, FlatColors.Foreground, 7f);

                switch (Server.Error)
                {
                case SAMNetworkConnection.ErrorType.SessionNotFound:
                case SAMNetworkConnection.ErrorType.AuthentificationFailed:
                case SAMNetworkConnection.ErrorType.LobbyFull:
                case SAMNetworkConnection.ErrorType.GameVersionMismatch:
                    _isDying = true;
                    AddOperation(new JoinErrorOperation());
                    return;

                case SAMNetworkConnection.ErrorType.BluetoothNotEnabled:
                case SAMNetworkConnection.ErrorType.P2PConnectionFailed:
                case SAMNetworkConnection.ErrorType.P2PConnectionLost:
                case SAMNetworkConnection.ErrorType.NetworkMediumInternalError:
                case SAMNetworkConnection.ErrorType.ProxyServerTimeout:
                case SAMNetworkConnection.ErrorType.UserTimeout:
                case SAMNetworkConnection.ErrorType.ServerUserTimeout:
                case SAMNetworkConnection.ErrorType.NotInLobby:
                case SAMNetworkConnection.ErrorType.LevelNotFound:
                case SAMNetworkConnection.ErrorType.LevelVersionMismatch:
                case SAMNetworkConnection.ErrorType.UserDisconnect:
                case SAMNetworkConnection.ErrorType.ServerDisconnect:
                case SAMNetworkConnection.ErrorType.BluetoothAdapterNotFound:
                case SAMNetworkConnection.ErrorType.BluetoothAdapterNoPermission:
                case SAMNetworkConnection.ErrorType.P2PNoServerConnection:
                    Remove();
                    return;

                case SAMNetworkConnection.ErrorType.None:
                default:
                    SAMLog.Error("MJLS::EnumSwitch_DU", "value = " + Server.Error);
                    break;
                }
            }

            if (Server.Mode == SAMNetworkConnection.ServerMode.Stopped)
            {
                Remove();
            }

            if (Server.Mode == SAMNetworkConnection.ServerMode.InLobby)
            {
                _doNotStop = true;
                Remove();
                Owner.HUD.AddModal(new MultiplayerClientLobbyPanel(Server), true, 0.5f);
            }
        }
        protected override void OnUpdate(SAMTime gameTime, InputState istate)
        {
            base.OnUpdate(gameTime, istate);

#if DEBUG
            DebugUtils.TIMING_NETWORK.Start();
            _server.Update(gameTime, istate);
            DebugUtils.TIMING_NETWORK.Stop();
#else
            _server.Update(gameTime, istate);
#endif

            if (_server.Mode == SAMNetworkConnection.ServerMode.Error)
            {
                HUD.ShowToast("SCRNSC::ERR", L10NImpl.FormatNetworkErrorMessage(_server.Error, _server.ErrorData), 32, FlatColors.Flamingo, FlatColors.Foreground, 7f);

                MainGame.Inst.SetOverworldScreen();
            }
        }
Exemple #4
0
        protected override void DoUpdate(SAMTime gameTime, InputState istate)
        {
            _server.Update(gameTime, istate);

            if (skipUpdate)
            {
                return;
            }

            if (_server.LevelID != null && _server.LevelID.Value != _lastLevelID)
            {
                _lastLevelID = _server.LevelID.Value;

                LevelBlueprint bp;
                if (Levels.LEVELS.TryGetValue(_server.LevelID.Value, out bp))
                {
                    var d = GetFractionColorByID(bp, _server.SessionUserID + 1);
                    fracName = d.Item1;
                    _lblFraction.TextColor = d.Item2;
                }
            }

            if (_server.Mode == SAMNetworkConnection.ServerMode.Error)
            {
                Remove();

                Owner.HUD.ShowToast(null, L10NImpl.FormatNetworkErrorMessage(_server.Error, _server.ErrorData), 32, FlatColors.Flamingo, FlatColors.Foreground, 7f);
                skipUpdate = true;
            }

            if (_server.Mode == SAMNetworkConnection.ServerMode.Stopped)
            {
                Remove();
            }

            if (_server.Mode == SAMNetworkConnection.ServerMode.InGame)
            {
                MainGame.Inst.SetMultiplayerClientLevelScreen(Levels.LEVELS[_server.LevelID.Value], _server.Speed.Value, _server.MusicIndex.Value, _server);
                skipUpdate = true;
            }
        }