Example #1
0
        public void init(int questID, int villageID, NewQuestsPanel questPanel, NewQuestRewardPopup parent)
        {
            this.m_questID    = questID;
            this.m_villageID  = -1;
            this.m_questPanel = questPanel;
            base.clearControls();
            bool flag = false;

            if (GameEngine.Instance.World.YourHouse > 0)
            {
                flag = true;
            }
            if (GameEngine.Instance.LocalWorldData.Alternate_Ruleset == 1)
            {
                flag = false;
            }
            List <int> list   = GameEngine.Instance.World.getUserVillageIDList();
            int        height = 200;

            NewQuests.NewQuestDefinition def = NewQuests.getNewQuestDef(questID);
            this.fb_questID = def.questType - 1;
            NumberFormatInfo nFI = GameEngine.NFI;

            if (def.parameter > 0)
            {
                this.fb_questCaption = SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString) + " : " + def.parameter.ToString("N", nFI);
            }
            else
            {
                this.fb_questCaption = SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString);
            }
            if ((((def.reward_apples > 0) || (def.reward_stone > 0)) || (def.reward_wood > 0)) && (list.Count > 1))
            {
                if ((def.getRewardGlory() > 0) && flag)
                {
                    height = 0x1ec;
                }
                else
                {
                    height = 410;
                }
            }
            else if ((def.getRewardGlory() > 0) && flag)
            {
                height = 270;
            }
            else
            {
                height = 200;
            }
            parent.Size = new Size(550, height);
            this.headerBarImage.Position = new Point(0, 0);
            this.headerBarImage.Size     = new Size(base.Width, 30);
            base.addControl(this.headerBarImage);
            this.headerBarImage.Create((Image)GFXLibrary.messageboxtop_left, (Image)GFXLibrary.messageboxtop_middle, (Image)GFXLibrary.messageboxtop_right);
            this.backgroundImage.SpecialGradient = true;
            this.backgroundImage.Position        = new Point(0, 30);
            this.backgroundImage.Size            = new Size(base.Width, height - 30);
            base.addControl(this.backgroundImage);
            this.captureLabel.Text      = SK.Text("QuestLine_Collect_Reward", "Collect Reward");
            this.captureLabel.Color     = ARGBColors.White;
            this.captureLabel.Position  = new Point(13, 7);
            this.captureLabel.Size      = new Size(0x14f, 20);
            this.captureLabel.Font      = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
            this.captureLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.headerBarImage.addControl(this.captureLabel);
            this.strip1.Image    = (Image)GFXLibrary.quest_popup_hz_strip_02;
            this.strip1.Position = new Point(4, 4);
            this.backgroundImage.addControl(this.strip1);
            this.questIcon.Image    = (Image)GFXLibrary.quest_icons[Math.Min(def.questType, GFXLibrary.quest_icons.Length - 1)];
            this.questIcon.Position = new Point(12, 12);
            this.backgroundImage.addControl(this.questIcon);
            this.fb_questString         = this.lblQuestName.Text = SK.NoStoreText("Z_QUESTS_" + def.tagString);
            this.lblQuestName.Color     = ARGBColors.Black;
            this.lblQuestName.Position  = new Point(70, 0x1a);
            this.lblQuestName.Size      = new Size(700, 30);
            this.lblQuestName.Font      = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
            this.lblQuestName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.backgroundImage.addControl(this.lblQuestName);
            this.facebookShareButton.ImageNorm      = (Image)GFXLibrary.facebookBlueNorm;
            this.facebookShareButton.ImageOver      = (Image)GFXLibrary.facebookBlueOver;
            this.facebookShareButton.ImageClick     = (Image)GFXLibrary.facebookBlueClick;
            this.facebookShareButton.Position       = new Point(0xeb, height - 0x4b);
            this.facebookShareButton.UseTextSize    = true;
            this.facebookShareButton.Text.Text      = SK.Text("FACEBOOK_Share", "Share");
            this.facebookShareButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
            this.facebookShareButton.Text.Position  = new Point(20, 2);
            this.facebookShareButton.Text.Size      = new Size(110, 0x15);
            this.facebookShareButton.Text.Font      = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
            this.facebookShareButton.TextYOffset    = 0;
            this.facebookShareButton.Text.Color     = ARGBColors.Black;
            this.facebookShareButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.facebookShareClicked));
            this.backgroundImage.addControl(this.facebookShareButton);
            this.strip2.Image    = (Image)GFXLibrary.quest_popup_hz_strip_01;
            this.strip2.Position = new Point(0x18, 0x4f);
            this.backgroundImage.addControl(this.strip2);
            NewQuestsPanel.addRewardIcons(this.backgroundImage, new Point(30, 80), def, 0);
            this.collectButton.ImageNorm  = (Image)GFXLibrary.mail2_button_blue_141wide_normal;
            this.collectButton.ImageOver  = (Image)GFXLibrary.mail2_button_blue_141wide_over;
            this.collectButton.ImageClick = (Image)GFXLibrary.mail2_button_blue_141wide_pushed;
            this.collectButton.Position   = new Point(0x181, 0x57);
            this.collectButton.Text.Text  = SK.Text("QUESTS_Collect", "Collect");
            this.collectButton.Text.Font  = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
            this.collectButton.Text.Color = ARGBColors.Black;
            this.collectButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.okClicked), "NewQuests_Collect_Clicked");
            this.backgroundImage.addControl(this.collectButton);
            if (def.reward_charges.Length > 0)
            {
                this.chargesImage.Image           = (Image)GFXLibrary.quest_rewards[9];
                this.chargesImage.Position        = new Point(0x19, height - 0x52);
                this.chargesImage.CustomTooltipID = 0xc8c;
                this.backgroundImage.addControl(this.chargesImage);
            }
            if (((def.reward_apples > 0) || (def.reward_stone > 0)) || (def.reward_wood > 0))
            {
                if (list.Count > 1)
                {
                    this.strip4.Image    = (Image)GFXLibrary.quest_popup_hz_strip_03;
                    this.strip4.Position = new Point(0x18, 0x97);
                    this.backgroundImage.addControl(this.strip4);
                    this.collectButton.Enabled = false;
                    this.villageIcon.Image     = (Image)GFXLibrary.char_village_icons[5];
                    this.villageIcon.Position  = new Point(30, 0x94);
                    this.backgroundImage.addControl(this.villageIcon);
                    if (Program.mySettings.LanguageIdent == "fr")
                    {
                        this.targetVillageLabel.Text = "Village Cible";
                    }
                    else
                    {
                        this.targetVillageLabel.Text = SK.Text("VillageArmiesPanel_Target_Village", "Target Village");
                    }
                    this.targetVillageLabel.Color     = ARGBColors.Black;
                    this.targetVillageLabel.Position  = new Point(0, 130);
                    this.targetVillageLabel.Size      = new Size(base.Width, 30);
                    this.targetVillageLabel.Font      = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
                    this.targetVillageLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
                    this.backgroundImage.addControl(this.targetVillageLabel);
                    this.villageNameLabel.Text      = SK.Text("QUESTS_Pick_a_Village", "Pick a Village");
                    this.villageNameLabel.Color     = ARGBColors.Black;
                    this.villageNameLabel.Position  = new Point(90, 0x92);
                    this.villageNameLabel.Size      = new Size(base.Width - 90, this.villageIcon.Height);
                    this.villageNameLabel.Font      = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
                    this.villageNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
                    this.backgroundImage.addControl(this.villageNameLabel);
                    this.questsScrollArea.Position = new Point(0x3d, 200);
                    this.questsScrollArea.Size     = new Size(390, 0x73);
                    this.questsScrollArea.ClipRect = new Rectangle(new Point(0, 0), new Size(390, 0x73));
                    this.backgroundImage.addControl(this.questsScrollArea);
                    this.insetImage.Position = new Point(0x37, 0xc6);
                    this.insetImage.Size     = new Size(440, 0x77);
                    this.backgroundImage.addControl(this.insetImage);
                    this.insetImage.Create((Image)GFXLibrary.quest_popup_inset_top, (Image)GFXLibrary.quest_popup_inset_middle, (Image)GFXLibrary.quest_popup_inset_bottom);
                    this.questsScrollBar.Position = new Point(0x1cd, 0xcd);
                    this.questsScrollBar.Size     = new Size(0x18, 0x69);
                    this.backgroundImage.addControl(this.questsScrollBar);
                    this.questsScrollBar.Value           = 0;
                    this.questsScrollBar.Max             = 100;
                    this.questsScrollBar.NumVisibleLines = 0x19;
                    this.questsScrollBar.Create(null, null, null, (Image)GFXLibrary._24wide_thumb_top, (Image)GFXLibrary._24wide_thumb_middle, (Image)GFXLibrary._24wide_thumb_bottom);
                    this.questsScrollBar.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.wallScrollBarMoved));
                    this.mouseWheelOverlay.Position = this.questsScrollArea.Position;
                    this.mouseWheelOverlay.Size     = this.questsScrollArea.Size;
                    this.mouseWheelOverlay.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelMoved));
                    this.backgroundImage.addControl(this.mouseWheelOverlay);
                    this.addVillages(true);
                }
                else if (list.Count > 0)
                {
                    this.m_villageID = list[0];
                }
            }
            if ((def.getRewardGlory() > 0) && flag)
            {
                this.orLabel.Text      = SK.Text("QUESTS_or", "Or");
                this.orLabel.Color     = ARGBColors.Black;
                this.orLabel.Position  = new Point(0, height - 0x91);
                this.orLabel.Size      = new Size(base.Width, 30);
                this.orLabel.Font      = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
                this.orLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
                this.backgroundImage.addControl(this.orLabel);
                this.strip3.Image    = (Image)GFXLibrary.quest_popup_hz_strip_01;
                this.strip3.Position = new Point(0x18, (height - 0x7b) - 1);
                this.backgroundImage.addControl(this.strip3);
                NewQuestsPanel.addRewardIcons(this.backgroundImage, new Point(30, height - 0x7b), def, -1);
                this.collectGloryButton.ImageNorm  = (Image)GFXLibrary.misc_button_blue_210wide_normal;
                this.collectGloryButton.ImageOver  = (Image)GFXLibrary.misc_button_blue_210wide_over;
                this.collectGloryButton.ImageClick = (Image)GFXLibrary.misc_button_blue_210wide_pushed;
                this.collectGloryButton.Position   = new Point(0x13c, ((height - 0x7b) + 8) - 1);
                this.collectGloryButton.Text.Text  = SK.Text("QUESTS_Collect_Glory", "Collect Glory");
                this.collectGloryButton.Text.Font  = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
                this.collectGloryButton.Text.Color = ARGBColors.Black;
                this.collectGloryButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.okGloryClicked), "NewQuests_Collect_Glory_Clicked");
                this.backgroundImage.addControl(this.collectGloryButton);
            }
            this.cancelButton.ImageNorm  = (Image)GFXLibrary.mail2_button_blue_141wide_normal;
            this.cancelButton.ImageOver  = (Image)GFXLibrary.mail2_button_blue_141wide_over;
            this.cancelButton.ImageClick = (Image)GFXLibrary.mail2_button_blue_141wide_pushed;
            this.cancelButton.Position   = new Point(0x181, height - 0x4b);
            this.cancelButton.Text.Text  = SK.Text("GENERIC_Cancel", "Cancel");
            this.cancelButton.Text.Font  = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
            this.cancelButton.Text.Color = ARGBColors.Black;
            this.cancelButton.setClickDelegate(delegate {
                InterfaceMgr.Instance.closeNewQuestRewardPopup();
                InterfaceMgr.Instance.ParentForm.TopMost = true;
                InterfaceMgr.Instance.ParentForm.TopMost = false;
            }, "NewQuests_Cancel");
            this.backgroundImage.addControl(this.cancelButton);
            base.Invalidate();
            parent.Invalidate();
        }