public Color addColours(CustomSelfDrawPanel panel, Color[] colours, Color curColour, int row) { panel.clearControls(); CustomSelfDrawPanel.CSDFill fill = null; bool flag = false; int num = 0; foreach (Color color in colours) { CustomSelfDrawPanel.CSDFill control = new CustomSelfDrawPanel.CSDFill { Size = new Size(12, 12), Position = new Point(num * 13, 4) }; control.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.colourClickedCSD)); control.FillColor = color; panel.addControl(control); num++; if (color == curColour) { flag = true; control.Border = true; } if (fill == null) { fill = control; } } if (!flag) { curColour = colours[0]; fill.Border = true; } panel.Invalidate(); return curColour; }
public static void addRewardIcons(CustomSelfDrawPanel.CSDControl parentControl, Point baseLocation, NewQuests.NewQuestDefinition def, int gloryMode) { if (def != null) { CustomSelfDrawPanel.CSDLabel control = null; if (gloryMode > 0) { control = new CustomSelfDrawPanel.CSDLabel { Color = ARGBColors.Black, Position = baseLocation, Size = new Size(110, GFXLibrary.quest_rewards[0].Height), Font = FontManager.GetFont("Arial", 11f, FontStyle.Bold), Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT }; parentControl.addControl(control); baseLocation.X += 100; } int num = 0; if ((def.reward_charges.Length > 0) && (gloryMode == 1)) { parentControl.addControl(createRewardIcon(9, -1, new Point(baseLocation.X, baseLocation.Y + 2), 0xc8c)); baseLocation.X += 60; num++; if (((def.getRewardGlory() > 0) && (gloryMode != 0)) && ((GameEngine.Instance.LocalWorldData.Alternate_Ruleset != 1) && (gloryMode > 0))) { CustomSelfDrawPanel.CSDLabel label2 = new CustomSelfDrawPanel.CSDLabel { Text = "+", Color = ARGBColors.Black, Position = new Point((baseLocation.X - 0x12) - 2, (baseLocation.Y + 12) - 2), Size = new Size(50, 30), Font = FontManager.GetFont("Arial", 14f, FontStyle.Bold), Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER }; parentControl.addControl(label2); baseLocation.X += 30; } } if (gloryMode >= 0) { if (def.reward_honour > 0) { parentControl.addControl(createRewardIcon(1, def.reward_honour, baseLocation, 0xc83)); baseLocation.X += 120; num++; } if (def.reward_gold > 0) { parentControl.addControl(createRewardIcon(2, def.reward_gold, baseLocation, 0xc84)); baseLocation.X += 120; num++; } if (def.reward_wood > 0) { parentControl.addControl(createRewardIcon(3, def.reward_wood, baseLocation, 0xc85)); baseLocation.X += 120; num++; } if (def.reward_stone > 0) { parentControl.addControl(createRewardIcon(4, def.reward_stone, baseLocation, 0xc86)); baseLocation.X += 120; num++; } if (def.reward_apples > 0) { parentControl.addControl(createRewardIcon(12, def.reward_apples, baseLocation, 0xc8e)); baseLocation.X += 120; num++; } if (def.reward_card_pack > 0) { parentControl.addControl(createRewardIcon(6, def.reward_card_pack, baseLocation, 0xc88)); baseLocation.X += 120; num++; } if (def.reward_2day_premium > 0) { parentControl.addControl(createRewardIcon(7, def.reward_2day_premium, baseLocation, 0xc89)); baseLocation.X += 120; num++; } if (def.reward_faithpoints > 0) { parentControl.addControl(createRewardIcon(8, def.reward_faithpoints, baseLocation, 0xc8a)); baseLocation.X += 120; num++; } if (def.reward_tickets > 0) { parentControl.addControl(createRewardIcon(10, def.reward_tickets, baseLocation, 0xc8d)); baseLocation.X += 120; num++; } } if (((def.getRewardGlory() > 0) && (gloryMode != 0)) && (GameEngine.Instance.LocalWorldData.Alternate_Ruleset != 1)) { if (gloryMode > 0) { CustomSelfDrawPanel.CSDLabel label3 = new CustomSelfDrawPanel.CSDLabel { Text = SK.Text("QUESTS_or", "Or"), Color = ARGBColors.Black, Position = new Point(baseLocation.X, baseLocation.Y + 12), Size = new Size(50, 30), Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold), Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER }; parentControl.addControl(label3); baseLocation.X += 50; } parentControl.addControl(createRewardIcon(0, def.getRewardGlory(), baseLocation, 0xc8b)); baseLocation.X += 120; num++; } if (control != null) { if (num == 1) { control.Text = SK.Text("QUEST_Reward", "Reward"); } else { control.Text = SK.Text("QUEST_Rewards", "Rewards"); } } } }
public void init(CustomSelfDrawPanel.CSDControl parentControl, int initialProgress, int band) { active = true; this.m_band = band; base.Image = (Image) GFXLibrary.tutorial_reward_anim[0]; base.RotateCentre = new PointF(64f, 64f); base.Visible = true; parentControl.addControl(this); this.restart(); for (int i = 0; i < initialProgress; i++) { this.update(); } }
private int RefreshCards(CustomSelfDrawPanel.CSDImage content, List<CustomSelfDrawPanel.UICard> list, int width) { int[] numArray = null; if (GameEngine.Instance.World.lastUserCardSearchCriteria != null) { switch (GameEngine.Instance.World.lastUserCardSearchCriteria.newCardCategoryFilter) { case 0x1001: numArray = CardTypes.newCategories_ApplesOrder; break; case 0x1002: numArray = CardTypes.newCategories_CheeseOrder; break; case 0x1003: numArray = CardTypes.newCategories_MeatOrder; break; case 0x1004: numArray = CardTypes.newCategories_BreadOrder; break; case 0x1005: numArray = CardTypes.newCategories_VegOrder; break; case 0x1006: numArray = CardTypes.newCategories_FishOrder; break; case 0x1007: numArray = CardTypes.newCategories_AleOrder; break; case 0x2001: numArray = CardTypes.newCategories_WoodOrder; break; case 0x2002: numArray = CardTypes.newCategories_StoneOrder; break; case 0x2003: numArray = CardTypes.newCategories_IronOrder; break; case 0x2004: numArray = CardTypes.newCategories_PitchOrder; break; case 0x4001: numArray = CardTypes.newCategories_VenisonOrder; break; case 0x4002: numArray = CardTypes.newCategories_FurnitureOrder; break; case 0x4003: numArray = CardTypes.newCategories_MetalwareOrder; break; case 0x4004: numArray = CardTypes.newCategories_ClothesOrder; break; case 0x4005: numArray = CardTypes.newCategories_WineOrder; break; case 0x4006: numArray = CardTypes.newCategories_SaltOrder; break; case 0x4007: numArray = CardTypes.newCategories_SpicesOrder; break; case 0x4008: numArray = CardTypes.newCategories_SilkOrder; break; case 0x8001: numArray = CardTypes.newCategories_BowsOrder; break; case 0x8002: numArray = CardTypes.newCategories_PikesOrder; break; case 0x8003: numArray = CardTypes.newCategories_ArmourOrder; break; case 0x8004: numArray = CardTypes.newCategories_SwordsOrder; break; case 0x8005: numArray = CardTypes.newCategories_CatapultsOrder; break; case 0x10001: numArray = CardTypes.newCategories_CastleConOrder; break; case 0x10002: numArray = CardTypes.newCategories_DefencesOrder; break; case 0x10003: numArray = CardTypes.newCategories_WallsOrder; break; case 0x10004: numArray = CardTypes.newCategories_KnightsOrder; break; case 0x20001: numArray = CardTypes.newCategories_ScoutingOrder; break; case 0x20002: numArray = CardTypes.newCategories_SpeedOrder; break; case 0x20003: numArray = CardTypes.newCategories_RecruitmentOrder; break; case 0x20004: numArray = CardTypes.newCategories_TroopsOrder; break; case 0x20005: numArray = CardTypes.newCategories_DiplomacyOrder; break; case 0x40001: numArray = CardTypes.newCategories_TradeOrder; break; case 0x40002: numArray = CardTypes.newCategories_ReligionOrder; break; case 0x40003: numArray = CardTypes.newCategories_HonourOrder; break; case 0x40004: numArray = CardTypes.newCategories_GoldOrder; break; case 0x40005: numArray = CardTypes.newCategories_PopOrder; break; case 0x40006: numArray = CardTypes.newCategories_ResearchOrder; break; case 0x40007: numArray = CardTypes.newCategories_CapacityOrder; break; case 0x40008: numArray = CardTypes.newCategories_ConstructionOrder; break; } } if (GameEngine.Instance.World.getTutorialStage() == 8) { list.Sort(CustomSelfDrawPanel.UICard.TUT2cardsNameComparer); } else if (GameEngine.Instance.World.getTutorialStage() == 12) { list.Sort(CustomSelfDrawPanel.UICard.TUTcardsNameComparer); } else if (this.sortByMode == 0) { list.Sort(CustomSelfDrawPanel.UICard.cardsNameComparer); } else if (this.sortByMode == 1) { list.Sort(CustomSelfDrawPanel.UICard.cardsIDComparer); } else if (this.sortByMode == 2) { list.Sort(CustomSelfDrawPanel.UICard.cardsNameComparerReverse); } else if (this.sortByMode == 3) { list.Sort(CustomSelfDrawPanel.UICard.cardsIDComparerReverse); } else if (this.sortByMode == 7) { list.Sort(CustomSelfDrawPanel.UICard.cardsQuantityComparer); } else if (this.sortByMode == 8) { list.Sort(CustomSelfDrawPanel.UICard.cardsQuantityComparerReverse); } int num = GameEngine.Instance.World.getRank() + 1; content.clearDirectControlsOnly(); foreach (CustomSelfDrawPanel.UICard card in this.dummyCards) { card.clearControls(); } this.dummyCards.Clear(); int num2 = 0; int x = 0x10; int y = 0; if (this.currentCardSection == 0) { x = 0; } if (numArray != null) { this.sortBack.Visible = false; this.AvailablePanelContent.ClipRect = new Rectangle(this.AvailablePanelContent.ClipRect.X, this.AvailablePanelContent.ClipRect.Y, this.AvailablePanelContent.ClipRect.Width, this.AvailablePanel.Height - (BorderPadding * 2)); int num5 = 0; int num6 = -1; for (int i = 0; i < numArray.Length; i += 3) { if (numArray[i + 2] != num6) { int cardType = numArray[i]; int num9 = numArray[i + 1] * 0xb2; int num10 = (numArray[i + 2] - num5) * 0xed; bool flag = false; CustomSelfDrawPanel.UICard control = null; foreach (CustomSelfDrawPanel.UICard card3 in list) { if (CardTypes.getCardType(card3.Definition.id) == cardType) { flag = true; control = card3; } } CardTypes.CardDefinition def = CardTypes.getCardDefinition(cardType); if ((!flag && (((def.cardRank <= 0) || (def.cardRarity <= 0)) || (def.available != 1))) && (num9 == 0)) { bool flag2 = false; int num11 = CardTypes.getCardType(cardType); if ((num11 >= 0xbd7) && (num11 <= 0xbf5)) { for (int j = 0; j < numArray.Length; j += 3) { if (((numArray[j + 2] == numArray[i + 2]) && (cardType != numArray[j])) && (CardTypes.getCardDefinition(numArray[j]).available == 1)) { numArray[j + 1]--; flag2 = true; } } } if (!flag2) { num5++; num6 = numArray[i + 2]; continue; } } if ((num10 + 0xed) > num2) { num2 = num10 + 0xed; } if (flag) { control.Position = new Point(num9, num10); content.addControl(control); if ((num < control.Definition.cardRank) || (control.UserIDList.Count == 0)) { control.rankLabel.Color = ARGBColors.Red; control.Hilight(ARGBColors.Gray); } else { control.rankLabel.Color = ARGBColors.White; control.Hilight(ARGBColors.White); } if (control.cardCount > 1) { control.countLabel.Text = control.cardCount.ToString(); if (control.cardCount >= 100) { control.countLabel.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold); } else { control.countLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Bold); } } } else if (((def.cardRank > 0) && (def.cardRarity > 0)) && (def.available == 1)) { CustomSelfDrawPanel.UICard card4 = BuyCardsPanel.makeUICard(def, RemoteServices.Instance.UserID, 0x2710); card4.Position = new Point(num9, num10); content.addControl(card4); CustomSelfDrawPanel.CSDFill fill = new CustomSelfDrawPanel.CSDFill { FillColor = Color.FromArgb(170, 0, 0, 0), Alpha = 0.2f, Position = new Point(2, 1), Size = new Size((card4.Size.Width - 2) - 4, (card4.Size.Height - 1) - 5) }; card4.addControl(fill); this.dummyCards.Add(card4); card4.CustomTooltipID = 0x2775; card4.CustomTooltipData = cardType; CustomSelfDrawPanel.CSDLabel label = new CustomSelfDrawPanel.CSDLabel(); if (def.cardPoints > 0) { label.Text = SK.Text("CARDS_GetCard", "Get Card"); label.Data = def.id; label.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.linkToBuy)); } else { label.Text = SK.Text("CARDS_No_Cards", "No Cards"); } label.Position = new Point(num9 + 3, num10 + 5); label.Size = new Size(0x9d, 0xd9); label.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; label.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold); label.Color = ARGBColors.White; label.CustomTooltipID = 0x2775; label.CustomTooltipData = cardType; content.addControl(label); } } } } else { if (!this.usingRecentFilter) { this.sortBack.Visible = true; } this.AvailablePanelContent.ClipRect = new Rectangle(this.AvailablePanelContent.ClipRect.X, this.AvailablePanelContent.ClipRect.Y, this.AvailablePanelContent.ClipRect.Width, (this.AvailablePanel.Height - (BorderPadding * 2)) - 0x18); int num13 = 0; int num14 = 0; foreach (CustomSelfDrawPanel.UICard card5 in list) { card5.Position = new Point(x, y); content.addControl(card5); num14 = y; if (x > width) { x = 0x10; if (this.currentCardSection == 0) { x = 0; } if (!this.compressedCards) { y += card5.Height + 8; } else { y += 0x3a; } } else { x += card5.Width + 12; } if (this.compressedCards && (num13 < (list.Count - 4))) { card5.ClipRect = new Rectangle(0, 0, card5.Width, 60); card5.bigEffect.Visible = false; card5.rankLabel.Visible = false; } else { card5.ClipRect = Rectangle.Empty; card5.bigEffect.Visible = true; card5.rankLabel.Visible = true; } if (this.compressedCards) { CustomSelfDrawPanel.CSDLine line = new CustomSelfDrawPanel.CSDLine { Position = new Point(card5.Position.X + 3, card5.Position.Y + 1), Size = new Size(card5.Width - 7, 0), LineColor = Color.FromArgb(0x80, ARGBColors.Black) }; content.addControl(line); } num13++; if ((num < card5.Definition.cardRank) || (card5.UserIDList.Count == 0)) { card5.rankLabel.Color = ARGBColors.Red; card5.Hilight(ARGBColors.Gray); } else { card5.rankLabel.Color = ARGBColors.White; card5.Hilight(ARGBColors.White); } if (card5.cardCount > 1) { card5.countLabel.Text = card5.cardCount.ToString(); if (card5.cardCount >= 100) { card5.countLabel.Font = FontManager.GetFont("Arial", 16f, FontStyle.Bold); } else { card5.countLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Bold); } } } if (list.Count > 0) { num2 = (num14 + list[0].Height) + 8; } } disableCardsInPlay(this.UICardList); content.invalidate(); return num2; }
public void init(WheelReward reward, Point position, CustomSelfDrawPanel.CSDArea layer1, CustomSelfDrawPanel.CSDArea layer2, CustomSelfDrawPanel.CSDArea layer3) { this.fadeValue = 0f; this.m_reward = reward; this.Position = new Point(position.X - 0x40, position.Y - 0x40); this.Size = new Size(0x80, 0x80); this.glowImage.Image = (Image) GFXLibrary.wheel_icons[0]; if (layer1 != null) { this.glowImage.Position = this.Position; this.glowImage.Alpha = 0f; layer1.addControl(this.glowImage); this.updateImage(reward); this.iconImage.Position = new Point(this.Position.X + 2, this.Position.Y + 2); layer2.addControl(this.iconImage); this.numberImage.Position = new Point(this.Position.X + 13, this.Position.Y + 0x4b); layer3.addControl(this.numberImage); } else { this.glowImage.Alpha = 0f; base.addControl(this.glowImage); this.updateImage(reward); this.iconImage.Position = new Point(2, 2); base.addControl(this.iconImage); this.numberImage.Position = new Point(13, 0x4b); base.addControl(this.numberImage); } }