private void complete(demodatainstance instance)
        {
            demoreading.saveDemo(instance, stat);
            MessageBox.Show("Done!");

            sentfrom.doLoadDemos();
        }
        public HeatMapEditorWindow(demodatainstance ins)
        {
            InitializeComponent();

            refInstance = ins;

            #region toggle players
            foreach (p_Player player in refInstance.players.Values.ToArray())
            {
                //Add all the players into the initialised box
                if (!enabledSteamIDS.ContainsKey(player.steamID))
                {
                    enabledSteamIDS.Add(player.steamID, true);
                    //New checkbox with player name
                    CheckBox playerCheckBox = new CheckBox();
                    playerCheckBox.Content = player.steamName;

                    //Enable it on the player dict
                    playerCheckBox.Checked += (sender, e) =>
                    {
                        enabledSteamIDS[player.steamID] = true;
                    }; //Or disable
                    playerCheckBox.Unchecked += (sender, e) =>
                    {
                        enabledSteamIDS[player.steamID] = false;
                    };

                    //Auto check
                    playerCheckBox.IsChecked = true;

                    if (player.rounds.Count > 0)
                    {
                        //Going by last round because of bug in parsing saying round is CT on first
                        if (player.rounds.Last().teamPlayedOnRound == p_Team_Identifier.counterterrorist)
                        {
                            target_playerpanel_T.Children.Add(playerCheckBox);
                        }
                        else
                        {
                            target_playerpanel_CT.Children.Add(playerCheckBox);
                        }
                    }
                }
            }
            #endregion
        }
Beispiel #3
0
        /// <summary>
        /// This method handles all the sequencing required to generate data from the mapData file
        /// </summary>
        /// <param name="mapfile">The mapfile to process</param>
        static void doProcessing(mapData mapfile, DemoParser parser)
        {
            Debug.Success("Starting processing");

            //First step: Make a grey dark version of the radar.
            Bitmap backgroundRadar = bitmapfilters.brightness(bitmapfilters.greyScaleAverage(mapfile.image_radar), 0.3f);

            //Second step: Load the demo into a demodatainstance, so that it parses into different lists.
            demodatainstance demo = new demodatainstance(parser);

            //Third step: Start making heatmaps
            densitymap density_shotsfired = new densitymap();

            //Legacy, Make the camera object
            camera cam = new camera();

            cam.offset = new vector2(mapfile.radar.pos_x, mapfile.radar.pos_y);
            cam.scale  = mapfile.radar.scale;


            foreach (p_Player plyr in demo.players.Values.ToList())
            {
                foreach (p_Round rnd in plyr.rounds)
                {
                    foreach (vector3 shot in rnd.shotsFired)
                    {
                        vector2 screenPos = transforms.worldToScreenSpace(shot, cam);
                        density_shotsfired.createHeatMapSplodge((int)screenPos.x, (int)screenPos.y, 20);
                    }
                }
            }

            density_shotsfired.averageBlur3x3();
            density_shotsfired.normalise(0.4f);

            Bitmap output = density_shotsfired.toBitMap();

            output = gradients.fire.applyToImage(output);

            output = bitmapfilters.alphaOver(backgroundRadar, output);

            output.Save("test_shotsfired.png");
        }