/// <remarks> /// This class should create some dummy decks for the user to select and load them into the player data object, /// and manage all of the button functions for the menu. /// </remarks> void Start() { Player1Data.GetComponent <player>().Name = "Player 1"; Player2Data.GetComponent <player>().Name = "Player 2"; exitMenu.enabled = false; helperPrompt.enabled = false; DontDestroyOnLoad(Player1Data); DontDestroyOnLoad(Player2Data); /* * List<TextAsset> decks = new List<TextAsset>(); * * TextAsset[] stuff = (TextAsset[])Resources.LoadAll("Decks"); * * foreach (TextAsset xmlDeck in stuff) * { * * DeckReader reader = new DeckReader(); * * List<Card> database = reader.load(xmlDeck); * * Deck deck = new Deck(reader.GetDeckName(xml)); * * foreach (Card c in database) * { * deck.archiveDeck.Add(c); * } * * deckPool.Add(deck); * } */ //paths.Add("/scripts/xml/cards.xml"); //paths.Add("/scripts/xml/2cards.xml"); //paths.Add("/scripts/xml/3cards.xml"); //paths.Add("/scripts/xml/neutralsAndSpells.xml"); // The newest spells that you can buy! paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); foreach (string p in paths) { //TEMP: method to create deck pool from all usable decks, for now, creates same deck off archive string path = Application.dataPath + p; DeckReader reader = new DeckReader(); List <Card> database = reader.load(path); Deck deck = new Deck(path, reader.GetDeckName(path)); foreach (Card c in database) { deck.archiveDeck.Add(c); } deckPool.Add(deck); i++; } foreach (Deck d in deckPool) { Dropdown.OptionData data = new Dropdown.OptionData(d.deckName); p1Selector.options.Add(data); p2Selector.options.Add(data); //Debug.Log("Option added of deckName " + d.deckName); } Player1Data.GetComponent <player>().DeckPath = deckPool[0].path; Player2Data.GetComponent <player>().DeckPath = deckPool[0].path; }
/// <remarks> /// This class should create some dummy decks for the user to select and load them into the player data object, /// and manage all of the button functions for the menu. /// </remarks> void Start() { Player1Data.GetComponent<player>().Name = "Player 1"; Player2Data.GetComponent<player>().Name = "Player 2"; exitMenu.enabled = false; helperPrompt.enabled = false; DontDestroyOnLoad(Player1Data); DontDestroyOnLoad(Player2Data); /* List<TextAsset> decks = new List<TextAsset>(); TextAsset[] stuff = (TextAsset[])Resources.LoadAll("Decks"); foreach (TextAsset xmlDeck in stuff) { DeckReader reader = new DeckReader(); List<Card> database = reader.load(xmlDeck); Deck deck = new Deck(reader.GetDeckName(xml)); foreach (Card c in database) { deck.archiveDeck.Add(c); } deckPool.Add(deck); } */ //paths.Add("/scripts/xml/cards.xml"); //paths.Add("/scripts/xml/2cards.xml"); //paths.Add("/scripts/xml/3cards.xml"); //paths.Add("/scripts/xml/neutralsAndSpells.xml"); // The newest spells that you can buy! paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); paths.Add("/scripts/xml/spellsWithModifiers.xml"); foreach (string p in paths) { //TEMP: method to create deck pool from all usable decks, for now, creates same deck off archive string path = Application.dataPath + p; DeckReader reader = new DeckReader(); List<Card> database = reader.load(path); Deck deck = new Deck(path, reader.GetDeckName(path)); foreach (Card c in database) { deck.archiveDeck.Add(c); } deckPool.Add(deck); i++; } foreach (Deck d in deckPool) { Dropdown.OptionData data = new Dropdown.OptionData(d.deckName); p1Selector.options.Add(data); p2Selector.options.Add(data); //Debug.Log("Option added of deckName " + d.deckName); } Player1Data.GetComponent<player>().DeckPath = deckPool[0].path; Player2Data.GetComponent<player>().DeckPath = deckPool[0].path; }