// This is called when a quest is selected public void StartQuest(QuestLoader.Quest q) { // Fetch all of the quest data qd = new QuestData(q); if (qd == null) { Debug.Log("Error: Invalid Quest."); Application.Quit(); } // Populate null hero list, these can then be selected as hero types heros = new List <Hero>(); for (int i = 1; i < 5; i++) { heros.Add(new Hero(null, i)); } // Draw the hero icons, which are buttons for selection heroCanvas.SetupUI(); // Add a finished button to start the quest TextButton endSelection = new TextButton(new Vector2(UIScaler.GetRight(-9), UIScaler.GetBottom(-3)), new Vector2(8, 2), "Finished", delegate { EndSelection(); }, Color.green); // Untag as dialog so this isn't cleared away during hero selection endSelection.ApplyTag("heroselect"); TextButton cancelSelection = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Destroyer.QuestSelect(); }, Color.red); // Untag as dialog so this isn't cleared away during hero selection cancelSelection.ApplyTag("heroselect"); // Create the monster list so we are ready to start monsters = new List <Monster>(); }
public Quest(QuestLoader.Quest q) { game = Game.Get(); // This happens anyway but we need it to be here before the following code is executed game.quest = this; qd = new QuestData(q); boardItems = new Dictionary <string, BoardComponent>(); flags = new HashSet <string>(); monsters = new List <Monster>(); heroSelection = new Dictionary <string, List <Quest.Hero> >(); eManager = new EventManager(); delayedEvents = new List <QuestData.Event.DelayedEvent>(); undo = new Stack <string>(); // Populate null hero list, these can then be selected as hero types heroes = new List <Hero>(); for (int i = 1; i <= game.gameType.MaxHeroes(); i++) { heroes.Add(new Hero(null, i)); } Dictionary <string, string> packs = game.config.data.Get(game.gameType.TypeName() + "Packs"); if (packs != null) { foreach (KeyValuePair <string, string> kv in packs) { flags.Add("#" + kv.Key); } } }
// This is called when a quest is selected public void StartQuest(QuestLoader.Quest q) { // Fetch all of the quest data and initialise the quest quest = new Quest(q); // Draw the hero icons, which are buttons for selection heroCanvas.SetupUI(); // Add a finished button to start the quest TextButton endSelection = new TextButton(new Vector2(UIScaler.GetRight(-9), UIScaler.GetBottom(-3)), new Vector2(8, 2), "Finished", delegate { EndSelection(); }, Color.green); endSelection.SetFont(gameType.GetHeaderFont()); // Untag as dialog so this isn't cleared away during hero selection endSelection.ApplyTag("heroselect"); // Add a title to the page DialogBox db = new DialogBox(new Vector2(8, 1), new Vector2(UIScaler.GetWidthUnits() - 16, 3), "Select " + gameType.HeroesName()); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont(); db.SetFont(gameType.GetHeaderFont()); db.ApplyTag("heroselect"); TextButton cancelSelection = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Destroyer.QuestSelect(); }, Color.red); cancelSelection.SetFont(gameType.GetHeaderFont()); // Untag as dialog so this isn't cleared away during hero selection cancelSelection.ApplyTag("heroselect"); }
public QuestData(QuestLoader.Quest q) { questPath = q.path + "/quest.ini"; LoadQuestData(); }