public void init(CardTypes.CardDefinition def, CardClickPlayDelegate callback)
 {
     this.m_callback = callback;
     base.clearControls();
     this.background.Size     = base.Size;
     this.background.Position = new Point(0, 0);
     base.addControl(this.background);
     this.background.Create((Image)GFXLibrary.cardpanel_grey_9slice_left_top, (Image)GFXLibrary.cardpanel_grey_9slice_middle_top, (Image)GFXLibrary.cardpanel_grey_9slice_right_top, (Image)GFXLibrary.cardpanel_grey_9slice_left_middle, (Image)GFXLibrary.cardpanel_grey_9slice_middle_middle, (Image)GFXLibrary.cardpanel_grey_9slice_right_middle, (Image)GFXLibrary.cardpanel_grey_9slice_left_bottom, (Image)GFXLibrary.cardpanel_grey_9slice_middle_bottom, (Image)GFXLibrary.cardpanel_grey_9slice_right_bottom);
     this.topLeftImage.Image    = (Image)GFXLibrary.cardpanel_grey_9slice_gradation_top_left;
     this.topLeftImage.Position = new Point(0, 0);
     this.background.addControl(this.topLeftImage);
     this.bottomRightImage.Image    = (Image)GFXLibrary.cardpanel_grey_9slice_gradation_bottom;
     this.bottomRightImage.Position = new Point(this.background.Width - this.bottomRightImage.Image.Width, this.background.Height - this.bottomRightImage.Image.Height);
     this.background.addControl(this.bottomRightImage);
     CustomSelfDrawPanel.UICard control = BuyCardsPanel.makeUICard(def, RemoteServices.Instance.UserID, 0x2710);
     GFXLibrary.Instance.closeBigCardsLoader();
     control.Position = new Point(0x75, 50);
     this.background.addControl(control);
     this.confirmLabel.Text      = SK.Text("ConfirmPlayCardPanel_Are_You_Sure", "Are you sure you want to play this card?");
     this.confirmLabel.Color     = ARGBColors.Black;
     this.confirmLabel.Position  = new Point(0, 10);
     this.confirmLabel.Font      = FontManager.GetFont("Arial", 14f, FontStyle.Regular);
     this.confirmLabel.Size      = new Size(this.background.Width, 50);
     this.confirmLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
     this.background.addControl(this.confirmLabel);
     this.confirmButton.Text.Text   = SK.Text("ConfirmPlayCardPanel_Play_Card", "Play Card");
     this.confirmButton.TextYOffset = -2;
     this.confirmButton.Text.Color  = ARGBColors.Black;
     this.confirmButton.Text.Font   = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
     this.confirmButton.ImageNorm   = (Image)GFXLibrary.cardpanel_button_blue_normal;
     this.confirmButton.ImageOver   = (Image)GFXLibrary.cardpanel_button_blue_over;
     this.confirmButton.ImageClick  = (Image)GFXLibrary.cardpanel_button_blue_pressed;
     this.confirmButton.Position    = new Point(230, 310);
     this.confirmButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.playCard), "ConfirmPlayCardPanel_confirm_play_card");
     this.background.addControl(this.confirmButton);
     this.cancelButton.Text.Text   = SK.Text("GENERIC_Cancel", "Cancel");
     this.cancelButton.TextYOffset = -2;
     this.cancelButton.Text.Color  = ARGBColors.Black;
     this.cancelButton.Text.Font   = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
     this.cancelButton.ImageNorm   = (Image)GFXLibrary.cardpanel_button_blue_normal;
     this.cancelButton.ImageOver   = (Image)GFXLibrary.cardpanel_button_blue_over;
     this.cancelButton.ImageClick  = (Image)GFXLibrary.cardpanel_button_blue_pressed;
     this.cancelButton.Position    = new Point(30, 310);
     this.cancelButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick), "ConfirmPlayCardPanel_cancel");
     this.background.addControl(this.cancelButton);
     this.confirmCheck.CheckedImage     = (Image)GFXLibrary.reports_checkbox_checked;
     this.confirmCheck.UncheckedImage   = (Image)GFXLibrary.reports_checkbox_empty;
     this.confirmCheck.Position         = new Point(20, 360);
     this.confirmCheck.Checked          = true;
     this.confirmCheck.CBLabel.Text     = SK.Text("ConfirmPlayCardPanel_Always", "Always confirm playing cards?");
     this.confirmCheck.CBLabel.Color    = ARGBColors.Black;
     this.confirmCheck.CBLabel.Position = new Point(20, -1);
     this.confirmCheck.CBLabel.Size     = new Size(360, 0x23);
     this.confirmCheck.CBLabel.Font     = FontManager.GetFont("Arial", 10f, FontStyle.Regular);
     this.background.addControl(this.confirmCheck);
 }
Esempio n. 2
0
 public bool update()
 {
     this.newDisplayedCards.Clear();
     CardData userCardData = GameEngine.Instance.World.UserCardData;
     WorldData localWorldData = GameEngine.Instance.LocalWorldData;
     DateTime time = VillageMap.getCurrentServerTime();
     int length = userCardData.cards.Length;
     for (int i = 0; i < length; i++)
     {
         int num3 = userCardData.cards[i];
         int num4 = CardTypes.getCardCategory(num3);
         if (((num4 == this.currentCardSection) || (this.currentCardSection == 0)) || ((this.currentCardSection == 9) && ((num4 == 6) || (num4 == 7))))
         {
             DateTime time2 = userCardData.cardsExpiry[i];
             TimeSpan span = (TimeSpan) (time2 - time);
             int num5 = 1;
             num5 = CardTypes.getCardDuration(num3);
             int totalMinutes = (int) span.TotalMinutes;
             if (totalMinutes < 0)
             {
                 totalMinutes = 0;
             }
             int num7 = (totalMinutes * 0x40) / (num5 * 60);
             if (num7 < 0)
             {
                 num7 = 0;
             }
             else if (num7 >= 0x40)
             {
                 num7 = 0x3f;
             }
             if (span.TotalDays > 100.0)
             {
                 num7 = 0x40;
             }
             DisplayCardInfo item = new DisplayCardInfo {
                 card = num3,
                 currentFrame = num7,
                 effect = CardTypes.getCardEffectValue(num3),
                 imageID = this.getCardImage(num3) - 1
             };
             this.newDisplayedCards.Add(item);
         }
     }
     int num8 = GameEngine.Instance.World.countPlayableCards(this.currentCardSection);
     bool flag = false;
     if (num8 != this.lastAvailableToPlay)
     {
         flag = true;
     }
     if (!this.equalCards(this.displayedCards, this.newDisplayedCards))
     {
         flag = true;
         this.displayedCards.Clear();
         foreach (DisplayCardInfo info2 in this.newDisplayedCards)
         {
             this.displayedCards.Add(info2);
         }
     }
     if (this.showExtras && (this.cardTextTimer > 0))
     {
         this.cardTextTimer--;
         if (this.cardTextTimer <= 0)
         {
             this.mainText.Visible = false;
             flag = true;
         }
         else if (this.cardTextTimer < 10)
         {
             this.mainText.Color = Color.FromArgb(this.cardTextTimer * 0x19, this.cardTextTimer * 0x19, this.cardTextTimer * 0x19, this.cardTextTimer * 0x19);
             this.mainText.DropShadowColor = Color.FromArgb(this.cardTextTimer * 0x19, 0, 0, 0);
             flag = true;
         }
     }
     if (this.showExtras && !this.suggestedCardsValid)
     {
         CardTypes.CardDefinition filter = new CardTypes.CardDefinition {
             cardCategory = this.currentCardSection
         };
         GameEngine.Instance.World.searchProfileCards(filter, "meta", GameEngine.Instance.World.lastUserCardNameFilter);
         int playerRank = GameEngine.Instance.World.getRank() + 1;
         foreach (int num10 in GameEngine.Instance.World.ProfileCardsSearch)
         {
             if ((GameEngine.Instance.World.ProfileCards[num10].cardRank <= playerRank) && (GameEngine.Instance.World.ProfileCards[num10].id != 0xc04))
             {
                 int id = GameEngine.Instance.World.ProfileCards[num10].id;
                 if (this.suggestedCardCounts.ContainsKey(id))
                 {
                     foreach (CustomSelfDrawPanel.UICard card in this.suggestedCards)
                     {
                         if (card.Definition.id == GameEngine.Instance.World.ProfileCards[num10].id)
                         {
                             card.UserIDList.Add(num10);
                             card.cardCount++;
                             card.countLabel.Text = card.cardCount.ToString();
                         }
                     }
                 }
                 else
                 {
                     this.suggestedCardCounts.Add(GameEngine.Instance.World.ProfileCards[num10].id, 1);
                     CustomSelfDrawPanel.UICard card2 = this.makeUICard(GameEngine.Instance.World.ProfileCards[num10], num10, playerRank);
                     this.suggestedCards.Add(card2);
                 }
             }
         }
         this.suggestedExpand.Visible = this.suggestedExpand.Enabled = this.suggestedCards.Count != 0;
         this.suggestedCardsValid = true;
     }
     if (this.showExtras && !this.animationComplete)
     {
         this.animationComplete = true;
         if (!this.suggestedExpand.Visible)
         {
             for (int j = 0; j < this.suggestedDisplayedCards.Count; j++)
             {
                 if (this.suggestedDisplayedCards[j].Position.X < (this.BASE_CARD_POS + (0x2f * j)))
                 {
                     this.animationComplete = false;
                     this.suggestedDisplayedCards[j].X = Math.Min((int) (this.suggestedDisplayedCards[j].Position.X + 70), (int) (this.BASE_CARD_POS + (0x2f * j)));
                 }
             }
         }
         this.Dirty = true;
         base.invalidate();
     }
     if ((this.showExtras && (this.animatedCard != null)) && (this.animationCounter < 30))
     {
         int red = ((this.animationCounter % 10) + 11) * 12;
         this.animatedCard.Hilight(Color.FromArgb(red, red, red));
         this.animationCounter++;
         if (this.animationCounter == 10)
         {
             this.animatedCard.Y -= 2;
         }
         this.Dirty = true;
         base.invalidate();
     }
     else if (this.showExtras && (this.animatedCard != null))
     {
         this.animatedCard.Hilight(ARGBColors.White);
         this.animatedCard = null;
         this.Dirty = true;
         base.invalidate();
     }
     if (this.showExtras && (this.suggestedNext.Data > 0))
     {
         this.suggestedNext.Data--;
         if (this.suggestedNext.Data == 0)
         {
             this.suggestedNext.Image = (Image) GFXLibrary.cardbar_right[1];
             this.Dirty = true;
             base.invalidate();
         }
     }
     if (this.showExtras && (this.suggestedPrev.Data > 0))
     {
         this.suggestedPrev.Data--;
         if (this.suggestedPrev.Data == 0)
         {
             this.suggestedPrev.Image = (Image) GFXLibrary.cardbar_left[1];
             this.Dirty = true;
             base.invalidate();
         }
     }
     if (flag)
     {
         this.Dirty = true;
         this.lastAvailableToPlay = num8;
         int count = this.displayedCards.Count;
         if (count > this.numCardCirclesVisible)
         {
             count = this.numCardCirclesVisible;
         }
         this.circleCardsText.Text = num8.ToString();
         if (this.suggestedDisplayedCards.Count != 0)
         {
             base.invalidate();
             return true;
         }
         for (int k = 0; k < this.numCardCirclesVisible; k++)
         {
             this.getCircle(k).Visible = false;
         }
         for (int m = 0; m < count; m++)
         {
             CardCircle circle2 = this.getCircle(m);
             DisplayCardInfo info3 = this.displayedCards[m];
             circle2.Image = GFXLibrary.card_circles_timer[info3.currentFrame];
             circle2.Visible = true;
             circle2.FXImage = GFXLibrary.card_circles_icons[info3.imageID];
             circle2.scaleFXImage(info3.imageID == 0x21);
             int effect = (int) info3.effect;
             NumberFormatInfo provider = null;
             if (effect == info3.effect)
             {
                 provider = GameEngine.NFI;
             }
             else
             {
                 provider = GameEngine.NFI_D1;
             }
             string str = "";
             if (addX(info3.card))
             {
                 str = "x" + info3.effect.ToString("N", provider);
             }
             else if (addPlus(info3.card))
             {
                 str = "+" + info3.effect.ToString("N", provider);
             }
             else if (info3.effect != 0.0)
             {
                 str = info3.effect.ToString("N", provider);
             }
             else
             {
                 str = "";
             }
             if (addPercent(info3.card))
             {
                 str = str + "%";
             }
             circle2.Text = str;
             circle2.CustomTooltipID = 0x2710;
             circle2.CustomTooltipData = info3.card;
         }
         if (this.showExtras)
         {
             this.circleCards.X = 10 + (0x35 * count);
             this.suggestedExpand.X = ((0x35 * count) + 0x10) + this.circleCards.Image.Size.Width;
             this.mainText.X = (this.circleCards.X + 0x35) + 5;
         }
         base.invalidate();
     }
     return flag;
 }
        public override void setData(GetReport_ReturnType returnData)
        {
            CardTypes.CardDefinition definition;
            base.setData(returnData);
            this.cardText = CardTypes.getDescriptionFromCard(returnData.genericData1);
            switch (returnData.reportType)
            {
            case 0x4c:
                base.lblSecondaryText.Text = this.cardText;
                base.lblSubTitle.Text      = SK.Text("Reports_Card_Expires", "Card Expires");
                break;

            case 0x4d:
                base.lblSubTitle.Text      = SK.Text("Reports_Instant_Card_Played", "Instant Card Played");
                base.lblSecondaryText.Text = this.cardText;
                switch (CardTypes.getCardType(returnData.genericData1))
                {
                case 0xc05:
                case 0xc06:
                case 0xc07:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_honour;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xc08:
                case 0xc09:
                case 0xc0a:
                case 0xc0b:
                case 0xc0c:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_money;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xc0d:
                case 0xc0e:
                case 0xc0f:
                case 0xc10:
                    this.setResources(13, returnData.genericData2);
                    goto Label_0838;

                case 0xc11:
                case 0xc12:
                case 0xc13:
                case 0xc14:
                    this.setResources(0x11, returnData.genericData2);
                    goto Label_0838;

                case 0xc15:
                case 0xc16:
                case 0xc17:
                case 0xc18:
                    this.setResources(0x10, returnData.genericData2);
                    goto Label_0838;

                case 0xc19:
                case 0xc1a:
                case 0xc1b:
                case 0xc1c:
                    this.setResources(14, returnData.genericData2);
                    goto Label_0838;

                case 0xc1d:
                case 0xc1e:
                case 0xc1f:
                case 0xc20:
                    this.setResources(15, returnData.genericData2);
                    goto Label_0838;

                case 0xc21:
                case 0xc22:
                case 0xc23:
                case 0xc24:
                    this.setResources(0x12, returnData.genericData2);
                    goto Label_0838;

                case 0xc25:
                case 0xc26:
                case 0xc27:
                case 0xc28:
                    this.setResources(12, returnData.genericData2);
                    goto Label_0838;

                case 0xc29:
                case 0xc2a:
                case 0xc2b:
                case 0xc2c:
                    this.setResources(6, returnData.genericData2);
                    goto Label_0838;

                case 0xc2d:
                case 0xc2e:
                case 0xc2f:
                case 0xc30:
                    this.setResources(7, returnData.genericData2);
                    goto Label_0838;

                case 0xc31:
                case 0xc32:
                case 0xc33:
                case 0xc34:
                    this.setResources(8, returnData.genericData2);
                    goto Label_0838;

                case 0xc35:
                case 0xc36:
                case 0xc37:
                case 0xc38:
                    this.setResources(9, returnData.genericData2);
                    goto Label_0838;

                case 0xc39:
                case 0xc3a:
                case 0xc3b:
                case 0xc3c:
                    this.setResources(0x16, returnData.genericData2);
                    goto Label_0838;

                case 0xc3d:
                case 0xc3e:
                case 0xc3f:
                case 0xc40:
                    this.setResources(0x15, returnData.genericData2);
                    goto Label_0838;

                case 0xc41:
                case 0xc42:
                case 0xc43:
                case 0xc44:
                    this.setResources(0x1a, returnData.genericData2);
                    goto Label_0838;

                case 0xc45:
                case 0xc46:
                case 0xc47:
                case 0xc48:
                    this.setResources(0x13, returnData.genericData2);
                    goto Label_0838;

                case 0xc49:
                case 0xc4a:
                case 0xc4b:
                case 0xc4c:
                    this.setResources(0x21, returnData.genericData2);
                    goto Label_0838;

                case 0xc4d:
                case 0xc4e:
                case 0xc4f:
                case 0xc50:
                    this.setResources(0x17, returnData.genericData2);
                    goto Label_0838;

                case 0xc51:
                case 0xc52:
                case 0xc53:
                case 0xc54:
                    this.setResources(0x18, returnData.genericData2);
                    goto Label_0838;

                case 0xc55:
                case 0xc56:
                case 0xc57:
                case 0xc58:
                    this.setResources(0x19, returnData.genericData2);
                    goto Label_0838;

                case 0xc59:
                case 0xc5a:
                case 0xc5b:
                case 0xc5c:
                    this.setResources(0x1d, returnData.genericData2);
                    goto Label_0838;

                case 0xc5d:
                case 0xc5e:
                case 0xc5f:
                case 0xc60:
                    this.setResources(0x1c, returnData.genericData2);
                    goto Label_0838;

                case 0xc61:
                case 0xc62:
                case 0xc63:
                case 0xc64:
                    this.setResources(0x1f, returnData.genericData2);
                    goto Label_0838;

                case 0xc65:
                case 0xc66:
                case 0xc67:
                case 0xc68:
                    this.setResources(30, returnData.genericData2);
                    goto Label_0838;

                case 0xc69:
                case 0xc6a:
                case 0xc6b:
                case 0xc6c:
                    this.setResources(0x20, returnData.genericData2);
                    goto Label_0838;

                case 0xcc0:
                case 0xcc1:
                case 0xcc2:
                case 0xcc3:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.r_building_miltary_peasent;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xcc4:
                case 0xcc5:
                case 0xcc6:
                case 0xcc7:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.r_building_miltary_archer;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xcc8:
                case 0xcc9:
                case 0xcca:
                case 0xccb:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.r_building_miltary_pikemen;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xccc:
                case 0xccd:
                case 0xcce:
                case 0xccf:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.r_building_miltary_swordsman;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xcd0:
                case 0xcd1:
                case 0xcd2:
                case 0xcd3:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.r_building_miltary_catapult;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xcd7:
                case 0xcd8:
                case 0xcd9:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.r_building_miltary_scout;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xcda:
                case 0xcdb:
                case 0xcdc:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.monk_icon;
                    this.setResources(-1, -1);
                    goto Label_0838;

                case 0xcdd:
                case 0xcde:
                case 0xcdf:
                    base.lblFurther.Text  = returnData.genericData2.ToString();
                    base.imgFurther.Image = (Image)GFXLibrary.merchant_icon;
                    this.setResources(-1, -1);
                    goto Label_0838;
                }
                break;

            case 0x63:
                base.lblSecondaryText.Text = this.cardText;
                base.lblSubTitle.Text      = SK.Text("ReportsPanel_Card_Used", "Card Used and Expired");
                break;
            }
Label_0838:
            definition = new CardTypes.CardDefinition();
            definition.cardCategory = CardTypes.getCardCategory(returnData.genericData1);
            GameEngine.Instance.World.searchProfileCards(definition, "meta", this.cardText);
            foreach (int num in GameEngine.Instance.World.ProfileCardsSearch)
            {
                if (GameEngine.Instance.World.ProfileCards[num].id == CardTypes.getCardType(returnData.genericData1))
                {
                    this.btnReplay.Visible = true;
                    break;
                }
            }
            base.btnUtility.Text.Text = SK.Text("GENERIC_Cards", "Cards");
            base.btnUtility.Visible   = true;
        }
Esempio n. 4
0
 public void init(CardTypes.CardDefinition def, ConfirmPlayCardPanel.CardClickPlayDelegate callback)
 {
     this.confirmPanel.init(def, callback);
 }
 public void NewFilterClick()
 {
     CustomSelfDrawPanel.CSDButton clickedControl = (CustomSelfDrawPanel.CSDButton) base.ClickedControl;
     if (!this.waitingResponse)
     {
         CardTypes.CardDefinition filter = new CardTypes.CardDefinition();
         int data = clickedControl.Data;
         this.usingRecentFilter = data == 0x100000;
         if (data == 0x200000)
         {
             filter.cardRank = GameEngine.Instance.World.getRank() + 1;
         }
         else
         {
             filter.newCardCategoryFilter = data;
         }
         GameEngine.Instance.World.searchProfileCards(filter, "", ((PlayCardsWindow) base.ParentForm).getNameSearchText());
         if ((data & 0xff) == 0)
         {
             if (!this.searchButton.Visible && !((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible)
             {
                 this.searchButton.Visible = true;
             }
             ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = !this.searchButton.Visible;
         }
         else
         {
             ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = false;
             this.searchButton.Visible = false;
         }
         this.InitFilters();
     }
     this.labelTitle.Text = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(CardFilters.getName2(clickedControl.CustomTooltipData).ToLower()) + " : " + GameEngine.Instance.World.countCardsInCategory(clickedControl.CustomTooltipData).ToString();
     if (this.usingRecentFilter)
     {
         this.sortBack.Visible = false;
         this.GetCardsRecent();
         ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = false;
         this.searchButton.Visible = false;
     }
     else
     {
         this.GetCardsAvailable(true);
     }
     this.clearSearchButton.Visible = ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible;
     int height = this.RefreshCards(this.AvailablePanelContent, this.UICardList, 500);
     this.AvailablePanelContent.Size = new Size(this.AvailablePanel.Width, height);
     this.scrollbarAvailable.Value = 0;
     this.UpdateScrollbar(this.scrollbarAvailable, this.AvailablePanelContent);
     this.AvailableContentScroll();
     base.Invalidate();
 }
 public void init(int cardSection)
 {
     CustomSelfDrawPanel.CSDImage image2;
     this.currentCardSection = cardSection;
     base.clearControls();
     this.mainBackgroundImage.Image = GFXLibrary.dummy;
     this.mainBackgroundImage.Position = new Point(0, 0);
     this.mainBackgroundImage.Size = base.Size;
     this.mainBackgroundImage.Tile = true;
     base.addControl(this.mainBackgroundImage);
     this.ContentWidth = base.Width - (2 * BorderPadding);
     this.AvailablePanelWidth = 800;
     this.InplayPanelWidth = (this.ContentWidth - BorderPadding) - this.AvailablePanelWidth;
     CustomSelfDrawPanel.CSDExtendingPanel control = new CustomSelfDrawPanel.CSDExtendingPanel {
         Size = base.Size,
         Position = new Point(0, 0)
     };
     this.mainBackgroundImage.addControl(control);
     control.Create((Image) GFXLibrary.cardpanel_panel_back_top_left, (Image) GFXLibrary.cardpanel_panel_back_top_mid, (Image) GFXLibrary.cardpanel_panel_back_top_right, (Image) GFXLibrary.cardpanel_panel_back_mid_left, (Image) GFXLibrary.cardpanel_panel_back_mid_mid, (Image) GFXLibrary.cardpanel_panel_back_mid_right, (Image) GFXLibrary.cardpanel_panel_back_bottom_left, (Image) GFXLibrary.cardpanel_panel_back_bottom_mid, (Image) GFXLibrary.cardpanel_panel_back_bottom_right);
     CustomSelfDrawPanel.CSDImage image = new CustomSelfDrawPanel.CSDImage {
         Image = (Image) GFXLibrary.cardpanel_panel_gradient_top_left,
         Size = GFXLibrary.cardpanel_panel_gradient_top_left.Size,
         Position = new Point(0, 0)
     };
     control.addControl(image);
     image2 = new CustomSelfDrawPanel.CSDImage {
         Image = (Image) GFXLibrary.cardpanel_panel_gradient_bottom_right,
         Size = GFXLibrary.cardpanel_panel_gradient_bottom_right.Size,
         Position = new Point((control.Width - ((Image) GFXLibrary.cardpanel_panel_gradient_bottom_right).Width) - 6, (control.Height - ((Image) GFXLibrary.cardpanel_panel_gradient_bottom_right).Height) - 6)
     };
     control.addControl(image2);
     this.AvailablePanel = new CustomSelfDrawPanel.CSDExtendingPanel();
     this.AvailablePanel.Size = new Size(this.AvailablePanelWidth, 550);
     this.AvailablePanel.Position = new Point(8, (base.Height - 8) - 550);
     this.AvailablePanel.Alpha = 0.8f;
     this.mainBackgroundImage.addControl(this.AvailablePanel);
     this.AvailablePanel.Create((Image) GFXLibrary.cardpanel_panel_black_top_left, (Image) GFXLibrary.cardpanel_panel_black_top_mid, (Image) GFXLibrary.cardpanel_panel_black_top_right, (Image) GFXLibrary.cardpanel_panel_black_mid_left, (Image) GFXLibrary.cardpanel_panel_black_mid_mid, (Image) GFXLibrary.cardpanel_panel_black_mid_right, (Image) GFXLibrary.cardpanel_panel_black_bottom_left, (Image) GFXLibrary.cardpanel_panel_black_bottom_mid, (Image) GFXLibrary.cardpanel_panel_black_bottom_right);
     this.sortBack.Image = (Image) GFXLibrary.sort_back;
     this.sortBack.Position = new Point(12, this.AvailablePanel.Height - 0x25);
     this.sortBack.Visible = true;
     this.AvailablePanel.addControl(this.sortBack);
     this.sortByName.ImageNorm = (Image) GFXLibrary.sort_normal;
     this.sortByName.ImageOver = (Image) GFXLibrary.sort_over;
     this.sortByName.ImageClick = (Image) GFXLibrary.sort_in;
     this.sortByName.Position = new Point(7, 4);
     this.sortByName.Text.Text = SK.Text("Card_Sorting_Name", "Sort By Name");
     this.sortByName.Text.Color = ARGBColors.White;
     this.sortByName.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular);
     this.sortByName.TextYOffset = -1;
     this.sortByName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.sortByNameClicked), "PlayCardsPanel_sort_by_name");
     this.sortBack.addControl(this.sortByName);
     this.sortByType.ImageNorm = (Image) GFXLibrary.sort_normal;
     this.sortByType.ImageOver = (Image) GFXLibrary.sort_over;
     this.sortByType.ImageClick = (Image) GFXLibrary.sort_in;
     this.sortByType.Position = new Point(0xe4, 4);
     this.sortByType.Text.Text = SK.Text("Card_Sorting_Type", "Sort By Type");
     this.sortByType.Text.Color = ARGBColors.White;
     this.sortByType.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular);
     this.sortByType.TextYOffset = -1;
     this.sortByType.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.sortByTypeClicked), "PlayCardsPanel_sort_by_type");
     this.sortBack.addControl(this.sortByType);
     this.sortByQuantity.ImageNorm = (Image) GFXLibrary.sort_normal;
     this.sortByQuantity.ImageOver = (Image) GFXLibrary.sort_over;
     this.sortByQuantity.ImageClick = (Image) GFXLibrary.sort_in;
     this.sortByQuantity.Position = new Point(0x1c1, 4);
     this.sortByQuantity.Text.Text = SK.Text("Card_Sorting_Quantity", "Sort By Quantity");
     this.sortByQuantity.Text.Color = ARGBColors.White;
     this.sortByQuantity.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular);
     this.sortByQuantity.TextYOffset = -1;
     this.sortByQuantity.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.sortByQuantityClicked), "PlayCardsPanel_sort_by_type");
     this.sortBack.addControl(this.sortByQuantity);
     this.sortByRarity.ImageNorm = (Image) GFXLibrary.sort_normal;
     this.sortByRarity.ImageOver = (Image) GFXLibrary.sort_over;
     this.sortByRarity.ImageClick = (Image) GFXLibrary.sort_in;
     this.sortByRarity.Position = new Point(0x170, 4);
     this.sortByRarity.Text.Text = SK.Text("Card_Sorting_Rarity", "Sort By Rarity");
     this.sortByRarity.Text.Color = ARGBColors.White;
     this.sortByRarity.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular);
     this.sortByRarity.TextYOffset = -1;
     this.sortByRarity.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.sortByRarityClicked), "PlayCardsPanel_sort_by_rarity");
     this.compressButton.ImageNorm = (Image) GFXLibrary.r_popularity_panel_but_minus_norm;
     this.compressButton.ImageOver = (Image) GFXLibrary.r_popularity_panel_but_minus_over;
     this.compressButton.ImageClick = (Image) GFXLibrary.r_popularity_panel_but_minus_in;
     this.compressButton.Position = new Point(0x2a5, 0x10);
     this.compressButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.compressClicked), "PlayCardsPanel_compress_cards");
     this.sortBack.addControl(this.compressButton);
     this.expandButton.ImageNorm = (Image) GFXLibrary.r_popularity_panel_but_plus_norm;
     this.expandButton.ImageOver = (Image) GFXLibrary.r_popularity_panel_but_plus_over;
     this.expandButton.ImageClick = (Image) GFXLibrary.r_popularity_panel_but_plus_in;
     this.expandButton.Position = new Point(0x2a5, -2);
     this.expandButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.expandClicked), "PlayCardsPanel_expand_cards");
     this.sortBack.addControl(this.expandButton);
     if ((this.sortByMode == 0) || (this.sortByMode == 2))
     {
         this.sortByName.Alpha = 0.5f;
         this.sortByType.Alpha = 1f;
         this.sortByQuantity.Alpha = 0.5f;
     }
     else if ((this.sortByMode == 1) || (this.sortByMode == 3))
     {
         this.sortByName.Alpha = 1f;
         this.sortByType.Alpha = 0.5f;
         this.sortByQuantity.Alpha = 0.5f;
     }
     else if ((this.sortByMode == 7) || (this.sortByMode == 8))
     {
         this.sortByName.Alpha = 0.5f;
         this.sortByType.Alpha = 0.5f;
         this.sortByQuantity.Alpha = 1f;
     }
     else
     {
         this.sortByName.Alpha = 1f;
         this.sortByType.Alpha = 1f;
         this.sortByQuantity.Alpha = 1f;
     }
     int width = base.Width;
     int borderPadding = BorderPadding;
     int num3 = this.AvailablePanel.Width;
     this.closeImage.Image = (Image) GFXLibrary.cardpanel_button_close_normal;
     this.closeImage.Size = this.closeImage.Image.Size;
     this.closeImage.setMouseOverDelegate(() => this.closeImage.Image = (Image) GFXLibrary.cardpanel_button_close_over, () => this.closeImage.Image = (Image) GFXLibrary.cardpanel_button_close_normal);
     this.closeImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick), "Cards_Close");
     this.closeImage.Position = new Point((base.Width - 14) - 0x11, 10);
     this.closeImage.CustomTooltipID = 0x2774;
     this.mainBackgroundImage.addControl(this.closeImage);
     CustomSelfDrawPanel.WikiLinkControl.init(this.mainBackgroundImage, 0x19, new Point((((base.Width - 1) - 0x11) - 50) + 3, 5), true);
     CustomSelfDrawPanel.CSDFill fill = new CustomSelfDrawPanel.CSDFill {
         FillColor = Color.FromArgb(0xff, 130, 0x81, 0x7e),
         Size = new Size(base.Width - 10, 1),
         Position = new Point(5, 0x22)
     };
     this.mainBackgroundImage.addControl(fill);
     CustomSelfDrawPanel.UICardsButtons buttons = new CustomSelfDrawPanel.UICardsButtons((PlayCardsWindow) base.ParentForm) {
         Position = new Point(0x328, 0x25)
     };
     this.mainBackgroundImage.addControl(buttons);
     this.labelTitle.Position = new Point(0x1b, 8);
     this.labelTitle.Size = new Size(600, 0x40);
     this.labelTitle.Text = "";
     this.labelTitle.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.labelTitle.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold);
     this.labelTitle.Color = ARGBColors.Black;
     this.mainBackgroundImage.addControl(this.labelTitle);
     if (cardSection != 0)
     {
         CustomSelfDrawPanel.CSDButton button = new CustomSelfDrawPanel.CSDButton {
             ImageNorm = (Image) GFXLibrary.button_cards_all_normal,
             ImageOver = (Image) GFXLibrary.button_cards_all_over,
             ImageClick = (Image) GFXLibrary.button_cards_all_over,
             Position = new Point(390, 0)
         };
         button.Text.Text = SK.Text("PlayCardsPanel_All_Your_Cards", "All Your Cards");
         button.TextYOffset = -3;
         button.Text.Color = ARGBColors.Black;
         button.Text.Size = new Size(button.Size.Width - 0x2d, button.Size.Height);
         button.Text.Position = new Point(0x2d, 0);
         button.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
         button.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.showAllCardsClick), "PlayCardsPanel_show_all_cards");
         this.mainBackgroundImage.addControl(button);
     }
     CustomSelfDrawPanel.CSDButton button2 = new CustomSelfDrawPanel.CSDButton {
         ImageNorm = (Image) GFXLibrary.button_cards_in_play_normal,
         ImageOver = (Image) GFXLibrary.button_cards_in_play_over,
         ImageClick = (Image) GFXLibrary.button_cards_in_play_over,
         Position = new Point(570, 0)
     };
     button2.Text.Text = SK.Text("PlayCardsPanel_Cards_In_Play", "Cards In Play");
     button2.TextYOffset = -3;
     button2.Text.Color = ARGBColors.Black;
     button2.Text.Size = new Size(button2.Size.Width - 30, button2.Size.Height);
     button2.Text.Position = new Point(30, 0);
     button2.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
     button2.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.showCardsInPlay), "PlayCardsPanel_cards_in_play");
     this.mainBackgroundImage.addControl(button2);
     this.searchButton.ImageNorm = (Image) GFXLibrary.int_statsscreen_search_button_normal;
     this.searchButton.ImageOver = (Image) GFXLibrary.int_statsscreen_search_button_over;
     this.searchButton.ImageClick = (Image) GFXLibrary.int_statsscreen_search_button_pushed;
     this.searchButton.Position = new Point(0x32b, 7);
     this.searchButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.searchClicked), "StatsPanel_search");
     this.searchButton.CustomTooltipID = 0x284f;
     this.searchButton.Visible = true;
     this.mainBackgroundImage.addControl(this.searchButton);
     this.clearSearchButton.ImageNorm = (Image) GFXLibrary.int_statsscreen_search_clear_button_normal;
     this.clearSearchButton.ImageOver = (Image) GFXLibrary.int_statsscreen_search_clear_button_over;
     this.clearSearchButton.ImageClick = (Image) GFXLibrary.int_statsscreen_search_clear_button_pushed;
     this.clearSearchButton.Position = new Point(740, 7);
     this.clearSearchButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clearSearchClicked), "StatsPanel_clear_search");
     this.clearSearchButton.Visible = false;
     this.clearSearchButton.CustomTooltipID = 0x2850;
     this.mainBackgroundImage.addControl(this.clearSearchButton);
     CardTypes.CardDefinition filter = new CardTypes.CardDefinition {
         cardCategory = cardSection
     };
     if ((GameEngine.Instance.World.getTutorialStage() == 8) || (GameEngine.Instance.World.getTutorialStage() == 12))
     {
         filter.rewardcard = true;
     }
     filter.rewardcard = true;
     GameEngine.Instance.World.searchProfileCards(filter, "", ((PlayCardsWindow) base.ParentForm).getNameSearchText());
     if (cardSection < 15)
     {
         this.sectionName = CardSections.getName(cardSection);
     }
     else
     {
         this.sectionName = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(CardFilters.getName2(cardSection).ToLower());
     }
     this.labelTitle.Text = this.sectionName + " : " + GameEngine.Instance.World.ProfileCardsSearch.Count.ToString();
     this.GetCardsAvailable(false);
     this.RenderCards();
     this.mainBackgroundImage.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelHandler));
     if (cardSection == 0)
     {
         this.InitFilters();
     }
     if (cardSection == 0)
     {
         ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = !this.searchButton.Visible;
     }
     else
     {
         ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = false;
     }
     base.Invalidate();
 }
 public void FilterClick()
 {
     if (!this.waitingResponse)
     {
         CustomSelfDrawPanel.CSDButton clickedControl = (CustomSelfDrawPanel.CSDButton) base.ClickedControl;
         int data = clickedControl.Data;
         CardTypes.CardDefinition filter = new CardTypes.CardDefinition();
         if (data != 0x3e7)
         {
             filter.cardFilter = data;
         }
         else
         {
             filter.cardColour = 2;
         }
         GameEngine.Instance.World.searchProfileCards(filter, "", ((PlayCardsWindow) base.ParentForm).getNameSearchText());
     }
     this.GetCardsAvailable(true);
     int height = this.RefreshCards(this.AvailablePanelContent, this.UICardList, 500);
     this.AvailablePanelContent.Size = new Size(this.AvailablePanel.Width, height);
     this.scrollbarAvailable.Value = 0;
     this.UpdateScrollbar(this.scrollbarAvailable, this.AvailablePanelContent);
     this.AvailableContentScroll();
     base.Invalidate();
 }
 public void setFilter(int filterGroup)
 {
     this.CatalogFilterDefinition = new CardTypes.CardDefinition();
     this.CatalogFilterDefinition.newCardCategoryFilter = filterGroup;
     CardTypes.CardDefinition definition = new CardTypes.CardDefinition {
         newCardCategoryFilter = filterGroup
     };
     GameEngine.Instance.World.lastUserCardSearchCriteria = definition;
 }
 public void NewFilterClick()
 {
     if (!this.cashingIn && !this.buyingCard)
     {
         CustomSelfDrawPanel.CSDButton clickedControl = (CustomSelfDrawPanel.CSDButton) base.ClickedControl;
         int data = clickedControl.Data;
         if (this.PanelMode == PANEL_MODE_CASH)
         {
             CardTypes.CardDefinition filter = new CardTypes.CardDefinition {
                 newCardCategoryFilter = data
             };
             this.CatalogFilterDefinition = new CardTypes.CardDefinition();
             this.CatalogFilterDefinition.newCardCategoryFilter = data;
             if ((data & 0xff) == 0)
             {
                 if (!this.searchButton.Visible && !((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible)
                 {
                     this.searchButton.Visible = true;
                 }
                 ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = !this.searchButton.Visible;
             }
             else
             {
                 ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = false;
                 this.searchButton.Visible = false;
             }
             GameEngine.Instance.World.searchProfileCards(filter, "", ((PlayCardsWindow) base.ParentForm).getNameSearchText());
             this.SwitchToCash();
         }
         else if (this.PanelMode == PANEL_MODE_BUY)
         {
             this.CatalogFilterDefinition = new CardTypes.CardDefinition();
             this.CatalogFilterDefinition.newCardCategoryFilter = data;
             CardTypes.CardDefinition definition2 = new CardTypes.CardDefinition {
                 newCardCategoryFilter = data
             };
             if ((data & 0xff) == 0)
             {
                 if (!this.searchButton.Visible && !((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible)
                 {
                     this.searchButton.Visible = true;
                 }
                 ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = !this.searchButton.Visible;
             }
             else
             {
                 ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = false;
                 this.searchButton.Visible = false;
             }
             GameEngine.Instance.World.lastUserCardSearchCriteria = definition2;
             GameEngine.Instance.World.lastUserCardNameFilter = ((PlayCardsWindow) base.ParentForm).getNameSearchText();
             this.SwitchToBuy();
         }
         this.clearSearchButton.Visible = ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible;
     }
 }
 public void init(int cardSection)
 {
     CustomSelfDrawPanel.CSDImage image2;
     CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate overDelegate = null;
     CustomSelfDrawPanel.CSDControl.CSD_MouseOverDelegate leaveDelegate = null;
     this.currentCardSection = cardSection;
     base.clearControls();
     this.mainBackgroundImage.Image = GFXLibrary.dummy;
     this.mainBackgroundImage.Position = new Point(0, 0);
     this.mainBackgroundImage.Size = base.Size;
     this.mainBackgroundImage.Tile = true;
     base.addControl(this.mainBackgroundImage);
     this.ContentWidth = base.Width - (2 * BorderPadding);
     this.AvailablePanelWidth = 800;
     this.InplayPanelWidth = (this.ContentWidth - BorderPadding) - this.AvailablePanelWidth;
     CustomSelfDrawPanel.CSDExtendingPanel panel = new CustomSelfDrawPanel.CSDExtendingPanel {
         Size = base.Size,
         Position = new Point(0, 0)
     };
     this.mainBackgroundImage.addControl(panel);
     panel.Create((Image) GFXLibrary.cardpanel_panel_back_top_left, (Image) GFXLibrary.cardpanel_panel_back_top_mid, (Image) GFXLibrary.cardpanel_panel_back_top_right, (Image) GFXLibrary.cardpanel_panel_back_mid_left, (Image) GFXLibrary.cardpanel_panel_back_mid_mid, (Image) GFXLibrary.cardpanel_panel_back_mid_right, (Image) GFXLibrary.cardpanel_panel_back_bottom_left, (Image) GFXLibrary.cardpanel_panel_back_bottom_mid, (Image) GFXLibrary.cardpanel_panel_back_bottom_right);
     CustomSelfDrawPanel.CSDImage image = new CustomSelfDrawPanel.CSDImage {
         Image = (Image) GFXLibrary.cardpanel_panel_gradient_top_left,
         Size = GFXLibrary.cardpanel_panel_gradient_top_left.Size,
         Position = new Point(0, 0)
     };
     panel.addControl(image);
     image2 = new CustomSelfDrawPanel.CSDImage {
         Image = (Image) GFXLibrary.cardpanel_panel_gradient_bottom_right,
         Size = GFXLibrary.cardpanel_panel_gradient_bottom_right.Size,
         Position = new Point((panel.Width - ((Image) GFXLibrary.cardpanel_panel_gradient_bottom_right).Width) - 6, (panel.Height - ((Image) GFXLibrary.cardpanel_panel_gradient_bottom_right).Height) - 6)
     };
     panel.addControl(image2);
     this.AvailablePanel = new CustomSelfDrawPanel.CSDExtendingPanel();
     this.AvailablePanel.Size = new Size(this.AvailablePanelWidth, 0x177);
     this.AvailablePanel.Position = new Point(8, (base.Height - 8) - 0x177);
     this.AvailablePanel.Alpha = 0.8f;
     this.mainBackgroundImage.addControl(this.AvailablePanel);
     this.AvailablePanel.Create((Image) GFXLibrary.cardpanel_panel_black_top_left, (Image) GFXLibrary.cardpanel_panel_black_top_mid, (Image) GFXLibrary.cardpanel_panel_black_top_right, (Image) GFXLibrary.cardpanel_panel_black_mid_left, (Image) GFXLibrary.cardpanel_panel_black_mid_mid, (Image) GFXLibrary.cardpanel_panel_black_mid_right, (Image) GFXLibrary.cardpanel_panel_black_bottom_left, (Image) GFXLibrary.cardpanel_panel_black_bottom_mid, (Image) GFXLibrary.cardpanel_panel_black_bottom_right);
     int width = base.Width;
     int borderPadding = BorderPadding;
     int num3 = this.AvailablePanel.Width;
     this.closeImage.Image = (Image) GFXLibrary.cardpanel_button_close_normal;
     this.closeImage.Size = this.closeImage.Image.Size;
     this.closeImage.setMouseOverDelegate(() => this.closeImage.Image = (Image) GFXLibrary.cardpanel_button_close_over, () => this.closeImage.Image = (Image) GFXLibrary.cardpanel_button_close_normal);
     this.closeImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick), "Cards_Close");
     this.closeImage.CustomTooltipID = 0x2774;
     this.closeImage.Position = new Point((base.Width - 14) - 0x11, 10);
     this.mainBackgroundImage.addControl(this.closeImage);
     CustomSelfDrawPanel.WikiLinkControl.init(this.mainBackgroundImage, 40, new Point((((base.Width - 1) - 0x11) - 50) + 3, 5), true);
     CustomSelfDrawPanel.CSDFill fill = new CustomSelfDrawPanel.CSDFill {
         FillColor = Color.FromArgb(0xff, 130, 0x81, 0x7e),
         Size = new Size(base.Width - 10, 1),
         Position = new Point(5, 0x22)
     };
     this.mainBackgroundImage.addControl(fill);
     this.cardsButtons = new CustomSelfDrawPanel.UICardsButtons((PlayCardsWindow) base.ParentForm);
     this.cardsButtons.Position = new Point(0x328, 0x25);
     this.mainBackgroundImage.addControl(this.cardsButtons);
     this.labelTitle.Position = new Point(0x1b, 8);
     this.labelTitle.Size = new Size(600, 0x40);
     this.labelTitle.Text = "";
     this.labelTitle.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.labelTitle.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold);
     this.labelTitle.Color = ARGBColors.Black;
     this.mainBackgroundImage.addControl(this.labelTitle);
     this.labelTitlePoints.Position = new Point(0x1b, 8);
     this.labelTitlePoints.Size = new Size(600, 0x40);
     this.labelTitlePoints.Text = "";
     this.labelTitlePoints.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.labelTitlePoints.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold);
     this.labelTitlePoints.Color = ARGBColors.Black;
     this.mainBackgroundImage.addControl(this.labelTitlePoints);
     this.imageTitlePoints.Image = (Image) GFXLibrary.cardpanel_manage_card_points_icon;
     this.imageTitlePoints.Position = new Point(400, 5);
     this.mainBackgroundImage.addControl(this.imageTitlePoints);
     this.searchButton.ImageNorm = (Image) GFXLibrary.int_statsscreen_search_button_normal;
     this.searchButton.ImageOver = (Image) GFXLibrary.int_statsscreen_search_button_over;
     this.searchButton.ImageClick = (Image) GFXLibrary.int_statsscreen_search_button_pushed;
     this.searchButton.Position = new Point(0x32b, 7);
     this.searchButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.searchClicked), "StatsPanel_search");
     this.searchButton.CustomTooltipID = 0x284f;
     this.searchButton.Visible = true;
     this.mainBackgroundImage.addControl(this.searchButton);
     this.clearSearchButton.ImageNorm = (Image) GFXLibrary.int_statsscreen_search_clear_button_normal;
     this.clearSearchButton.ImageOver = (Image) GFXLibrary.int_statsscreen_search_clear_button_over;
     this.clearSearchButton.ImageClick = (Image) GFXLibrary.int_statsscreen_search_clear_button_pushed;
     this.clearSearchButton.Position = new Point(740, 7);
     this.clearSearchButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clearSearchClicked), "StatsPanel_clear_search");
     this.clearSearchButton.Visible = false;
     this.clearSearchButton.CustomTooltipID = 0x2850;
     this.mainBackgroundImage.addControl(this.clearSearchButton);
     this.addPointsData();
     CustomSelfDrawPanel.CSDLabel label = new CustomSelfDrawPanel.CSDLabel {
         Position = new Point((2 * BorderPadding) + this.AvailablePanelWidth, BorderPadding),
         Size = new Size(300, 0x40),
         Text = SK.Text("ManageCandsPanel_Cards_In_Play", "Cards In Play"),
         Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT,
         Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold),
         Color = ARGBColors.White,
         DropShadowColor = ARGBColors.Black
     };
     this.cardTitle = new CustomSelfDrawPanel.CSDLabel();
     this.cardTitle.Position = new Point(0x10, 40);
     this.cardTitle.Size = new Size(600, 0x40);
     this.cardTitle.Text = string.Empty;
     this.cardTitle.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.cardTitle.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
     this.cardTitle.Color = ARGBColors.White;
     this.cardTitle.DropShadowColor = ARGBColors.Black;
     this.mainBackgroundImage.addControl(this.cardTitle);
     this.labelFeedback = new CustomSelfDrawPanel.CSDLabel();
     this.labelFeedback.Position = new Point(0x10, 500);
     this.labelFeedback.Size = new Size(600, 0x40);
     this.labelFeedback.Text = "";
     this.labelFeedback.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.labelFeedback.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
     this.labelFeedback.Color = ARGBColors.White;
     this.labelFeedback.DropShadowColor = ARGBColors.Black;
     this.mainBackgroundImage.addControl(this.labelFeedback);
     this.buttonCash = new CustomSelfDrawPanel.CSDImage();
     this.buttonBonus = new CustomSelfDrawPanel.CSDImage();
     this.buttonCatalog = new CustomSelfDrawPanel.CSDImage();
     this.buttonCash.Image = (Image) GFXLibrary.cardpanel_button_blue_normal;
     this.buttonCash.Size = this.buttonCash.Image.Size;
     this.buttonBonus.Image = (Image) GFXLibrary.cardpanel_button_blue_normal;
     this.buttonBonus.Size = this.buttonBonus.Image.Size;
     this.buttonCatalog.Image = (Image) GFXLibrary.cardpanel_button_blue_normal;
     this.buttonCatalog.Size = this.buttonCash.Image.Size;
     this.buttonCash.Position = new Point((this.AvailablePanel.X + (this.AvailablePanel.Width / 2)) - this.buttonCash.Width, this.cardsButtons.Y + 4);
     this.buttonBonus.Position = new Point(this.buttonCash.X, this.buttonCash.Y);
     this.buttonCatalog.Position = new Point(this.buttonCash.X - this.buttonCash.Width, this.buttonCash.Y);
     this.buttonBonus.setMouseOverDelegate(() => this.buttonBonus.Image = (Image) GFXLibrary.cardpanel_button_blue_over, () => this.buttonBonus.Image = (Image) GFXLibrary.cardpanel_button_blue_normal);
     this.buttonCash.setMouseOverDelegate(() => this.buttonCash.Image = (Image) GFXLibrary.cardpanel_button_blue_over, () => this.buttonCash.Image = (Image) GFXLibrary.cardpanel_button_blue_normal);
     this.buttonCatalog.setMouseOverDelegate(() => this.buttonCatalog.Image = (Image) GFXLibrary.cardpanel_button_blue_over, () => this.buttonCatalog.Image = (Image) GFXLibrary.cardpanel_button_blue_normal);
     this.buttonBonus.Visible = false;
     this.buttonCash.Visible = true;
     this.fastCashIn = Program.mySettings.fastCashIn;
     this.fastCashInCheckBox = new CustomSelfDrawPanel.CSDCheckBox();
     this.fastCashInCheckBox.CheckedImage = (Image) GFXLibrary.reports_checkbox_checked;
     this.fastCashInCheckBox.UncheckedImage = (Image) GFXLibrary.reports_checkbox_empty;
     this.fastCashInCheckBox.Position = new Point(this.AvailablePanel.X + 590, this.cardsButtons.Y + 160);
     this.fastCashInCheckBox.Checked = this.fastCashIn;
     this.fastCashInCheckBox.CBLabel.Text = SK.Text("ManageCards_multicashin", "Multi-Cash In");
     this.fastCashInCheckBox.CBLabel.Color = ARGBColors.Black;
     this.fastCashInCheckBox.CBLabel.Position = new Point(20, -1);
     this.fastCashInCheckBox.CBLabel.Size = new Size(250, 0x19);
     this.fastCashInCheckBox.CBLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular);
     this.fastCashInCheckBox.setCheckChangedDelegate(delegate {
         Program.mySettings.fastCashIn = this.fastCashIn = this.fastCashInCheckBox.Checked;
         this.RefreshSet();
     });
     this.mainBackgroundImage.addControl(this.fastCashInCheckBox);
     this.buyAndPlayCheckBox = new CustomSelfDrawPanel.CSDCheckBox();
     this.buyAndPlayCheckBox.CheckedImage = (Image) GFXLibrary.reports_checkbox_checked;
     this.buyAndPlayCheckBox.UncheckedImage = (Image) GFXLibrary.reports_checkbox_empty;
     this.buyAndPlayCheckBox.Position = new Point(this.AvailablePanel.X + 100, this.cardsButtons.Y + 0x5c);
     this.buyAndPlayCheckBox.Checked = false;
     this.buyAndPlayCheckBox.Visible = false;
     this.buyAndPlayCheckBox.CBLabel.Text = SK.Text("ManageCards_buyAndPlay", "Play Card Immediately");
     this.buyAndPlayCheckBox.CBLabel.Color = ARGBColors.Black;
     this.buyAndPlayCheckBox.CBLabel.Position = new Point(20, -1);
     this.buyAndPlayCheckBox.CBLabel.Size = new Size(250, 0x19);
     this.buyAndPlayCheckBox.CBLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
     this.buyAndPlayCheckBox.setCheckChangedDelegate(new CustomSelfDrawPanel.CSDCheckBox.CSD_CheckChangedDelegate(this.buyAndPlayCheckChanged));
     this.mainBackgroundImage.addControl(this.buyAndPlayCheckBox);
     CustomSelfDrawPanel.CSDLabel label2 = new CustomSelfDrawPanel.CSDLabel {
         Position = new Point(0, -2),
         Size = this.buttonCash.Size,
         Text = SK.Text("ManageCandsPanel_Cash_In", "Cash In"),
         Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER,
         Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular),
         Color = ARGBColors.Black
     };
     this.buttonCash.addControl(label2);
     CustomSelfDrawPanel.CSDLabel label3 = new CustomSelfDrawPanel.CSDLabel {
         Position = new Point(0, -2),
         Size = this.buttonCash.Size,
         Text = SK.Text("ManageCandsPanel_Cash_In", "Cash In"),
         Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER,
         Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular),
         Color = ARGBColors.Black
     };
     this.buttonBonus.addControl(label3);
     this.labelBuyCash = new CustomSelfDrawPanel.CSDLabel();
     this.labelBuyCash.Position = new Point(0, -2);
     this.labelBuyCash.Size = this.buttonCash.Size;
     this.labelBuyCash.Text = SK.Text("ManageCandsPanel_Get_Cards", "Get Cards");
     this.labelBuyCash.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
     this.labelBuyCash.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular);
     this.labelBuyCash.Color = ARGBColors.Black;
     this.LabelClickToRemove = new CustomSelfDrawPanel.CSDLabel();
     this.LabelClickToRemove.Position = new Point(this.AvailablePanel.X, this.cardsButtons.Y);
     this.LabelClickToRemove.Size = new Size(600, 0x12);
     this.LabelClickToRemove.Text = "";
     this.LabelClickToRemove.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.LabelClickToRemove.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
     this.LabelClickToRemove.Color = ARGBColors.Black;
     this.mainBackgroundImage.addControl(this.LabelClickToRemove);
     this.buttonCatalog.addControl(this.labelBuyCash);
     this.buttonCatalog.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.SwitchToBuy), "ManageCardsPanel_switch_to_buy_cards");
     if (GameEngine.Instance.World.ProfileCardsSet.Count < 5)
     {
         this.buttonCash.Colorise = ARGBColors.Gray;
         this.buttonCash.setMouseOverDelegate(null, null);
         this.buttonCash.setClickDelegate(null);
     }
     else
     {
         this.buttonCash.Colorise = ARGBColors.White;
         if (overDelegate == null)
         {
             overDelegate = () => this.buttonCash.Image = (Image) GFXLibrary.cardpanel_button_blue_over;
         }
         if (leaveDelegate == null)
         {
             leaveDelegate = () => this.buttonCash.Image = (Image) GFXLibrary.cardpanel_button_blue_normal;
         }
         this.buttonCash.setMouseOverDelegate(overDelegate, leaveDelegate);
         this.buttonCash.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.CashClick), "ManageCardsPanel_switch_to_cash_in");
     }
     this.LayoutPanelMode = this.PanelMode = PANEL_MODE_CASH;
     CardTypes.CardDefinition filter = new CardTypes.CardDefinition();
     GameEngine.Instance.World.searchProfileCards(filter, "", ((PlayCardsWindow) base.ParentForm).getNameSearchText());
     ((PlayCardsWindow) base.ParentForm).tbSearchBox.Visible = false;
     this.ResizeAvailable(0x177);
     this.GetCardsAvailable(false);
     this.RenderCards(this.UICardList);
     this.InitEmptyCards();
     this.RefreshSet();
     this.InitDynamicPanel();
     this.CatalogFilterDefinition.cardCategory = 0;
     this.CatalogFilterDefinition.cardColour = 0;
     this.InitCatalog();
     CustomSelfDrawPanel.CSDControl control = new CustomSelfDrawPanel.CSDControl {
         Position = new Point(0, 0),
         Size = base.Size
     };
     this.mainBackgroundImage.addControl(control);
     this.mainBackgroundImage.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelHandler));
     this.InitFilters();
     this.InitTabs();
     this.mainBackgroundImage.invalidate();
     GameEngine.shiftPressedAlways = false;
 }
 private void autoPlayCard(int userID, CardTypes.CardDefinition def, bool fromClick, bool fromValidate)
 {
     if (!this.waitingResponse)
     {
         this.waitingResponse = true;
         XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath);
         int villageID = -1;
         int num2 = InterfaceMgr.Instance.getSelectedMenuVillage();
         if (!GameEngine.Instance.World.isCapital(num2))
         {
             villageID = num2;
         }
         int num3 = GameEngine.Instance.World.getRank() + 1;
         if (def.cardRank > num3)
         {
             MyMessageBox.Show(SK.Text("BuyCardsPanel_Rank_Too_low", "Your rank is too low to play this card.") + Environment.NewLine + SK.Text("BuyCardsPanel_Current_Rank", "Current Rank") + " : " + num3.ToString() + Environment.NewLine + SK.Text("BuyCardsPanel_Required_Rank", "Required Rank") + " : " + def.cardRank.ToString(), SK.Text("BuyCardsPanel_Cannot_Play_Cards", "Could not play card."));
             this.waitingResponse = false;
         }
         else
         {
             this.autoCardUserID = userID;
             this.autoCardVillageID = villageID;
             this.autoCardDef = def;
             if (fromClick && Program.mySettings.ConfirmPlayCard)
             {
                 GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_open_confirmation");
                 base.PanelActive = false;
                 this.waitingResponse = false;
                 InterfaceMgr.Instance.openConfirmPlayCardPopup(this.autoCardDef, new ConfirmPlayCardPanel.CardClickPlayDelegate(this.autoPlayCardDelegate));
             }
             else if (!fromValidate && CardTypes.cardNeedsValidation(CardTypes.getCardType(this.autoCardDef.id)))
             {
                 this.validateCardPossible(CardTypes.getCardType(this.autoCardDef.id), villageID);
             }
             else
             {
                 if (InterfaceMgr.Instance.getCardWindow() != null)
                 {
                     CursorManager.SetCursor(CursorManager.CursorType.WaitCursor, InterfaceMgr.Instance.getCardWindow());
                 }
                 GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card");
                 StatTrackingClient.Instance().ActivateTrigger(0x10, this.buyAndPlayCheckBox.Checked);
                 provider.PlayUserCard(new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), RemoteServices.Instance.SessionGuid.ToString().Replace("-", ""), userID.ToString(), villageID.ToString(), RemoteServices.Instance.ProfileWorldID.ToString()), new CardsEndResponseDelegate(this.CardPlayed), this);
                 try
                 {
                     GameEngine.Instance.World.removeProfileCard(userID);
                 }
                 catch (Exception exception)
                 {
                     MyMessageBox.Show(exception.Message, SK.Text("BuyCardsPanel_Error_Report", "ERROR: Please report this error message"));
                 }
             }
         }
     }
 }