public void rebuild() { int[] completedQuests = null; int y = 0; this.questsScrollArea.clearControls(); if (this.isQuestList) { if (this.completedQuests == null) { NewQuestsData data = GameEngine.Instance.World.getNewQuestData(); if (data == null) { return; } completedQuests = data.completedQuests; } else { completedQuests = this.completedQuests.ToArray(); } for (int i = 0; i < completedQuests.Length; i++) { int quest = completedQuests[i]; NewQuestLine control = new NewQuestLine(); if (y != 0) { y += 5; } control.Position = new Point(0, y); control.init(quest, i); this.questsScrollArea.addControl(control); y += control.Height; } } else { CustomSelfDrawPanel.CSDLabel label = new CustomSelfDrawPanel.CSDLabel(); switch (this._questID) { case 0x22: case 0x30: case 4: case 0x10: case 0x65: case 0x7a: case 0x40: case 0x54: if ((!GameEngine.Instance.World.isBigpointAccount && !Program.aeriaInstall) && (!Program.bigpointPartnerInstall && !Program.arcInstall)) { label.Text = SK.Text("QUESTS_IAF_Help1", "Learn about how inviting your friends to the game can earn you up to $160 worth of crowns."); } else { label.Text = SK.Text("QUESTS_IAF_Help2", "Why not invite a friend to play Kingdoms? They can fight alongside you and you will help us to further develop the game. "); } break; default: label.Text = SK.NoStoreText("Z_QUEST_HELP_" + this.questText); break; } label.Color = ARGBColors.Black; label.Position = new Point(0x24, 30); label.Size = new Size(this.questsScrollArea.Width, this.questsScrollArea.Height); label.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); label.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.mainBackgroundImage.addControl(label); } this.questsScrollArea.Size = new Size(this.questsScrollArea.Width, y); if (y < this.questsScrollBar.Height) { this.questsScrollBar.Visible = false; } else { this.questsScrollBar.Visible = true; this.questsScrollBar.NumVisibleLines = this.questsScrollBar.Height; this.questsScrollBar.Max = y - this.questsScrollBar.Height; } this.questsScrollArea.invalidate(); this.questsScrollBar.invalidate(); this.mainBackgroundImage.invalidate(); }
public void rebuild(int activeQuest) { bool allowStart = true; NewQuestsData data = GameEngine.Instance.World.getNewQuestData(); if (data != null) { if (data.questID >= 0) { allowStart = false; } int[] availableQuests = data.availableQuests; if (availableQuests == null) { availableQuests = new int[0]; } this.questsScrollArea.clearControls(); int y = 0; this.lineList.Clear(); if (!GameEngine.Instance.World.isTutorialActive()) { double num1 = DXTimer.GetCurrentMilliseconds() / 1000.0; int index = 0; while (index < availableQuests.Length) { int quest = availableQuests[index]; if (quest > 0) { NewQuestLine control = new NewQuestLine(); if (y != 0) { y += 5; } control.Position = new Point(0, y); control.init(quest, this, index, activeQuest, allowStart, false); this.questsScrollArea.addControl(control); y += control.Height; this.lineList.Add(control); } index++; } if (data.numAbandonedQuests > 0) { NewQuestLine line2 = new NewQuestLine(); if (y != 0) { y += 5; } line2.Position = new Point(0, y); line2.init(-data.numAbandonedQuests, this, index, activeQuest, allowStart, false); this.questsScrollArea.addControl(line2); y += line2.Height; this.lineList.Add(line2); } this.tutorialText.Visible = false; } else { this.tutorialText.Visible = true; } y += 5; this.questsScrollArea.Size = new Size(this.questsScrollArea.Width, y); if (y < this.questsScrollBar.Height) { this.questsScrollBar.Visible = false; } else { this.questsScrollBar.Visible = true; this.questsScrollBar.NumVisibleLines = this.questsScrollBar.Height; this.questsScrollBar.Max = y - this.questsScrollBar.Height; } this.questsScrollArea.invalidate(); this.questsScrollBar.invalidate(); this.backgroundImage.invalidate(); this.update(); } }