示例#1
0
        public PlayerInfo(int Number, Player player, UpcomingChests chests)
        {
            InitializeComponent();
            lbl_Number.Text    = Number.ToString();
            mlbl_NickName.Text = player.name;
            mlbl_Tag.Text      = player.tag;
            mlbl_lastSeen.Text = player.lastSeen.ClashRoyaleDateToDateTime().ToLocalTime().ToString();
            mlbl_Trophies.Text = player.trophies.ToString();
            label2.Text        = player.expLevel.ToString();
            lbl_Position.Text  = PositionSwitch(player.role);
            lbl_donated.Text   = player.donations.ToString();
            lbl_received.Text  = player.donationsReceived.ToString();

            ArenaSwitch(player.arena.id);
            tmpDeck = player.currentDeck.ToArray();
        }
        public FormPlayerDetail(string PlayerTag)
        {
            InitializeComponent();

            for (int i = 0; i < Program.ClanMembersDetailInfo.Length; i++)
            {
                if (Program.ClanMembersDetailInfo[i].tag == PlayerTag)
                {
                    _chests            = Program.ClanMembersChests[i];
                    lbl_Number.Text    = (i + 1).ToString();
                    this.Text          = Program.ClanMembersDetailInfo[i].name;
                    mlbl_Tag.Text      = Program.ClanMembersDetailInfo[i].tag;
                    mlbl_Trophies.Text = Program.ClanMembersDetailInfo[i].trophies.ToString();
                    label2.Text        = Program.ClanMembersDetailInfo[i].expLevel.ToString();
                    lbl_Position.Text  = PositionSwitch(Program.ClanMembersDetailInfo[i].role);
                    lbl_donated.Text   = Program.ClanMembersDetailInfo[i].donations.ToString();
                    lbl_received.Text  = Program.ClanMembersDetailInfo[i].donationsReceived.ToString();
                    ArenaSwitch(Program.ClanMembersDetailInfo[i].arena.id);
                    //CustomizeInitializeComponent();
                    CardGrouping.SelectedIndex = 1;
                    tmpDeck           = Program.ClanMembersDetailInfo[i].currentDeck.ToArray();
                    pictureBox1.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[0].name}").FirstOrDefault().Img; //tmpDeck[0].iconUrls.medium);
                    pictureBox2.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[1].name}").FirstOrDefault().Img; //.LoadAsync(tmpDeck[1].iconUrls.medium);
                    pictureBox3.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[2].name}").FirstOrDefault().Img; //.LoadAsync(tmpDeck[2].iconUrls.medium);
                    pictureBox4.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[3].name}").FirstOrDefault().Img; //.LoadAsync(tmpDeck[3].iconUrls.medium);
                    pictureBox5.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[4].name}").FirstOrDefault().Img; //.LoadAsync(tmpDeck[4].iconUrls.medium);
                    pictureBox6.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[5].name}").FirstOrDefault().Img; //.LoadAsync(tmpDeck[5].iconUrls.medium);
                    pictureBox7.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[6].name}").FirstOrDefault().Img; //.LoadAsync(tmpDeck[6].iconUrls.medium);
                    pictureBox8.Image = Program.ImgCards.Where(c => c.Name == $"{tmpDeck[7].name}").FirstOrDefault().Img; //.LoadAsync(tmpDeck[7].iconUrls.medium);
                    if (FLP_PlayerCards.Controls.Count == 0)
                    {
                        ChestSwitch(_chests);
                        cardInfo = new CardInfoUC[Program.ClanMembersDetailInfo[i].cards.Count];
                        for (int CardCounter = 0; CardCounter < Program.ClanMembersDetailInfo[i].cards.Count; CardCounter++)
                        {
                            var tmpCard = Program.ImgCards.Where(c => c.Name == $"{Program.ClanMembersDetailInfo[i].cards[CardCounter].name}").FirstOrDefault();
                            if (tmpCard != null)
                            {
                                cardInfo[CardCounter] = new CardInfoUC(tmpCard.Img, tmpCard.StartLvl + Program.ClanMembersDetailInfo[i].cards[CardCounter].level, Program.ClanMembersDetailInfo[i].cards[CardCounter].count, tmpCard.Rare, tmpCard.Cost);
                            }
                        }
                        FLP_PlayerCards.Controls.AddRange(cardInfo.OrderByDescending(c => c.Rare).ToArray <CardInfoUC>());
                    }
                }
            }
        }
 private void ChestSwitch(UpcomingChests chests)
 {
     #region Pbox List
     pboxList     = new PictureBox[14];
     pboxList[0]  = pbox_Chest1;
     pboxList[1]  = pbox_Chest2;
     pboxList[2]  = pbox_Chest3;
     pboxList[3]  = pbox_Chest4;
     pboxList[4]  = pbox_Chest5;
     pboxList[5]  = pbox_Chest6;
     pboxList[6]  = pbox_Chest7;
     pboxList[7]  = pbox_Chest8;
     pboxList[8]  = pbox_Chest9;
     pboxList[9]  = pbox_Chest10;
     pboxList[10] = pbox_Chest11;
     pboxList[11] = pbox_Chest12;
     pboxList[12] = pbox_Chest13;
     pboxList[13] = pbox_Chest14;
     #endregion
     #region Lbl CHest List
     labellist     = new Label[14];
     labellist[0]  = lbl_Chest1;
     labellist[1]  = lbl_Chest2;
     labellist[2]  = lbl_Chest3;
     labellist[3]  = lbl_Chest4;
     labellist[4]  = lbl_Chest5;
     labellist[5]  = lbl_Chest6;
     labellist[6]  = lbl_Chest7;
     labellist[7]  = lbl_Chest8;
     labellist[8]  = lbl_Chest9;
     labellist[9]  = lbl_Chest10;
     labellist[10] = lbl_Chest11;
     labellist[11] = lbl_Chest12;
     labellist[12] = lbl_Chest13;
     labellist[13] = lbl_Chest14;
     #endregion
     int count = ((chests.items.Length > 14) ? 14 : chests.items.Length);
     for (int i = 0; i < count; i++)
     {
         labellist[i].Text = (chests.items[i].index + 1).ToString();
         pboxList[i].Image = ChestImage(chests.items[i].name);
     }
 }