Beispiel #1
0
 private UnRankedObject GetUnrankedObjectType(PanelPlayer player)
 {
     if (this.type == Values.StatType.Solo)
     {
         return(player.CalculatedSoloStats);
     }
     else if (this.type == Values.StatType.Duo)
     {
         return(player.CalculatedDuoStats);
     }
     else if (this.type == Values.StatType.Squad)
     {
         return(player.CalculatedSquadStats);
     }
     else if (this.type == Values.StatType.SoloFPP)
     {
         return(player.CalculatedSoloFppStats);
     }
     else if (this.type == Values.StatType.DuoFPP)
     {
         return(player.CalculatedDuoFppStats);
     }
     else if (this.type == Values.StatType.SquadFPP)
     {
         return(player.CalculatedSquadFppStats);
     }
     else
     {
         return(null);
     }
 }
Beispiel #2
0
        private void switchToSingleView(object sender, MouseEventArgs e, PanelPlayer player, string side)
        {
            if (this.mainForm != null)
            {
                MainWindow mainWindow = (MainWindow)this.mainForm;
                mainWindow.rightTextBox.Text = "";
                mainWindow.leftTextBox.Text  = "";

                mainWindow.SetPlayerNull(side);
                mainWindow.OpenChildForm(new NormalSinglePlayer(player, type));
            }
        }
Beispiel #3
0
        public RankedSinglePlayer(PanelPlayer player, Values.StatType type)
        {
            InitializeComponent();
            this.player = player;
            this.type   = type;
            this.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;



            if (this.player != null)
            {
                if (type == Values.StatType.RankedTPP)
                {
                    this.stats = this.player.RankedStatsObj.data.attributes.rankedGameModeStats.squad;
                }
                else if (type == Values.StatType.RankedFPP)
                {
                    this.stats = this.player.RankedStatsObj.data.attributes.rankedGameModeStats.squadFpp;
                }

                this.UpdateStatLabels();
                this.GenerateRecentM20MapsChart();

                SinglePlayerMatchFiltering matchFiltering = new SinglePlayerMatchFiltering(this.player.Matches, this.type, "competitive", this.player.Name);

                this.BuildChart(matchFiltering.GetList());
            }

            fraggerRatingGauge.From = 0;
            fraggerRatingGauge.To   = 100;

            fraggerRatingGauge.Base.LabelsVisibility = Visibility.Hidden;
            fraggerRatingGauge.Base.Foreground       = new SolidColorBrush(System.Windows.Media.Color.FromRgb(242, 169, 0));

            fraggerRatingGauge.Base.GaugeActiveFill = new LinearGradientBrush
            {
                GradientStops = new GradientStopCollection
                {
                    new GradientStop(Colors.Yellow, 0),
                    new GradientStop(Colors.Orange, .5),
                    new GradientStop(Colors.Red, 1)
                }
            };


            int x = (panel3.Size.Width - this.labelRankTitle.Size.Width) / 2;

            this.labelRankTitle.Location = new System.Drawing.Point(x, this.labelRankTitle.Location.Y);
        }
    private void InitLeaderboards(Player mainPlayer)
    {
        List <Player> players = Network.instance.playersInfo.players;

        players.Add(mainPlayer);
        players = players.OrderBy(x => x.best_time).ToList();
        ClearLeaderboards();

        for (int i = 0; i < players.Count; i++)
        {
            PanelPlayer player = Instantiate(prefabsPanelPlayer, containerPanels);
            player.Init(players[i]);
            panelPlayers.Add(player);
        }

        ui.SetActive(true);
    }
Beispiel #5
0
        public NormalSinglePlayer(PanelPlayer player, Values.StatType type)
        {
            InitializeComponent();
            this.player = player;
            this.type   = type;


            fraggerRatingGauge.From = 0;
            fraggerRatingGauge.To   = 100;

            fraggerRatingGauge.Base.LabelsVisibility = Visibility.Hidden;
            fraggerRatingGauge.Base.Foreground       = new SolidColorBrush(System.Windows.Media.Color.FromRgb(242, 169, 0));

            fraggerRatingGauge.Base.GaugeActiveFill = new LinearGradientBrush
            {
                GradientStops = new GradientStopCollection
                {
                    new GradientStop(Colors.Yellow, 0),
                    new GradientStop(Colors.Orange, .5),
                    new GradientStop(Colors.Red, 1)
                }
            };

            int xRecent20 = (panelRecent20.Size.Width - this.labelPieChartTitle.Size.Width) / 2;

            this.labelPieChartTitle.Location = new System.Drawing.Point(xRecent20, this.labelPieChartTitle.Location.Y);

            int xFraggerRating = (panelFraggerRating.Size.Width - this.labelFraggerRating.Size.Width) / 2;

            this.labelFraggerRating.Location = new System.Drawing.Point(xFraggerRating, this.labelFraggerRating.Location.Y);


            if (this.player != null)
            {
                this.DisplayStats();
                this.GenerateRecentM20MapsChart();
                this.DisplayRecent20Stats();


                SinglePlayerMatchFiltering filtering = new SinglePlayerMatchFiltering(this.player.Matches, this.type, "official", this.player.Name);

                this.BuildChart(filtering.GetList());

                //DoublePlayerMatchFiltering.Check();
            }
        }
        public static ModeStats GetProperNormalStatsObject(Values.StatType statType, PanelPlayer player)
        {
            if (statType == Values.StatType.Solo)
            {
                return(player.NormalStatsObj.data.attributes.gameModeStats.soloStats);
            }

            else if (statType == Values.StatType.Duo)
            {
                return(player.NormalStatsObj.data.attributes.gameModeStats.duoStats);
            }

            else if (statType == Values.StatType.Squad)
            {
                return(player.NormalStatsObj.data.attributes.gameModeStats.squadStats);
            }

            else if (statType == Values.StatType.SoloFPP)
            {
                return(player.NormalStatsObj.data.attributes.gameModeStats.soloFppStats);
            }

            else if (statType == Values.StatType.DuoFPP)
            {
                return(player.NormalStatsObj.data.attributes.gameModeStats.duoFppStats);
            }

            else if (statType == Values.StatType.SquadFPP)
            {
                return(player.NormalStatsObj.data.attributes.gameModeStats.squadFPPStats);
            }

            else
            {
                return(null);
            }
        }
Beispiel #7
0
        public NormalDoublePlayer(LeftPlayer leftPlayer, RightPlayer rightPlayer, Values.StatType type, Form form)
        {
            InitializeComponent();



            this.leftPlayerFraggerRatingGauge.From = 0;
            this.leftPlayerFraggerRatingGauge.To   = 100;

            this.leftPlayerFraggerRatingGauge.Base.LabelsVisibility = Visibility.Hidden;
            this.leftPlayerFraggerRatingGauge.Base.Foreground       = new SolidColorBrush(System.Windows.Media.Color.FromRgb(242, 169, 0));

            this.rightPlayerFraggerRatingGauge.From = 0;
            this.rightPlayerFraggerRatingGauge.To   = 100;

            this.rightPlayerFraggerRatingGauge.Base.LabelsVisibility = Visibility.Hidden;
            this.rightPlayerFraggerRatingGauge.Base.Foreground       = new SolidColorBrush(System.Windows.Media.Color.FromRgb(242, 169, 0));

            this.leftPlayerFraggerRatingGauge.Base.GaugeActiveFill = new LinearGradientBrush
            {
                GradientStops = new GradientStopCollection
                {
                    new GradientStop(Colors.Yellow, 0),
                    new GradientStop(Colors.Orange, .5),
                    new GradientStop(Colors.Red, 1)
                }
            };

            this.rightPlayerFraggerRatingGauge.Base.GaugeActiveFill = new LinearGradientBrush
            {
                GradientStops = new GradientStopCollection
                {
                    new GradientStop(Colors.Yellow, 0),
                    new GradientStop(Colors.Orange, .5),
                    new GradientStop(Colors.Red, 1)
                }
            };


            if (form != null)
            {
                this.mainForm = form;
            }
            if (leftPlayer != null && rightPlayer != null)
            {
                this.leftPlayer    = leftPlayer;
                this.rightPlayer   = rightPlayer;
                this.type          = type;
                this.unrankedLeft  = this.GetUnrankedObjectType(this.leftPlayer);
                this.unrankedRight = this.GetUnrankedObjectType(this.rightPlayer);

                this.UpdateStatLabels();
                this.DisplayComparisonArrows();

                DoublePlayerMatchFiltering doubleFiltering = new DoublePlayerMatchFiltering(this.leftPlayer.Matches, this.leftPlayer.Name,
                                                                                            this.rightPlayer.Matches, this.rightPlayer.Name, this.type, "official");

                Tuple <List <GraphPlot>, List <GraphPlot> > tuple = doubleFiltering.GetList();

                this.BuildChart(tuple.Item1, tuple.Item2);
            }
        }
Beispiel #8
0
        public static async Task <PanelPlayer> BuildPlayer(PanelPlayer player)
        {
            if (player != null && player.NormalStatsObj != null)
            {
                player.CalculatedSoloStats = await Task.Run(() => ComputeStats(player.NormalStatsObj.data.attributes.gameModeStats.soloStats));

                player.CalculatedDuoStats = await Task.Run(() => ComputeStats(player.NormalStatsObj.data.attributes.gameModeStats.duoStats));

                player.CalculatedSquadStats = await Task.Run(() => ComputeStats(player.NormalStatsObj.data.attributes.gameModeStats.squadStats));

                player.CalculatedSoloFppStats = await Task.Run(() => ComputeStats(player.NormalStatsObj.data.attributes.gameModeStats.soloFppStats));

                player.CalculatedDuoFppStats = await Task.Run(() => ComputeStats(player.NormalStatsObj.data.attributes.gameModeStats.duoFppStats));

                player.CalculatedSquadFppStats = await Task.Run(() => ComputeStats(player.NormalStatsObj.data.attributes.gameModeStats.squadFPPStats));


                player.Matches = await Task.Run(() => GetMatchesParsed(player.AccountObj.data[0].relationships.matches.data));

                player.Matches20Solo = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.Solo, 20, "official"));

                player.Matches20Duo = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.Duo, 20, "official"));

                player.Matches20Squad = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.Squad, 20, "official"));

                player.Matches20SoloFpp = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.SoloFPP, 20, "official"));

                player.Matches20DuoFpp = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.DuoFPP, 20, "official"));

                player.Matches20SquadFpp = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.SquadFPP, 20, "official"));

                player.Matches20RankedTpp = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.RankedTPP, 20, "competitive"));

                player.Matches20RankedFpp = await Task.Run(() => FilterMatches(player.Matches, Values.StatType.RankedFPP, 20, "competitive"));
            }

            if (player != null && player.RankedStatsObj != null)
            {
                if (player.RankedStatsObj.data.attributes.rankedGameModeStats.squad != null)
                {
                    player.CalculatedRankedTppStats = await Task.Run(() =>
                                                                     ComputeStatsRanked(player.RankedStatsObj.data.attributes.rankedGameModeStats.squad, player.Matches, player.Name));
                }
                else
                {
                    player.CalculatedRankedTppStats = await Task.Run(() => ComputeStatsRanked(null, null, null));
                }
                if (player.RankedStatsObj.data.attributes.rankedGameModeStats.squadFpp != null)
                {
                    player.CalculatedRankedFppStats = await Task.Run(() =>
                                                                     ComputeStatsRanked(player.RankedStatsObj.data.attributes.rankedGameModeStats.squadFpp, player.Matches, player.Name));
                }
                else
                {
                    player.CalculatedRankedFppStats = await Task.Run(() => ComputeStatsRanked(null, null, null));
                }
            }


            return(player);
        }