Class representing a participant in a match (Match API).
Exemplo n.º 1
0
        public static BuildSet GetMatchBuild(MatchDetail match, Participant participant)
        {
            if (PotentialUpgrades == null) InitializePotentialUpgrades();
            var set = new BuildSet() { HasMatchData = true };
            set.TimeSince = GetTimeSince(match.MatchCreation);

            var timeline = match.Timeline;
            var allPurchasedItems = getAllPurchasedItems(timeline, participant.ParticipantId);

            set.InitialPurchase = getStartingItems(timeline, participant.ParticipantId);
            set.FinalBuild = getFinalBuild(participant);
            set.RushItem = getRushItem(allPurchasedItems.ToList(), set.InitialPurchase.Items.ToList());

            var allConsumables = getConsumables(allPurchasedItems.ToList());
            if(allConsumables.Count > 0) set.Consumables = (getPurchaseSet("Consumables", allConsumables, includePrice: false));

            set.FullBuild = set.FinalBuild.Items.Count == 7 && !(set.FinalBuild.Items.Any(x => PotentialUpgrades.ContainsKey(x.Id.ToString())));
            set.Id = match.MatchId;
            set.MatchDataFetched = true;
            return set;
        }
        public PastMatchPlayerPanel(Participant p, string iconLocation)
        {
            // Set panel properties
            Size = new Size(150, 32);

            // Create image
            PictureBox iconBox = new PictureBox();
            iconBox.InitialImage = null;
            iconBox.ErrorImage = null;
            iconBox.SizeMode = PictureBoxSizeMode.StretchImage;
            iconBox.ImageLocation = iconLocation;
            iconBox.Size = new Size(32, 32);
            iconBox.Location = new Point(0, 0);

            // Create labels
            Label nameLabel = new Label();
            nameLabel.BackColor = Color.White;
            nameLabel.Size = new Size(118, 16);
            nameLabel.Location = new Point(32, 0);

            Label playedWithLabel = new Label();
            playedWithLabel.BackColor = PLAYED_WITH_BACK_COLOR;
            playedWithLabel.Size = new Size(26, 16);
            playedWithLabel.Location = new Point(98, 16);
            playedWithLabel.TextAlign = ContentAlignment.MiddleCenter;

            Label playedAgainstLabel = new Label();
            playedAgainstLabel.BackColor = PLAYED_AGAINST_BACK_COLOR;
            playedAgainstLabel.Size = new Size(26, 16);
            playedAgainstLabel.Location = new Point(124, 16);
            playedAgainstLabel.TextAlign = ContentAlignment.MiddleCenter;

            Controls.Add(iconBox);
            Controls.Add(nameLabel);
            Controls.Add(playedWithLabel);
            Controls.Add(playedAgainstLabel);
        }
Exemplo n.º 3
0
 private static PurchaseSet getFinalBuild(Participant participant)
 {
     var finalBuild = new List<ItemStatic>();
     var stats = participant.Stats;
     if (stats.Item0 != 0)
     {
         finalBuild.Add(getItem(stats.Item0));
     }
     if (stats.Item1 != 0)
     {
         finalBuild.Add(getItem(stats.Item1));
     }
     if (stats.Item2 != 0)
     {
         finalBuild.Add(getItem(stats.Item2));
     }
     if (stats.Item3 != 0)
     {
         finalBuild.Add(getItem(stats.Item3));
     }
     if (stats.Item4 != 0)
     {
         finalBuild.Add(getItem(stats.Item4));
     }
     if (stats.Item5 != 0)
     {
         finalBuild.Add(getItem(stats.Item5));
     }
     if (stats.Item6 != 0)
     {
         finalBuild.Add(getItem(stats.Item6));
     }
     return new PurchaseSet() { Items = finalBuild, RecMath = false, Name = "Final Build" };
 }