Ejemplo n.º 1
0
        void MatchStarted_Event(object sender, MatchStartedEventArgs e)
        {
            parser.RoundStart += RoundStarted_Event;

            if (_matchInformation != null)
            {
                MatchData.MatchNumber = _matchInformation.matchid;
            }

            parser.Participants.Where(i => i.Name != "GOTV").ToList().ForEach(i => MatchData.Players.Add(i.SteamID, new Models.Player {
                SteamId = i.SteamID, Name = i.Name, Team = (i.Team == DemoInfo.Team.Terrorist) ? 0 : 1
            }));
        }
Ejemplo n.º 2
0
        protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
        {
            if (!IsMatchStarted)
            {
                return;
            }

            if (!_isMatchStartedOccured && !IsOvertime)
            {
                _isMatchStartedOccured = true;
                // Reset demo start recording before
                Demo.ResetStats(false);
                InitMatch();
                CreateNewRound(true);
            }
        }
Ejemplo n.º 3
0
        private void Parser_MatchStarted(object sender, MatchStartedEventArgs e)
        {
            if (_matchStarted) // if we here again it means that the demo file contains two or more matches
            {
                MatchFinish();
                Reset();
            }

            _matchStarted       = true;
            _matchTickTimeStart = _parser.CurrentTick;

            _results = _results ?? new Result(_demoFileName);

            _currentRound = new Round {
                RoundNumber = _currentRoundNumber
            };
        }
        private void Parser_MatchStarted(object sender, MatchStartedEventArgs e)
        {
            this.matchStarted = true;

            // Record each player
            foreach (DemoInfo.Player p in parser.PlayingParticipants)
            {
                Player pl = new Player(p.Name, p.SteamID);
                results.Players.Add(p.SteamID, pl);
            }

            // Record the start of the first round
            // This is a special case because timings and stuff
            this.currentRound             = new Round();
            this.currentRound.RoundNumber = this.currentRoundNumber;

            Debug.WriteLine("Start round " + this.currentRound.RoundNumber);
        }
Ejemplo n.º 5
0
        protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
        {
            PlayerTeamCount = 0;
            IsMatchStarted  = false;

            // increment the match_started counter to detect when the match is live
            if (!_matchStartedByRound.ContainsKey(CurrentRound.Number))
            {
                _matchStartedByRound[CurrentRound.Number] = 1;
            }
            else
            {
                ++_matchStartedByRound[CurrentRound.Number];
            }

            bool isMatchStarted = false;

            if (_matchStartedByRound.ContainsKey(CurrentRound.Number - 1))
            {
                isMatchStarted = _matchStartedByRound[CurrentRound.Number] + _matchStartedByRound[CurrentRound.Number - 1] > 3;
            }

            // the match is live after 3 restarts
            if (_matchStartedByRound[CurrentRound.Number] > 2 || isMatchStarted)
            {
                IsMatchStarted = true;
                // https://github.com/akiver/CSGO-Demos-Manager/issues/76
                // some ESEA demos have 1 match_started between round_end event
                // that prevent to create a new round when it should had been created
                if (Demo.Rounds.Count == CurrentRound.Number)
                {
                    CreateNewRound();
                }
            }

            if (CurrentRound.Number == 1)
            {
                InitPlayers();
            }
        }
Ejemplo n.º 6
0
 public static void InvokeMatchStartedEvent(MatchStartedEventArgs args)
 {
     MatchStartedEvent?.Invoke(args);
 }
Ejemplo n.º 7
0
		protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
		{
			if (!IsMatchStarted) return;

			if (!_isMatchStartedOccured && !IsOvertime)
			{
				_isMatchStartedOccured = true;
				// Reset demo start recording before
				Demo.ResetStats(false);
				AddTeams();
				RoundCount = 0;
				CreateNewRound();
			}
		}
Ejemplo n.º 8
0
 void parser_MatchStarted(object sender, MatchStartedEventArgs e)
 {
     g.Clear(Color.Transparent);
     this.Text = "LIVE!";
 }
Ejemplo n.º 9
0
        protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
        {
            if (IsMatchStarted)
            {
                Demo.ResetStats(false);
            }
            RoundCount     = 0;
            IsMatchStarted = true;

            TeamExtended team1 = new TeamExtended()
            {
                Name = !string.IsNullOrWhiteSpace(Parser.CTClanName) ? Parser.CTClanName : TEAM1_NAME
            };
            TeamExtended team2 = new TeamExtended()
            {
                Name = !string.IsNullOrWhiteSpace(Parser.TClanName) ? Parser.TClanName : TEAM2_NAME
            };

            Demo.ClanTagNameTeam1 = team1.Name;
            Demo.ClanTagNameTeam2 = team2.Name;

            // Add all players to our ObservableCollection of PlayerExtended
            foreach (Player player in Parser.PlayingParticipants)
            {
                // don't add bot
                if (player.SteamID != 0)
                {
                    PlayerExtended pl = new PlayerExtended
                    {
                        SteamId = player.SteamID,
                        Name    = player.Name,
                        Team    = player.Team
                    };
                    if (!Demo.Players.Contains(pl))
                    {
                        Application.Current.Dispatcher.Invoke(delegate
                        {
                            Demo.Players.Add(pl);
                            if (pl.Team == Team.CounterTerrorist && !Demo.PlayersTeam1.Contains(pl))
                            {
                                Demo.PlayersTeam1.Add(pl);
                                if (!team1.Players.Contains(pl))
                                {
                                    team1.Players.Add(pl);
                                }
                            }

                            if (pl.Team == Team.Terrorist && !Demo.PlayersTeam2.Contains(pl))
                            {
                                Demo.PlayersTeam2.Add(pl);
                                if (!team2.Players.Contains(pl))
                                {
                                    team2.Players.Add(pl);
                                }
                            }
                        });
                    }
                }
            }

            Application.Current.Dispatcher.Invoke(delegate
            {
                if (!Demo.Teams.Contains(team1))
                {
                    Demo.Teams.Add(team1);
                }
                if (!Demo.Teams.Contains(team2))
                {
                    Demo.Teams.Add(team2);
                }
            });

            // First round handled here because round_start is raised before begin_new_match
            CreateNewRound();
        }
Ejemplo n.º 10
0
 private void CurrentDemoParser_MatchStarted(object sender, MatchStartedEventArgs e)
 {
     SteamController.LogToConsole("Match started");
 }
Ejemplo n.º 11
0
 void demoParser_MatchStarted(object sender, MatchStartedEventArgs e)
 {
     Dispatcher.Invoke(new Action(() =>
                                  this.textblockContent.Text += "Match started" + Environment.NewLine
                                  ));
 }
Ejemplo n.º 12
0
 private void OnMatchStarted(object sender, MatchStartedEventArgs arguments)
 {
     _MatchStarted = true;
 }
Ejemplo n.º 13
0
		protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
		{
			if (IsMatchStarted) Demo.ResetStats(false);
			RoundCount = 0;
			IsMatchStarted = true;

			if (!string.IsNullOrWhiteSpace(Parser.CTClanName)) Demo.TeamCT.Name = Parser.CTClanName;
			if (!string.IsNullOrWhiteSpace(Parser.TClanName)) Demo.TeamT.Name = Parser.TClanName;

			// Add all players to our ObservableCollection of PlayerExtended
			foreach (Player player in Parser.PlayingParticipants)
			{
				// don't add bot
				if (player.SteamID != 0)
				{
					PlayerExtended pl = new PlayerExtended
					{
						SteamId = player.SteamID,
						Name = player.Name,
						Side = player.Team
					};
					if (!Demo.Players.Contains(pl))
					{
						Application.Current.Dispatcher.Invoke(delegate
						{
							Demo.Players.Add(pl);
							if (pl.Side == Team.CounterTerrorist && !Demo.TeamCT.Players.Contains(pl))
							{
								Demo.TeamCT.Players.Add(pl);
								if (!Demo.TeamCT.Players.Contains(pl))
								{
									Demo.TeamCT.Players.Add(pl);
								}
								pl.TeamName = Demo.TeamCT.Name;
							}

							if (pl.Side == Team.Terrorist && !Demo.TeamT.Players.Contains(pl))
							{
								Demo.TeamT.Players.Add(pl);
								if (!Demo.TeamT.Players.Contains(pl))
								{
									Demo.TeamT.Players.Add(pl);
								}
								pl.TeamName = Demo.TeamT.Name;
							}
						});
					}
				}
			}

			// First round handled here because round_start is raised before begin_new_match
			CreateNewRound();
		}
Ejemplo n.º 14
0
		protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
		{
			AddTeams();
		}
Ejemplo n.º 15
0
		protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
		{
			_matchStartedCount++;

			// ESEA demos raise begin_new_match between half time, it's only when the LO3 occurs that the match resume
			if (_matchStartedCount == 1) IsMatchStarted = false;

			if (IsOvertime && _matchStartedCount == 3)
			{
				// Ignore the first OT
				if (CurrentRound.Number > 32)
				{
					if (!_overtimeHasSwapped)
					{
						SwapTeams();
						_overtimeHasSwapped = true;
					}
					else
					{
						_overtimeHasSwapped = false;
					}
				}

				if (IsHalfMatch && CurrentOvertime.ScoreTeam1 != 0 && CurrentOvertime.ScoreTeam2 != 0)
				{
					Application.Current.Dispatcher.Invoke(delegate
					{
						Demo.Overtimes.Add(CurrentOvertime);
					});
					CurrentOvertime = new Overtime()
					{
						Number = ++OvertimeCount
					};
				}

				if (Demo.Overtimes.Count > 0 && IsHalfMatch)
				{
					IsHalfMatch = false;
				}
				else
				{
					IsHalfMatch = !IsHalfMatch;
				}

				IsMatchStarted = true;
			}

			if (IsMatchStarted && CurrentRound.Number == 1)
			{
				InitPlayers();
			}
		}
Ejemplo n.º 16
0
 protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
 {
     AddTeams();
 }
Ejemplo n.º 17
0
		protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e)
		{
			if(IsMatchStarted) Demo.ResetStats(false);
			RoundCount = 0;
			IsMatchStarted = true;

			TeamExtended team1 = new TeamExtended()
			{
				Name = !string.IsNullOrWhiteSpace(Parser.CTClanName) ? Parser.CTClanName : TEAM1_NAME
			};
			TeamExtended team2 = new TeamExtended()
			{
				Name = !string.IsNullOrWhiteSpace(Parser.TClanName) ? Parser.TClanName : TEAM2_NAME
			};

			Demo.ClanTagNameTeam1 = team1.Name;
			Demo.ClanTagNameTeam2 = team2.Name;

			// Add all players to our ObservableCollection of PlayerExtended
			foreach (Player player in Parser.PlayingParticipants)
			{
				// don't add bot
				if (player.SteamID != 0)
				{
					PlayerExtended pl = new PlayerExtended
					{
						SteamId = player.SteamID,
						Name = player.Name,
						Team = player.Team
					};
					if (!Demo.Players.Contains(pl))
					{
						Application.Current.Dispatcher.Invoke(delegate
						{
							Demo.Players.Add(pl);
							if (pl.Team == Team.CounterTerrorist && !Demo.PlayersTeam1.Contains(pl))
							{
								Demo.PlayersTeam1.Add(pl);
								if (!team1.Players.Contains(pl))
								{
									team1.Players.Add(pl);
								}
							}

							if (pl.Team == Team.Terrorist && !Demo.PlayersTeam2.Contains(pl))
							{
								Demo.PlayersTeam2.Add(pl);
								if (!team2.Players.Contains(pl))
								{
									team2.Players.Add(pl);
								}
							}
						});
					}
				}
			}

			Application.Current.Dispatcher.Invoke(delegate
			{
				if (!Demo.Teams.Contains(team1)) Demo.Teams.Add(team1);
				if (!Demo.Teams.Contains(team2)) Demo.Teams.Add(team2);
			});

			// First round handled here because round_start is raised before begin_new_match
			CreateNewRound();
		}
Ejemplo n.º 18
0
		protected abstract void HandleMatchStarted(object sender, MatchStartedEventArgs e);
Ejemplo n.º 19
0
        private void HandleMatchStarted(object sender, MatchStartedEventArgs e)
        {
            BaseEvent newEvent = new BaseEvent(EventType.MatchStarted);

            CurrentTick.Events.Add(newEvent);
        }