private void InitializeComponent()
 {
     new ComponentResourceManager(typeof(WheelPopup));
     this.wheelPanel = new WheelPanel();
     base.SuspendLayout();
     this.wheelPanel.Location = new Point(0, 0);
     this.wheelPanel.Name = "wheelPanel";
     this.wheelPanel.PanelActive = true;
     this.wheelPanel.Size = new Size(0x3e8, 600);
     this.wheelPanel.StoredGraphics = null;
     this.wheelPanel.TabIndex = 0;
     base.AutoScaleDimensions = new SizeF(6f, 13f);
     base.AutoScaleMode = AutoScaleMode.None;
     base.ClientSize = new Size(0x3e8, 600);
     base.ControlBox = false;
     base.Controls.Add(this.wheelPanel);
     base.FormBorderStyle = FormBorderStyle.None;
     base.Icon = Resources.shk_icon;
     base.MaximizeBox = false;
     this.MaximumSize = new Size(0x3e8, 600);
     base.MinimizeBox = false;
     this.MinimumSize = new Size(0x3e8, 600);
     base.Name = "WheelPopup";
     base.ShowIcon = false;
     base.ShowInTaskbar = false;
     base.StartPosition = FormStartPosition.Manual;
     this.Text = "Free Cards";
     base.TransparencyKey = ARGBColors.Fuchsia;
     base.ResumeLayout(false);
 }
        public void init(bool initialCall, int wheelType)
        {
            CustomSelfDrawPanel.CSDImage image2;
            this.m_wheelType = wheelType;
            Instance = this;
            base.clearControls();
            if (!this.rewardImagesCreated)
            {
                this.rewardImagesCreated = true;
                for (int i = 0; i < 20; i++)
                {
                    this.rewardImages[i] = new RewardImage();
                }
            }
            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.MainPanel.Size = base.Size;
            this.MainPanel.Position = new Point(0, 0);
            this.mainBackgroundImage.addControl(this.MainPanel);
            this.MainPanel.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 control = new CustomSelfDrawPanel.CSDImage {
                Image = (Image) GFXLibrary.cardpanel_panel_gradient_top_left,
                Size = GFXLibrary.cardpanel_panel_gradient_top_left.Size,
                Position = new Point(0, 0)
            };
            this.MainPanel.addControl(control);
            image2 = new CustomSelfDrawPanel.CSDImage {
                Image = (Image) GFXLibrary.cardpanel_panel_gradient_bottom_right,
                Size = GFXLibrary.cardpanel_panel_gradient_bottom_right.Size,
                Position = new Point((this.MainPanel.Width - ((Image) GFXLibrary.cardpanel_panel_gradient_bottom_right).Width) - 6, (this.MainPanel.Height - ((Image) GFXLibrary.cardpanel_panel_gradient_bottom_right).Height) - 6)
            };
            this.MainPanel.addControl(image2);
            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, 0x20, new Point((base.Width - 40) - 40, 2));
            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.labelTitle.Position = new Point(0x1b, 5);
            this.labelTitle.Size = new Size(600, 0x40);
            switch (this.m_wheelType)
            {
                case -1:
                    this.labelTitle.Text = SK.Text("WheelPanel_Royal_Wheel", "Quest Wheel");
                    break;

                case 0:
                    this.labelTitle.Text = SK.Text("WheelPanel_Treasure_Wheel_1", "Treasure Wheel Tier 1");
                    break;

                case 1:
                    this.labelTitle.Text = SK.Text("WheelPanel_Treasure_Wheel_2", "Treasure Wheel Tier 2");
                    break;

                case 2:
                    this.labelTitle.Text = SK.Text("WheelPanel_Treasure_Wheel_3", "Treasure Wheel Tier 3");
                    break;

                case 3:
                    this.labelTitle.Text = SK.Text("WheelPanel_Treasure_Wheel_4", "Treasure Wheel Tier 4");
                    break;

                case 4:
                    this.labelTitle.Text = SK.Text("WheelPanel_Treasure_Wheel_5", "Treasure Wheel Tier 5");
                    break;
            }
            this.labelTitle.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.labelTitle.Font = FontManager.GetFont("Arial", 18f, FontStyle.Bold);
            this.labelTitle.Color = ARGBColors.Black;
            this.mainBackgroundImage.addControl(this.labelTitle);
            if (this.m_wheelType == -1)
            {
                if (Program.mySettings.LanguageIdent == "it")
                {
                    this.labelTitle2.Position = new Point(300, 10);
                }
                else
                {
                    this.labelTitle2.Position = new Point(250, 10);
                }
                this.labelTitle2.Size = new Size(600, 0x40);
                string[] strArray = new string[] { "(", SK.Text("WheelPanel_Level", "Level"), " ", (Wheel.getWheelLevel(GameEngine.Instance.World.getRank()) + 1).ToString(), ")" };
                this.labelTitle2.Text = string.Concat(strArray);
                this.labelTitle2.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
                this.labelTitle2.Font = FontManager.GetFont("Arial", 14f, FontStyle.Regular);
                this.labelTitle2.Color = ARGBColors.Black;
                this.mainBackgroundImage.addControl(this.labelTitle2);
            }
            this.wheelImage.Image = (Image) GFXLibrary.wheel_wheel_royal;
            this.wheelImage.Position = new Point(3, 0x23);
            this.mainBackgroundImage.addControl(this.wheelImage);
            this.numTicketsLabel.Position = new Point(0x2d5, 0x2a);
            this.numTicketsLabel.Size = new Size(600, 0x36);
            this.numTicketsLabel.Text = SK.Text("WheelPanel_Spins", "Spins") + ": " + GameEngine.Instance.World.getTickets(this.m_wheelType).ToString();
            this.numTicketsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.numTicketsLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Bold);
            this.numTicketsLabel.Color = ARGBColors.Black;
            this.wheelImage.addControl(this.numTicketsLabel);
            this.starImage.Image = (Image) GFXLibrary.wheel_star[0];
            this.starImage.Position = new Point(0x22d, 0x2f);
            this.starImage.RotateCentre = new PointF(128f, 128f);
            this.starImage.Visible = false;
            this.starSpinMode = 0;
            this.wheelImage.addControl(this.starImage);
            if (this.royal)
            {
                this.pegImage.Image = (Image) GFXLibrary.wheel_icons[12];
            }
            else
            {
                this.pegImage.Image = (Image) GFXLibrary.wheel_icons[13];
            }
            this.pegImage.Position = new Point(0x26e, 0x73);
            this.pegImage.Visible = true;
            this.wheelImage.addControl(this.pegImage);
            this.rewardDescription.Position = new Point(0x2dd, 0x8a);
            this.rewardDescription.Size = new Size(0x9b, 80);
            this.rewardDescription.Text = "";
            this.rewardDescription.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
            this.rewardDescription.Font = FontManager.GetFont("Arial", 11f, FontStyle.Bold);
            this.rewardDescription.Color = ARGBColors.Black;
            this.wheelImage.addControl(this.rewardDescription);
            this.wheelLayer1.Position = new Point(0, 0);
            this.wheelLayer1.Size = this.wheelImage.Size;
            this.wheelImage.addControl(this.wheelLayer1);
            this.wheelLayer2.Position = new Point(0, 0);
            this.wheelLayer2.Size = this.wheelImage.Size;
            this.wheelImage.addControl(this.wheelLayer2);
            this.wheelLayer3.Position = new Point(0, 0);
            this.wheelLayer3.Size = this.wheelImage.Size;
            this.wheelImage.addControl(this.wheelLayer3);
            this.spinGlow.Image = (Image) GFXLibrary.wheel_icons[0];
            this.spinGlow.Position = new Point(0x205, 0x1a7);
            this.wheelImage.addControl(this.spinGlow);
            this.spinButton.ImageNorm = (Image) GFXLibrary.wheel_spinButton_royal[0];
            this.spinButton.ImageOver = (Image) GFXLibrary.wheel_spinButton_royal[1];
            this.spinButton.MoveOnClick = false;
            this.spinButton.Position = new Point(0x202, 0x1ba);
            this.spinButton.Text.Text = SK.Text("Wheel_Spin", "Spin");
            this.spinButton.TextYOffset = 0x20;
            this.spinButton.Text.Color = ARGBColors.Black;
            this.spinButton.Text.DropShadowColor = Color.FromArgb(160, 160, 160);
            this.spinButton.Text.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
            this.spinButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.spinCard));
            this.wheelImage.addControl(this.spinButton);
            int num2 = 5;
            this.pointerShadowImage.Image = (Image) GFXLibrary.wheel_arrowBlurShadow[0];
            this.pointerShadowImage.Position = new Point(0xd7 + num2, 0x6c + num2);
            this.pointerShadowImage.RotateCentre = new PointF(76.5f, 172.5f);
            this.pointerShadowImage.Alpha = 0.5f;
            this.wheelImage.addControl(this.pointerShadowImage);
            this.pointerImage.Image = (Image) GFXLibrary.wheel_arrowBlur_royal[0];
            this.pointerImage.Position = new Point(-num2, -num2);
            this.pointerImage.RotateCentre = new PointF(76.5f, 172.5f);
            this.pointerShadowImage.addControl(this.pointerImage);
            this.centreRewardImage.init(null, new Point(0x125, 0x11b));
            this.wheelImage.addControl(this.centreRewardImage);
            this.prizeRewardImage.init(null, new Point(690, 0xb7));
            this.wheelImage.addControl(this.prizeRewardImage);
            this.rewards = Wheel.getRewardWheel(GameEngine.Instance.World.getRank(), this.m_wheelType, GameEngine.Instance.LocalWorldData.AIWorld);
            if (this.rewards.Count == 20)
            {
                Random random = new Random();
                for (int j = 0; j < 20; j++)
                {
                    int num4 = random.Next(20);
                    WheelReward reward = this.rewards[j];
                    this.rewards[j] = this.rewards[num4];
                    this.rewards[num4] = reward;
                }
                for (int k = 0; k < 20; k++)
                {
                    Point point = this.rotatePoint(new Point(0, 230), (float) ((k * 0x12) + 9));
                    this.rewardImages[k].init(this.rewards[k], new Point(0x125 + point.X, 0x11b - point.Y), this.wheelLayer1, this.wheelLayer2, this.wheelLayer3);
                    this.wheelImage.addControl(this.rewardImages[k]);
                }
            }
            if (GameEngine.Instance.World.getTickets(this.m_wheelType) > 0)
            {
                this.helpLabel.Text = SK.Text("WheelPanel_spin_help", "Spin the wheel to win a prize");
            }
            else
            {
                this.helpLabel.Text = SK.Text("WheelPanel_nospin_help", "You have no spins available");
            }
            this.helpLabel.Position = new Point(0x2ae, 260);
            this.helpLabel.Size = new Size(0xc7, 180);
            this.helpLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
            this.helpLabel.Font = FontManager.GetFont("Arial", 14f, FontStyle.Bold);
            this.helpLabel.Color = ARGBColors.Black;
            this.wheelImage.addControl(this.helpLabel);
            this.pointerRotate = 0f;
            this.pointerRotateSpeed = 0f;
            this.spinMode = -2;
            this.lastRotate = -1000f;
            this.updateSpinButton();
            base.Invalidate();
            this.update();
        }
 public static void ClearInstance()
 {
     Instance = null;
 }