Example #1
0
 public SinglePlayerMatchFiltering(List <RootMatch> matches, Values.StatType type, string matchType, string playerName)
 {
     this.matches    = matches;
     this.type       = type;
     this.matchType  = matchType;
     this.playerName = playerName;
 }
Example #2
0
        public DoublePlayerMatchFiltering(List <RootMatch> matchesA, string playerNameA,
                                          List <RootMatch> matchesB, string playerNameB,
                                          Values.StatType type, string matchType)
        {
            this.matchesA    = matchesA;
            this.playerNameA = playerNameA;

            this.matchesB    = matchesB;
            this.playerNameB = playerNameB;

            this.type      = type;
            this.matchType = matchType;
        }
Example #3
0
        public RankedDoublePlayer(LeftPlayer leftPlayer, RightPlayer rightPlayer, Values.StatType type, Form mainform)
        {
            InitializeComponent();
            this.mainForm = mainform;

            this.leftPlayer  = leftPlayer;
            this.rightPlayer = rightPlayer;
            this.type        = type;



            this.pictureBoxLeft.SizeMode  = PictureBoxSizeMode.Zoom;
            this.pictureBoxRight.SizeMode = PictureBoxSizeMode.Zoom;



            int xLeft = (panelLeft.Size.Width - this.labelPlayerNameLeft.Size.Width) / 2;

            this.labelPlayerNameLeft.Location = new Point(xLeft, this.labelPlayerNameLeft.Location.Y);

            int xRight = (panelRight.Size.Width - this.labelPlayerNameRight.Size.Width) / 2;

            this.labelPlayerNameRight.Location = new Point(xRight, this.labelPlayerNameRight.Location.Y);



            if (this.leftPlayer != null && this.rightPlayer != null)
            {
                if (type == Values.StatType.RankedFPP)
                {
                    this.statsLeft  = this.leftPlayer.CalculatedRankedFppStats;
                    this.statsRight = this.rightPlayer.CalculatedRankedFppStats;
                }
                else if (type == Values.StatType.RankedTPP)
                {
                    this.statsLeft  = this.leftPlayer.CalculatedRankedTppStats;
                    this.statsRight = this.rightPlayer.CalculatedRankedTppStats;
                }



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

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

                this.BuildChart(tuple.Item1, tuple.Item2);
            }
        }
Example #4
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);
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #8
0
        private Dictionary <string, GraphPlot> GetDictionary(List <RootMatch> matches, Values.StatType type, string matchType, string playerName)
        {
            Dictionary <string, GraphPlot> dict = new Dictionary <string, GraphPlot>();

            foreach (RootMatch match in matches)
            {
                string currentMatchGameMode = match.data.attributes.gameMode;
                string currentMatchType     = match.data.attributes.matchType;

                if (currentMatchGameMode == Values.GetEnumString(type).ToLower() && currentMatchType == matchType)
                {
                    foreach (MatchSingleObject participant in match.included)
                    {
                        if (participant.type == "participant")
                        {
                            ParticipantObject matchPlayer     = (ParticipantObject)participant;
                            string            matchPlayerName = matchPlayer.attributes.stats.name;

                            if (matchPlayerName == playerName)
                            {
                                string matchDate = match.data.attributes.createdAt;

                                DateTime matchTime = DateTime.Parse(matchDate);

                                string date = matchTime.Year.ToString() + "-" + matchTime.Month.ToString() + "-" + matchTime.Day.ToString();

                                double damageDealtInMatch = matchPlayer.attributes.stats.damageDealt;

                                if (!dict.ContainsKey(date))
                                {
                                    dict.Add(date, new GraphPlot(damageDealtInMatch, playerName, matchTime));
                                }
                                else
                                {
                                    dict[date].Add(damageDealtInMatch);
                                }

                                break;
                            }
                        }
                    }
                }
            }

            return(dict);
        }
Example #9
0
        private static async Task <List <RootMatch> > FilterMatches(List <RootMatch> matches, Values.StatType type, int maxSize, string matchtypeTarget)
        {
            List <RootMatch> list = new List <RootMatch>();

            foreach (RootMatch match in matches)
            {
                string gameMode  = match.data.attributes.gameMode;
                string matchType = match.data.attributes.matchType;

                if (gameMode == Values.GetEnumString(type).ToLower() &&
                    matchType == matchtypeTarget &&
                    list.Count < maxSize)
                {
                    list.Add(match);
                }

                if (list.Count == maxSize)
                {
                    break;
                }
            }

            return(list);
        }