示例#1
0
        public IActionResult Index(string name = "")
        {
            ViewBag.FilterName = name;
            DemoParser demoParser = new DemoParser(LDemo);

            demoParser.ParseHeader();

            List <Vector2> shootingPositions = new List <Vector2>();
            List <Vector2> deathPositions    = new List <Vector2>();
            bool           hasMatchStarted   = false;

            demoParser.MatchStarted += (sender, e) => {
                hasMatchStarted = true;
            };

            demoParser.PlayerKilled += (sender, e) => {
                if (e.Victim.Name.Contains(name) && hasMatchStarted)
                {
                    Vector2 vet = TrasnlateScale(e.Victim.LastAlivePosition.X, e.Victim.LastAlivePosition.Y);
                    deathPositions.Add(vet);
                }
            };
            demoParser.WeaponFired += (sender, e) => {
                if (e.Shooter.Name.Contains(name) && hasMatchStarted &&
                    e.Weapon.Weapon != EquipmentElement.Knife && e.Weapon.Weapon != EquipmentElement.Molotov &&
                    e.Weapon.Weapon != EquipmentElement.Smoke && e.Weapon.Weapon != EquipmentElement.Flash &&
                    e.Weapon.Weapon != EquipmentElement.Decoy && e.Weapon.Weapon != EquipmentElement.HE)
                {
                    Vector2 vet = TrasnlateScale(e.Shooter.Position.X, e.Shooter.Position.Y);
                    shootingPositions.Add(vet);
                }
            };

            demoParser.ParseToEnd();

            DrawingPoints(shootingPositions, deathPositions);

            return(View(demoParser.ReadPlayersName()));
        }