public void GetOffercontrolList() { if (offerimage == null) { offerimage = new Bitmap(180, 150); using (Graphics graphics = Graphics.FromImage(offerimage)) { graphics.FillRectangle(Brushes.Green, 0, 0, offerimage.Width, offerimage.Height); } } this.OfferList = new List<CustomSelfDrawPanel.UICardOffer>(); foreach (CardTypes.CardOffer offer in GameEngine.Instance.World.ProfileCardOffers.Values) { CustomSelfDrawPanel.CSDButton button; CustomSelfDrawPanel.CSDButton button2; string str5; if (offer.Buyable != 1) { continue; } if (offer.Category == "PLATINUM") { offer.Buyable = 0; continue; } CustomSelfDrawPanel.UICardOffer off = new CustomSelfDrawPanel.UICardOffer { Offer = offer, baseImage = new CustomSelfDrawPanel.CSDImage() }; off.baseImage.Position = new Point(0, 20); off.packImage = new CustomSelfDrawPanel.CSDImage(); off.packImage.Position = new Point(10, -7); off.packOverImage = new CustomSelfDrawPanel.CSDImage(); off.packOverImage.Position = new Point(10, -7); off.crownImage = new CustomSelfDrawPanel.CSDImage(); off.crownImage.Position = new Point(330, 0x10); string str = string.Empty; string str2 = string.Empty; string iD = string.Empty; string defaultText = string.Empty; switch (offer.Category) { case "FARMING": str = "card_pack_food_standard_normal"; str2 = "card_pack_food_standard_over"; iD = "CARD_OFFERS_Food_Pack"; defaultText = "Food Pack"; goto Label_078F; case "CASTLE": str = "card_pack_castle_standard_normal"; str2 = "card_pack_castle_standard_over"; iD = "CARD_OFFERS_Castle_Pack"; defaultText = "Castle Pack"; goto Label_078F; case "DEFENSE": case "DEFENCE": str = "card_pack_defence_standard_normal"; str2 = "card_pack_defence_standard_over"; iD = "CARD_OFFERS_Defense_Pack"; defaultText = "Defence Pack"; goto Label_078F; case "RANDOM": str = "card_pack_random_standard_normal"; str2 = "card_pack_random_standard_over"; iD = "CARD_OFFERS_Random_Pack"; defaultText = "Random Pack"; goto Label_078F; case "INDUSTRY": str = "card_pack_Industry_standard_normal"; str2 = "card_pack_Industry_standard_over"; iD = "CARD_OFFERS_Industry_Pack"; defaultText = "Industry Pack"; goto Label_078F; case "RESEARCH": str = "card_pack_research_silver_normal"; str2 = "card_pack_research_silver_over"; iD = "CARD_OFFERS_Industry_Pack"; defaultText = "Industry Pack"; goto Label_078F; case "ARMY": str = "card_pack_army_standard_normal"; str2 = "card_pack_army_standard_over"; iD = "CARD_OFFERS_Army_Pack"; defaultText = "Army Pack"; goto Label_078F; case "SUPERFARMING": str = "card_pack_food_silver_normal"; str2 = "card_pack_food_silver_over"; iD = "CARD_OFFERS_Super_Food_Pack"; defaultText = "Super Food Pack"; goto Label_078F; case "SUPERDEFENSE": case "SUPERDEFENCE": str = "card_pack_defence_silver_normal"; str2 = "card_pack_defence_silver_over"; iD = "CARD_OFFERS_Super_Defense_Pack"; defaultText = "Super Defence Pack"; goto Label_078F; case "SUPERRANDOM": str = "card_pack_random_silver_normal"; str2 = "card_pack_random_silver_over"; iD = "CARD_OFFERS_Super_Random_Pack"; defaultText = "Super Random Pack"; button = new CustomSelfDrawPanel.CSDButton { ImageNorm = (Image) GFXLibrary.mrhp_button_more_info_solid[0], ImageOver = (Image) GFXLibrary.mrhp_button_more_info_solid[1], MoveOnClick = true, Position = new Point(270, 100) }; button.Text.Text = SK.Text("UserInfo_MoreInfo", "More Info"); if (!(Program.mySettings.LanguageIdent == "it")) { break; } button.Text.Font = FontManager.GetFont("Arial", 7.5f, FontStyle.Regular); goto Label_0521; case "SUPERINDUSTRY": str = "card_pack_Industry_silver_normal"; str2 = "card_pack_Industry_silver_over"; iD = "CARD_OFFERS_Super_Industry_Pack"; defaultText = "Super Industry Pack"; goto Label_078F; case "SUPERARMY": str = "card_pack_army_silver_normal"; str2 = "card_pack_army_silver_over"; iD = "CARD_OFFERS_Super_Army_Pack"; defaultText = "Super Army Pack"; goto Label_078F; case "ULTIMATEFARMING": str = "card_pack_food_gold_normal"; str2 = "card_pack_food_gold_over"; iD = "CARD_OFFERS_Ultimate_Food_Pack"; defaultText = "Ultimate Food Pack"; goto Label_078F; case "ULTIMATEDEFENSE": case "ULTIMATEDEFENCE": str = "card_pack_defence_gold_normal"; str2 = "card_pack_defence_gold_over"; iD = "CARD_OFFERS_Ultimate_Defense_Pack"; defaultText = "Ultimate Defence Pack"; goto Label_078F; case "ULTIMATERANDOM": str = "card_pack_random_gold_normal"; str2 = "card_pack_random_gold_over"; iD = "CARD_OFFERS_Ultimate_Random_Pack"; defaultText = "Ultimate Random Pack"; button2 = new CustomSelfDrawPanel.CSDButton { ImageNorm = (Image) GFXLibrary.mrhp_button_more_info_solid[0], ImageOver = (Image) GFXLibrary.mrhp_button_more_info_solid[1], MoveOnClick = true, Position = new Point(270, 100) }; button2.Text.Text = SK.Text("UserInfo_MoreInfo", "More Info"); if (!(Program.mySettings.LanguageIdent == "it")) { goto Label_06B9; } button2.Text.Font = FontManager.GetFont("Arial", 7.5f, FontStyle.Regular); goto Label_06D5; case "ULTIMATEINDUSTRY": str = "card_pack_Industry_gold_normal"; str2 = "card_pack_Industry_gold_over"; iD = "CARD_OFFERS_Ultimate_Industry_Pack"; defaultText = "Ultimate Industry Pack"; goto Label_078F; case "ULTIMATEARMY": str = "card_pack_army_gold_normal"; str2 = "card_pack_army_gold_over"; iD = "CARD_OFFERS_Ultimate_Army_Pack"; defaultText = "Ultimate Army Pack"; goto Label_078F; case "PLATINUM": str = "card_pack_army_gold_normal"; str2 = "card_pack_army_gold_over"; iD = "CARD_OFFERS_Platinum_Pack"; defaultText = "Platinum Pack"; goto Label_078F; default: goto Label_078F; } button.Text.Font = FontManager.GetFont("Arial", 8f, FontStyle.Bold); Label_0521: button.TextYOffset = -3; button.Text.Position = new Point(-3, 0); button.Text.Color = ARGBColors.Black; button.Text.DropShadowColor = Color.FromArgb(60, 90, 100); button.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.moreSuperClicked)); off.addControl(button); goto Label_078F; Label_06B9: button2.Text.Font = FontManager.GetFont("Arial", 8f, FontStyle.Bold); Label_06D5: button2.TextYOffset = -3; button2.Text.Position = new Point(-3, 0); button2.Text.Color = ARGBColors.Black; button2.Text.DropShadowColor = Color.FromArgb(60, 90, 100); button2.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.moreUltimateClicked)); off.addControl(button2); Label_078F: str5 = ""; off.baseImage.Image = (Image) GFXLibrary.card_offer_background; if (GFXLibrary.CardPackImages == null) { UniversalDebugLog.Log("CARDPACK IMAGES IS NULL"); } UniversalDebugLog.Log("Num packimages: " + GFXLibrary.CardPackImages.Count); off.packImage.Image = GFXLibrary.CardPackImages[str]; off.packOverImage.Image = GFXLibrary.CardPackImages[str2]; str5 = SK.Text(iD, defaultText); off.crownImage.Image = (Image) GFXLibrary.card_offer_pieces[2]; off.packImage.Visible = true; off.packOverImage.Visible = false; off.baseImage.setMouseOverDelegate(delegate { off.packImage.Visible = false; off.packOverImage.Visible = true; off.baseImage.Image = (Image) GFXLibrary.card_offer_background_over; }, delegate { off.packImage.Visible = true; off.packOverImage.Visible = false; off.baseImage.Image = (Image) GFXLibrary.card_offer_background; }); off.nameLabel = new CustomSelfDrawPanel.CSDLabel(); off.nameLabel.Position = new Point(0x5e, 0x1d); off.nameLabel.Text = str5; off.nameLabel.Size = new Size(300, 30); off.nameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; off.nameLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); off.nameLabel.Color = ARGBColors.Black; off.descLabel = new CustomSelfDrawPanel.CSDLabel(); off.descLabel.Position = new Point(0x5e, 0x2e); off.descLabel.Text = SK.Text(iD + "_desc"); off.descLabel.Size = new Size(0xf5, 0x2d); off.descLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; off.descLabel.Font = FontManager.GetFont("Arial", 8f, FontStyle.Bold); off.descLabel.Color = ARGBColors.Black; off.cardLabel = new CustomSelfDrawPanel.CSDLabel(); off.cardLabel.Position = new Point(0xbf, 0x3b); off.cardLabel.Text = SK.Text("BUY_CARDS_5_per_pack", "5 Cards per Pack"); off.cardLabel.Size = new Size(200, 30); off.cardLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.BOTTOM_RIGHT; off.cardLabel.Font = FontManager.GetFont("Arial", 8f, FontStyle.Bold); off.cardLabel.Color = ARGBColors.Black; off.costLabel = new CustomSelfDrawPanel.CSDLabel(); off.costLabel.Position = new Point(0x132, 0x1c); off.costLabel.Text = offer.CrownCost.ToString(); off.costLabel.Size = new Size(40, 30); off.costLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; off.costLabel.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold); off.costLabel.Color = ARGBColors.Black; off.addControl(off.baseImage); off.addControl(off.packImage); off.addControl(off.packOverImage); off.addControl(off.nameLabel); off.addControl(off.descLabel); off.addControl(off.crownImage); off.addControl(off.cardLabel); off.addControl(off.costLabel); off.baseImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.OfferClicked)); off.Size = new Size(off.baseImage.Size.Width, 140); this.OfferList.Add(off); } }
public void init(CustomSelfDrawPanel.UICardOffer offer, ConfirmBuyOfferPanel.CardClickPlayDelegate callback) { this.confirmPanel.init(offer, callback); }
public void doOfferClicked(bool initialClick) { CustomSelfDrawPanel.UICardOffer parent = (CustomSelfDrawPanel.UICardOffer) base.ClickedControl.Parent; if (initialClick && (parent.Offer.CrownCost > GameEngine.Instance.World.ProfileCrowns)) { BuyCrownsPopup popup = new BuyCrownsPopup(); popup.init(parent.Offer.CrownCost - GameEngine.Instance.World.ProfileCrowns, base.ParentForm); popup.Show(base.ParentForm); } else if (initialClick && Program.mySettings.BuyMultipleCardPacks) { GameEngine.Instance.playInterfaceSound("BuyCardsPanel_open_offer_open_confirmation"); base.PanelActive = false; this.waitingResponse = false; InterfaceMgr.Instance.openConfirmBuyOfferPopup(parent, new ConfirmBuyOfferPanel.CardClickPlayDelegate(this.doOfferClicked)); } else { if (initialClick) { GameEngine.Instance.playInterfaceSound("BuyCardsPanel_open_offer"); InterfaceMgr.Instance.BuyOfferMultiple = 0; } if (parent.Offer.CrownCost > GameEngine.Instance.World.ProfileCrowns) { BuyCrownsPopup popup2 = new BuyCrownsPopup(); popup2.init(parent.Offer.CrownCost - GameEngine.Instance.World.ProfileCrowns, base.ParentForm); popup2.Show(base.ParentForm); } else { if (InterfaceMgr.Instance.BuyOfferMultiple == 0) { InterfaceMgr.Instance.BuyOfferMultiple = 1; } string iD = string.Empty; switch (parent.Offer.Category) { case "FARMING": iD = "CARD_OFFERS_Food_Pack"; break; case "CASTLE": iD = "CARD_OFFERS_Castle_Pack"; break; case "DEFENSE": case "DEFENCE": iD = "CARD_OFFERS_Defense_Pack"; break; case "RANDOM": iD = "CARD_OFFERS_Random_Pack"; break; case "INDUSTRY": iD = "CARD_OFFERS_Industry_Pack"; break; case "RESEARCH": iD = "CARD_OFFERS_Industry_Pack"; break; case "ARMY": iD = "CARD_OFFERS_Army_Pack"; break; case "SUPERFARMING": iD = "CARD_OFFERS_Super_Food_Pack"; break; case "SUPERDEFENSE": case "SUPERDEFENCE": iD = "CARD_OFFERS_Super_Defense_Pack"; break; case "SUPERRANDOM": iD = "CARD_OFFERS_Super_Random_Pack"; break; case "SUPERINDUSTRY": iD = "CARD_OFFERS_Super_Industry_Pack"; break; case "SUPERARMY": iD = "CARD_OFFERS_Super_Army_Pack"; break; case "ULTIMATEFARMING": iD = "CARD_OFFERS_Ultimate_Food_Pack"; break; case "ULTIMATEDEFENSE": case "ULTIMATEDEFENCE": iD = "CARD_OFFERS_Ultimate_Defense_Pack"; break; case "ULTIMATERANDOM": iD = "CARD_OFFERS_Ultimate_Random_Pack"; break; case "ULTIMATEINDUSTRY": iD = "CARD_OFFERS_Ultimate_Industry_Pack"; break; case "ULTIMATEARMY": iD = "CARD_OFFERS_Ultimate_Army_Pack"; break; case "PLATINUM": iD = "CARD_OFFERS_Platinum_Pack"; break; } string str2 = SK.Text(iD); string[] strArray = new string[] { InterfaceMgr.Instance.BuyOfferMultiple.ToString(), " x ", str2, Environment.NewLine, SK.Text("BuyCardsPanel_Crowns_Cost", "Crowns Cost"), " : ", (parent.Offer.CrownCost * InterfaceMgr.Instance.BuyOfferMultiple).ToString() }; if (MyMessageBox.Show(string.Concat(strArray), SK.Text("BuyCardsPanel_Confirm_Purchase", "Confirm Purchase"), MessageBoxButtons.OKCancel) == DialogResult.OK) { this.lastoffer = parent; XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), parent.Offer.ID.ToString()); if (InterfaceMgr.Instance.BuyOfferMultiple > 1) { req.Multiple = new int?(InterfaceMgr.Instance.BuyOfferMultiple); } provider.buyCardOffer(req, new CardsEndResponseDelegate(this.OfferBought), this); WorldMap world = GameEngine.Instance.World; world.ProfileCrowns -= parent.Offer.CrownCost * InterfaceMgr.Instance.BuyOfferMultiple; this.labelTitle.Text = SK.Text("BuyCardsPanel_Buy_and_Open_Packs", "Buy and Open Card Packs: Crowns in your treasury") + " : " + GameEngine.Instance.World.ProfileCrowns.ToString(); } } } }
public void init(CustomSelfDrawPanel.UICardOffer offer, 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); int profileCrowns = GameEngine.Instance.World.ProfileCrowns; int crownCost = offer.Offer.CrownCost; int num3 = (int)Math.Floor((decimal)(profileCrowns / crownCost)); this.numMultiple = new NumericUpDown(); base.Controls.Add(this.numMultiple); this.numMultiple.Minimum = 1M; this.numMultiple.Maximum = num3; this.numMultiple.Increment = 1M; this.numMultiple.Left = (base.Width / 2) - (this.numMultiple.Width / 2); this.numMultiple.Top = (base.Height / 2) - (this.numMultiple.Height / 2); this.numMultiple.DecimalPlaces = 0; this.numMultiple.KeyUp += new KeyEventHandler(this.numMultiple_KeyUp); this.confirmLabel.Text = SK.Text("ConfirmBuyOffer_PleaseConfirm", "Please Confirm how many of this type of card pack you want to buy."); this.confirmLabel.Color = ARGBColors.Black; this.confirmLabel.Position = new Point(20, 10); this.confirmLabel.Font = FontManager.GetFont("Arial", 14f, FontStyle.Regular); this.confirmLabel.Size = new Size(this.background.Width - 40, 80); this.confirmLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.background.addControl(this.confirmLabel); this.packTypeLabel.Text = offer.nameLabel.Text; this.packTypeLabel.Color = ARGBColors.Black; this.packTypeLabel.Position = new Point(20, 100); this.packTypeLabel.Font = FontManager.GetFont("Arial", 14f, FontStyle.Regular); this.packTypeLabel.Size = new Size(this.background.Width - 40, 80); this.packTypeLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.background.addControl(this.packTypeLabel); 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, 190); this.confirmButton.Text.Text = SK.Text("ConfirmBuyOffer_BuyOffer", "Buy Offer"); this.confirmButton.TextYOffset = -2; this.confirmButton.Text.Color = ARGBColors.Black; if (Program.mySettings.LanguageIdent == "pl") { this.confirmButton.Text.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold); } else { this.confirmButton.Text.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); } this.confirmButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.playCard), "ConfirmBuyOfferPanel_confirm_buy_pack"); this.background.addControl(this.confirmButton); 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, 190); 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.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick), "ConfirmBuyOfferPanel_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, 240); this.confirmCheck.Checked = true; this.confirmCheck.CBLabel.Text = SK.Text("ConfirmBuyOffer_AlwaysAsk", "Always ask to buy multiple card packs."); 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); }