コード例 #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);
 }
コード例 #2
0
    // Token: 0x060019C7 RID: 6599 RVA: 0x0008899C File Offset: 0x00086B9C
    public TeamDeathMatchRoom(GameRoomData gameData, GamePeer peer)
    {
        GameState.Current.MatchState.RegisterState(GameStateId.MatchRunning, new MatchRunningState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.PregameLoadout, new PregameLoadoutState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.PrepareNextRound, new PrepareNextRoundState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.EndOfMatch, new EndOfMatchState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.WaitingForPlayers, new WaitingForPlayersState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.AfterRound, new AfterRoundState(GameState.Current.MatchState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Overview, new PlayerOverviewState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Playing, new PlayerPlayingState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.PrepareForMatch, new PlayerPrepareState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Killed, new PlayerKilledState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Paused, new PlayerPausedState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.AfterRound, new PlayerAfterRoundState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Spectating, new PlayerSpectatingState(GameState.Current.PlayerState));
        GameState.Current.PlayerData.SendJumpUpdate     += base.Operations.SendJump;
        GameState.Current.PlayerData.SendMovementUpdate += base.Operations.SendUpdatePositionAndRotation;
        GameState.Current.RoomData                       = gameData;
        GameState.Current.Actions.ChangeTeam             = new Action(base.Operations.SendSwitchTeam);
        GameState.Current.Actions.IncreaseHealthAndArmor = delegate(int health, int armor)
        {
            base.Operations.SendIncreaseHealthAndArmor((byte)health, (byte)armor);
        };
        GameState.Current.Actions.RequestRespawn = new Action(base.Operations.SendRespawnRequest);
        GameState.Current.Actions.PickupPowerup  = delegate(int pickupID, PickupItemType type, int value)
        {
            base.Operations.SendPowerUpPicked(pickupID, (byte)type, (byte)value);
        };
        GameState.Current.Actions.OpenDoor       = new Action <int>(base.Operations.SendOpenDoor);
        GameState.Current.Actions.EmitQuickItem  = new Action <Vector3, Vector3, int, byte, int>(base.Operations.SendEmitQuickItem);
        GameState.Current.Actions.EmitProjectile = delegate(Vector3 origin, Vector3 direction, global::LoadoutSlotType slot, int projectileID, bool explode)
        {
            base.Operations.SendEmitProjectile(origin, direction, (byte)slot, projectileID, explode);
        };
        GameState.Current.Actions.RemoveProjectile = new Action <int, bool>(base.Operations.SendRemoveProjectile);
        GameState.Current.Actions.SingleBulletFire = new Action(base.Operations.SendSingleBulletFire);
        GameState.Current.Actions.KillPlayer       = delegate()
        {
            if (GameState.Current.IsInGame && GameState.Current.PlayerData.IsAlive)
            {
                base.Operations.SendDirectDeath();
            }
        };
        GameState.Current.Actions.DirectHitDamage = delegate(int targetCmid, ushort damage, BodyPart part, Vector3 force, byte slot, byte bullets)
        {
            base.Operations.SendDirectHitDamage(targetCmid, (byte)part, bullets, slot);
            if (PlayerDataManager.Cmid == targetCmid)
            {
                GameStateHelper.PlayerHit(targetCmid, damage, part, force);
            }
        };
        GameState.Current.Actions.ExplosionHitDamage = delegate(int targetCmid, ushort damage, Vector3 force, byte slot, byte distance)
        {
            base.Operations.SendExplosionDamage(targetCmid, slot, distance, force);
            if (PlayerDataManager.Cmid == targetCmid)
            {
                GameStateHelper.PlayerHit(targetCmid, damage, BodyPart.Body, force);
            }
        };
        GameState.Current.Actions.PlayerHitFeeback  = new Action <int, Vector3>(base.Operations.SendHitFeedback);
        GameState.Current.Actions.ActivateQuickItem = new Action <QuickItemLogic, int, int, bool>(base.Operations.SendActivateQuickItem);
        GameState.Current.Actions.JoinTeam          = delegate(TeamID team)
        {
            base.Operations.SendJoinGame(team);
            GameState.Current.MatchState.PopAllStates();
        };
        GameState.Current.Actions.JoinAsSpectator = delegate()
        {
            base.Operations.SendJoinAsSpectator();
            GameState.Current.MatchState.PopAllStates();
        };
        GameState.Current.Actions.KickPlayer  = new Action <int>(base.Operations.SendKickPlayer);
        GameState.Current.Actions.ChatMessage = new Action <string, byte>(base.Operations.SendChatMessage);
        GameState.Current.PlayerData.Actions.Clear();
        PlayerActions actions = GameState.Current.PlayerData.Actions;

        actions.UpdateKeyState = (Action <byte>)Delegate.Combine(actions.UpdateKeyState, new Action <byte>(peer.Operations.SendUpdateKeyState));
        PlayerActions actions2 = GameState.Current.PlayerData.Actions;

        actions2.SwitchWeapon = (Action <byte>)Delegate.Combine(actions2.SwitchWeapon, new Action <byte>(base.Operations.SendSwitchWeapon));
        PlayerActions actions3 = GameState.Current.PlayerData.Actions;

        actions3.UpdatePing = (Action <ushort>)Delegate.Combine(actions3.UpdatePing, new Action <ushort>(peer.Operations.SendUpdatePing));
        PlayerActions actions4 = GameState.Current.PlayerData.Actions;

        actions4.PausePlayer = (Action <bool>)Delegate.Combine(actions4.PausePlayer, new Action <bool>(base.Operations.SendIsPaused));
        PlayerActions actions5 = GameState.Current.PlayerData.Actions;

        actions5.SniperMode = (Action <bool>)Delegate.Combine(actions5.SniperMode, new Action <bool>(base.Operations.SendIsInSniperMode));
        PlayerActions actions6 = GameState.Current.PlayerData.Actions;

        actions6.AutomaticFire = (Action <bool>)Delegate.Combine(actions6.AutomaticFire, new Action <bool>(base.Operations.SendIsFiring));
        PlayerActions actions7 = GameState.Current.PlayerData.Actions;

        actions7.SetReadyForNextGame        = (Action <bool>)Delegate.Combine(actions7.SetReadyForNextGame, new Action <bool>(base.Operations.SendIsReadyForNextMatch));
        TabScreenPanelGUI.SortPlayersByRank = new Action <IEnumerable <GameActorInfo> >(GameStateHelper.SortTeamMatchPlayers);
        Singleton <QuickItemController> .Instance.IsConsumptionEnabled  = true;
        Singleton <QuickItemController> .Instance.Restriction.IsEnabled = true;
        Singleton <QuickItemController> .Instance.Restriction.RenewGameUses();

        AutoMonoBehaviour <UnityRuntime> .Instance.OnUpdate += this.OnUpdate;
        global::EventHandler.Global.AddListener <GlobalEvents.InputChanged>(new Action <GlobalEvents.InputChanged>(this.OnInputChangeEvent));
    }