public override void OnRemoveBehaviour() { if (!this._recordedHistory) { this._matchInfo.WinnerTeam = -1; MissionScoreboardComponent missionBehaviour = this.Mission.GetMissionBehaviour <MissionScoreboardComponent>(); if (missionBehaviour != null) { int roundScore1 = missionBehaviour.GetRoundScore(BattleSideEnum.Attacker); int roundScore2 = missionBehaviour.GetRoundScore(BattleSideEnum.Defender); this._matchInfo.AttackerScore = roundScore1; this._matchInfo.DefenderScore = roundScore2; } MatchHistory.AddMatch(this._matchInfo); MatchHistory.Serialize(); this._recordedHistory = true; } MissionPeer.OnTeamChanged -= new MissionPeer.OnTeamChangedDelegate(this.TeamChange); base.OnRemoveBehaviour(); }
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; }