Exemple #1
0
 // Token: 0x06001A2F RID: 6703 RVA: 0x00089B88 File Offset: 0x00087D88
 public TrainingRoom()
 {
     GameState.Current.MatchState.RegisterState(GameStateId.PregameLoadout, new PregameLoadoutState(GameState.Current.MatchState));
     GameState.Current.MatchState.RegisterState(GameStateId.MatchRunning, new OfflineMatchState(GameState.Current.MatchState));
     GameState.Current.PlayerState.RegisterState(PlayerStateId.Playing, new PlayerPlayingState(GameState.Current.PlayerState));
     GameState.Current.PlayerState.RegisterState(PlayerStateId.Killed, new PlayerKilledOfflineState(GameState.Current.PlayerState));
     GameState.Current.PlayerState.RegisterState(PlayerStateId.Paused, new PlayerPausedState(GameState.Current.PlayerState));
     GameState.Current.PlayerState.RegisterState(PlayerStateId.Overview, new PlayerOverviewState(GameState.Current.PlayerState));
     GameState.Current.Actions.KillPlayer = delegate()
     {
         if (GameState.Current.IsInGame)
         {
             GameState.Current.PlayerKilled(0, PlayerDataManager.Cmid, (UberstrikeItemClass)0, (BodyPart)0, Vector3.zero);
         }
     };
     GameState.Current.Actions.ExplosionHitDamage = delegate(int targetCmid, ushort damage, Vector3 force, byte slot, byte distance)
     {
         GameStateHelper.PlayerHit(targetCmid, damage, BodyPart.Body, force);
         if (GameState.Current.PlayerData.Health <= 0)
         {
             GameState.Current.PlayerData.Set(PlayerStates.Dead, true);
             GameState.Current.PlayerKilled(targetCmid, targetCmid, Singleton <WeaponController> .Instance.GetCurrentWeapon().View.ItemClass, BodyPart.Body, force);
         }
     };
     GameState.Current.Actions.JoinTeam = delegate(TeamID team)
     {
         GameActorInfo gameActorInfo = new GameActorInfo
         {
             Cmid      = PlayerDataManager.Cmid,
             SkinColor = PlayerDataManager.SkinColor
         };
         GameState.Current.PlayerData.Player           = gameActorInfo;
         GameState.Current.Players[gameActorInfo.Cmid] = gameActorInfo;
         GameState.Current.InstantiateAvatar(gameActorInfo);
         GameState.Current.MatchState.SetState(GameStateId.MatchRunning);
         UnityRuntime.StartRoutine(this.ShowTrainingGameMessages());
     };
     TabScreenPanelGUI.SortPlayersByRank = new Action <IEnumerable <GameActorInfo> >(GameStateHelper.SortDeathMatchPlayers);
     AutoMonoBehaviour <UnityRuntime> .Instance.OnUpdate += this.OnUpdate;
     GameStateHelper.EnterGameMode();
     GameState.Current.MatchState.SetState(GameStateId.PregameLoadout);
 }
Exemple #2
0
    // Token: 0x06001A3E RID: 6718 RVA: 0x0008A1DC File Offset: 0x000883DC
    public TryInShopRoom()
    {
        GameState.Current.MatchState.RegisterState(GameStateId.MatchRunning, new OfflineMatchState(GameState.Current.MatchState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Playing, new PlayerPlayingState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Paused, new PlayerPausedState(GameState.Current.PlayerState));
        GameState.Current.Actions.DirectHitDamage = delegate(int targetCmid, ushort damage, BodyPart part, Vector3 force, byte slot, byte bullets)
        {
            GameState.Current.Player.MoveController.ApplyForce(force, CharacterMoveController.ForceType.Additive);
        };
        AutoMonoBehaviour <UnityRuntime> .Instance.OnUpdate += this.OnUpdate;
        GameStateHelper.EnterGameMode();
        GameActorInfo gameActorInfo = new GameActorInfo
        {
            Cmid      = PlayerDataManager.Cmid,
            SkinColor = PlayerDataManager.SkinColor
        };

        GameState.Current.PlayerData.Player           = gameActorInfo;
        GameState.Current.Players[gameActorInfo.Cmid] = gameActorInfo;
        GameState.Current.InstantiateAvatar(gameActorInfo);
        MenuPageManager.Instance.UnloadCurrentPage();
        GameState.Current.MatchState.SetState(GameStateId.MatchRunning);
    }
    // Token: 0x060019A5 RID: 6565 RVA: 0x0008836C File Offset: 0x0008656C
    protected override void OnRoomEntered(GameRoomData data)
    {
        Debug.Log("OnRoomJoined " + this.lastRoomJoined);
        GameState.Current.Reset();
        PopupSystem.ClearAll();
        this.lastRoomJoined = data.Number;
        GameState.Current.ResetRoundStartTime();
        base.Peer.FetchServerTimestamp();
        switch (data.GameMode)
        {
        case GameModeType.DeathMatch:
        {
            DeathMatchRoom gameMode = new DeathMatchRoom(data, this);
            Singleton <GameStateController> .Instance.SetGameMode(gameMode);

            this.currentRoom = gameMode;
            break;
        }

        case GameModeType.TeamDeathMatch:
        {
            TeamDeathMatchRoom gameMode2 = new TeamDeathMatchRoom(data, this);
            Singleton <GameStateController> .Instance.SetGameMode(gameMode2);

            this.currentRoom = gameMode2;
            break;
        }

        case GameModeType.EliminationMode:
        {
            TeamEliminationRoom gameMode3 = new TeamEliminationRoom(data, this);
            Singleton <GameStateController> .Instance.SetGameMode(gameMode3);

            this.currentRoom = gameMode3;
            break;
        }

        default:
            throw new NotImplementedException("GameMode not supported: " + data.GameMode);
        }
        base.AddRoomLogic(this.currentRoom, this.currentRoom.Operations);
        UberstrikeMap mapWithId = Singleton <MapManager> .Instance.GetMapWithId(data.MapID);

        if (mapWithId != null)
        {
            Singleton <MapManager> .Instance.LoadMap(mapWithId, delegate
            {
                GameStateHelper.EnterGameMode();
                GameState.Current.MatchState.SetState(GameStateId.PregameLoadout);
                foreach (GameActorInfo gameActorInfo in GameState.Current.Players.Values)
                {
                    if (!gameActorInfo.IsSpectator)
                    {
                        GameState.Current.InstantiateAvatar(gameActorInfo);
                    }
                }
                this.currentRoom.Operations.SendPowerUpRespawnTimes(PickupItem.GetRespawnDurations());
                List <Vector3> positions;
                List <byte> rotations;
                Singleton <SpawnPointManager> .Instance.GetAllSpawnPoints(data.GameMode, TeamID.NONE, out positions, out rotations);
                this.currentRoom.Operations.SendSpawnPositions(TeamID.NONE, positions, rotations);
                Singleton <SpawnPointManager> .Instance.GetAllSpawnPoints(data.GameMode, TeamID.RED, out positions, out rotations);
                this.currentRoom.Operations.SendSpawnPositions(TeamID.RED, positions, rotations);
                Singleton <SpawnPointManager> .Instance.GetAllSpawnPoints(data.GameMode, TeamID.BLUE, out positions, out rotations);
                this.currentRoom.Operations.SendSpawnPositions(TeamID.BLUE, positions, rotations);
                global::AvatarBuilder.UpdateLocalAvatar(Singleton <LoadoutManager> .Instance.Loadout.GetAvatarGear());
                GameState.Current.RoomData = data;
                AutoMonoBehaviour <CommConnectionManager> .Instance.Client.Lobby.Operations.SendUpdatePlayerRoom(new GameRoom
                {
                    Server = new ConnectionAddress(data.Server.ConnectionString),
                    Number = data.Number,
                    MapId  = data.MapID
                });
            });
        }
        else
        {
            Debug.LogError("Map not found");
        }
    }