示例#1
0
        public MissionMatchHistoryComponent()
        {
            this._recordedHistory = false;
            this.LoadMatchhHistory();
            MatchInfo matchInfo;

            if (MatchHistory.TryGetMatchInfo(NetworkMain.GameClient.CurrentMatchId, out matchInfo))
            {
                this._matchInfo = matchInfo;
            }
            else
            {
                this._matchInfo         = new MatchInfo();
                this._matchInfo.MatchId = NetworkMain.GameClient.CurrentMatchId;
            }
            this._matchInfo.MatchDate = DateTime.Now;
        }
示例#2
0
 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();
 }
示例#3
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;
        }
示例#4
0
 private async void LoadMatchhHistory() => await MatchHistory.LoadMatchHistory();