Exemple #1
0
        public static void ShowOnlineCharacters(int page, Character[] chr, Label lblName, Label lblLevel, PictureBox picSide, PictureBox picClass, Control _this)
        {
            // Removes all characters from the last page
            for (int i = _this.Controls.Count - 1; i >= 0; i--)
            {
                if (_this.Controls[i].Name != "lblTitle" && _this.Controls[i].Name != "btnNext" && _this.Controls[i].Name != "btnBack" && _this.Controls[i].Name != "lblExit")
                {
                    _this.Controls.Remove(_this.Controls[i]);
                }
            }

            //Adds characters to the current page
            int y = 0, counter = 0;

            foreach (Character p in chr)
            {
                if (counter >= ((page - 1) * 12) && counter < (page * 12))
                {
                    Label lblName_t = lblName.Clone();

                    lblName_t.Visible  = true;
                    lblName_t.Text     = p._NAME;
                    lblName_t.Location = new System.Drawing.Point(lblName.Location.X, lblName.Location.Y + 27 * y);
                    _this.Controls.Add(lblName_t);
                    lblName_t.Name = "lblName_t";

                    Label lblLevel_t = lblLevel.Clone();
                    lblLevel_t = lblLevel.Clone();

                    lblLevel_t.Visible  = true;
                    lblLevel_t.Text     = p._NAME;
                    lblLevel_t.Location = new System.Drawing.Point(lblLevel.Location.X, lblLevel.Location.Y + 27 * y);
                    _this.Controls.Add(lblLevel_t);
                    lblLevel_t.Name = "lblLevel_t";

                    PictureBox picSide_t = picSide.Clone();
                    picSide_t.Visible = true; picSide_t.Location = new System.Drawing.Point(picSide.Location.X, picSide.Location.Y + 27 * y);

                    _this.Controls.Add(picSide_t);
                    picSide_t.Name = "picSide_t";


                    PictureBox picClass_t = picClass.Clone();
                    picClass_t.Visible = true; picClass_t.Location = new System.Drawing.Point(picClass.Location.X, picClass.Location.Y + 27 * y);

                    _this.Controls.Add(picClass_t);
                    picClass_t.Name = "picClass_t";


                    lblName_t.Text  = p._NAME;
                    lblLevel_t.Text = p._LEVEL.ToString();
                    if (p._RACE == 1 || p._RACE == 3 || p._RACE == 4 || p._RACE == 7 || p._RACE == 11)
                    {
                        picSide_t.Image = Properties.Resources.alliance;
                    }
                    else
                    {
                        picSide_t.Image = Properties.Resources.horde;
                    }
                    switch (p._CLASS)
                    {
                    case 1:
                        picClass_t.Image = Properties.Resources.warrior;
                        break;

                    case 2:
                        picClass_t.Image = Properties.Resources.paladin;
                        break;

                    case 3:
                        picClass_t.Image = Properties.Resources.hunter;
                        break;

                    case 4:
                        picClass_t.Image = Properties.Resources.rogue;
                        break;

                    case 5:
                        picClass_t.Image = Properties.Resources.priest;
                        break;

                    case 6:
                        picClass_t.Image = Properties.Resources.dk;
                        break;

                    case 7:
                        picClass_t.Image = Properties.Resources.shaman;
                        break;

                    case 8:
                        picClass_t.Image = Properties.Resources.mage;
                        break;

                    case 9:
                        picClass_t.Image = Properties.Resources._lock;
                        break;

                    case 11:
                        picClass_t.Image = Properties.Resources.druid;
                        break;
                    }

                    y++;
                }
                counter++;
            }
        }