Exemple #1
0
 private void HandleServerEventMissionStateChange(MissionStateChange message)
 {
     this.CurrentMultiplayerState = message.CurrentState;
     if (this.CurrentMultiplayerState != MissionLobbyComponent.MultiplayerGameState.WaitingFirstPlayers)
     {
         if (this.CurrentMultiplayerState == MissionLobbyComponent.MultiplayerGameState.Playing && this._warmupComponent != null)
         {
             this.Mission.RemoveMissionBehaviour((MissionBehaviour)this._warmupComponent);
             this._warmupComponent = (MultiplayerWarmupComponent)null;
         }
         float duration = this.CurrentMultiplayerState == MissionLobbyComponent.MultiplayerGameState.Playing ? (float)(MultiplayerOptions.OptionType.MapTimeLimit.GetIntValue() * 60) : 5f;
         this._timerComponent.StartTimerAsClient(message.StateStartTimeInSeconds, duration);
     }
     if (this.CurrentMultiplayerState != MissionLobbyComponent.MultiplayerGameState.Ending)
     {
         return;
     }
     this.SetStateEndingAsClient();
 }
Exemple #2
0
        private void HandleServerEventMissionStateChange(MissionStateChange message)
        {
            if (message.CurrentState != MissionLobbyComponent.MultiplayerGameState.Ending || this._recordedHistory)
            {
                return;
            }
            MissionScoreboardComponent missionBehaviour = this.Mission.GetMissionBehaviour <MissionScoreboardComponent>();

            if (missionBehaviour != null)
            {
                int roundScore1 = missionBehaviour.GetRoundScore(BattleSideEnum.Attacker);
                int roundScore2 = missionBehaviour.GetRoundScore(BattleSideEnum.Defender);
                this._matchInfo.WinnerTeam    = roundScore1 > roundScore2 ? 0 : (roundScore1 == roundScore2 ? -1 : 1);
                this._matchInfo.AttackerScore = roundScore1;
                this._matchInfo.DefenderScore = roundScore2;
            }
            MatchHistory.AddMatch(this._matchInfo);
            MatchHistory.Serialize();
            this._recordedHistory = true;
        }