Esempio n. 1
0
    //should create one single card from a list of cards, given player object
    public void generateCard(GameObject player)
    {
        string path;
        int    card = 0;
        //string path, int cardLocation
        //a list that will hold all the cards
        List <Card> cards = new List <Card>();

        //player.GetComponent<player>().DeckPath = Application.dataPath + player.GetComponent<player>().DeckPath;

        //loads the cards into the list from an XML file
        DeckReader reader = new DeckReader();

        path = Application.dataPath + player.GetComponent <player>().DeckPath;

        if (path.Equals(Application.dataPath + ""))
        {
            //EditorUtility.DisplayDialog("No Deck Selected", "You need to load a deck!", "Alright. God.");
        }
        else
        {
            cards = reader.load(path);
            InstantiateCard(player, cards[card]);
            card++;

            if (card == cards.Count)
            {
                card = 0;
            }
        }

        //generates the card using the prefabCard prefab
        Debug.Log("Method Called");
    }
Esempio n. 2
0
    /*
     * The following methods are for testing purposes only, and are cut down versions of what will be in game logic
     */

    /*
     * Here is old logic I may want to see later:
     *  // Runs once at the start of Player 1's turn
     *  //if (player1.GetComponent<player>().IsTurn == true && player1.GetComponent<player>().hasStartedGoing == false)
     *  //{
     *  //    turn(player1);
     *  //    player1Mana.text = player1.GetComponent<player>().CurrentMana.ToString();
     *  //    player1.GetComponent<player>().hasStartedGoing = true;
     *
     *  //}
     *
     *  // Runs once at the start of Player 2's turn
     *  //if (player2.GetComponent<player>().IsTurn == true && player2.GetComponent<player>().hasStartedGoing == false)
     *  //{
     *  //    turn(player1);
     *  //    player2Mana.text = player2.GetComponent<player>().CurrentMana.ToString();
     *  //    player2.GetComponent<player>().hasStartedGoing = true;
     *
     *  //}
     *
     *  // The check for the end turn buttons loop
     *  //if (player1.GetComponent<player>().IsTurn == true)
     *  //{
     *  //    player1EndTurnButton.interactable = true;
     *  //    player2EndTurnButton.interactable = true;
     *  //}
     *
     *  //if (player2.GetComponent<player>().IsTurn == true)
     *  //{
     *  //    player2EndTurnButton.interactable = true;
     *  //    player1EndTurnButton.interactable = true;
     *  //}
     *
     *          /*List<Card> deck = new List<Card>();
     *
     *  DeckPath = Application.dataPath + "/scripts/xml/cards.xml";
     *
     *  DeckReader reader = new DeckReader();
     *
     *  List<Card> archiveDeck = reader.load(DeckPath);
     *
     *  Debug.Log(archiveDeck.Count);
     *
     *  for (int i = 0; i < archiveDeck.Count; i++)
     *  {
     *      deck.Add(archiveDeck[i]);
     *
     *      if (i == 26)
     *      {
     *          Debug.Log("End of the line");
     *          Debug.Log(deck[10].cardName);
     *      }
     *  }
     *
     *  ///// UPDATE USING THE DECK THAT IS IN THE PLAYER OBJECT - MAKE SURE THE PLAYER DECK IS LOADED IN START!
     *
     *
     * String DeckPath = Application.dataPath + "/scripts/xml/cards.xml";
     *
     * DeckReader reader = new DeckReader();
     *
     * List<Card> deck = new List<Card>();
     * List<Card> archiveDeck = reader.load(DeckPath);
     *
     *  for (int i = 0; i<archiveDeck.Count; i++)
     *  {
     *      deck.Add(archiveDeck[i]);
     *  }
     */

    //should create cards for each one in a deck and then instanstiate them in the game
    public void generateDeck(GameObject player)
    {
        string path;

        path = Application.dataPath + player.GetComponent <player>().DeckPath;

        List <Card> cards  = new List <Card>();
        DeckReader  reader = new DeckReader();

        if (path.Equals(Application.dataPath + ""))
        {
            //EditorUtility.DisplayDialog("No Deck Selected", "You need to load a deck!", "Alright. God.");
            Application.Quit();
        }
        else
        {
            cards = reader.load(path);

            //information about the size of the array of cards, and what card the while loop is on
            int totalCards  = cards.Count;
            int currentCard = 0;

            //goes through the cards one by one and adds them to the playing field
            while (currentCard < totalCards)
            {
                InstantiateCard(player, cards[currentCard]);
                currentCard++;
            }
        }
    }
    public void loadDeck()
    {
        Deck = new Deck();

        DeckReader reader = new DeckReader();

        List<Card> stock = reader.load(DeckPath);

        foreach (Card c in stock)
        {
            Deck.archiveDeck.Add(c);
        }

        Deck.resetActive();
        Deck.shuffle();
    }
Esempio n. 4
0
    public void loadDeck()
    {
        Deck = new Deck();

        DeckReader reader = new DeckReader();

        List <Card> stock = reader.load(DeckPath);

        foreach (Card c in stock)
        {
            Deck.archiveDeck.Add(c);
        }

        Deck.resetActive();
        Deck.shuffle();
    }
Esempio n. 5
0
    public void LoadDatabaseFromFile(String path)
    {
        Debug.Log("TRIGGER:LoadDatabaseFromFile");
        Path = path;
        DeckReader reader = new DeckReader();

        if (File.Exists(Path))
        {
            CardList = reader.load(Path);
            Debug.Log("TRIGGER:CardListLoad");
        }
        else
        {
            Debug.LogError("Error: File not Found");
        }
        Debug.Log(CardList[0].CardName + " is held by CardList @ pos0");
        CompileBook();
    }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        path = Application.dataPath + "/scripts/xml/cards.xml";
        DeckReader reader = new DeckReader();

        if (File.Exists(path))
        {
            List <Card> database = reader.load(path);

            foreach (Card card in database)
            {
                print(card.CardName + "_cost:" + card.Cost + " atk:" + card.Attack + " hp:" + card.Health);
            }

            Deck deck = new Deck();
            deck.activeDeck  = new List <Card>();
            deck.archiveDeck = new List <Card>();
            foreach (Card c in database)
            {
                deck.archiveDeck.Add(c);
            }
            deck.resetActive();
            deck.shuffle();
            Debug.Log(deck.peek().CardName + "bypass archiving and reset active");

            deck.shuffle();
            Debug.Log("Post Filter");
            foreach (Card card in deck.activeDeck)
            {
                print(card.CardName + "_cost:" + card.Cost + " atk:" + card.Attack + " hp:" + card.Health);
            }
            Debug.Log("Printed list operated upon.");
        }
        else
        {
            Debug.Log("Error: File not Found");
        }
    }
    // Use this for initialization
    void Start()
    {
        path = Application.dataPath + "/scripts/xml/cards.xml";
        DeckReader reader = new DeckReader();

        if (File.Exists(path))
        {
            List<Card> database = reader.load(path);

            foreach (Card card in database)
            {
                print(card.CardName + "_cost:" + card.Cost + " atk:" + card.Attack + " hp:" + card.Health);
            }

            Deck deck = new Deck();
            deck.activeDeck = new List<Card>();
            deck.archiveDeck = new List<Card>();
            foreach (Card c in database)
            {
                deck.archiveDeck.Add(c);
            }
            deck.resetActive();
            deck.shuffle();
            Debug.Log(deck.peek().CardName + "bypass archiving and reset active");

            deck.shuffle();
            Debug.Log("Post Filter");
            foreach (Card card in deck.activeDeck)
            {
                print(card.CardName + "_cost:" + card.Cost + " atk:" + card.Attack + " hp:" + card.Health);
            }
            Debug.Log("Printed list operated upon.");
        }
        else
        {
            Debug.Log("Error: File not Found");
        }
    }
Esempio n. 8
0
    /*
    The following methods are for testing purposes only, and are cut down versions of what will be in game logic
    */
    /*
    Here is old logic I may want to see later:
        // Runs once at the start of Player 1's turn
        //if (player1.GetComponent<player>().IsTurn == true && player1.GetComponent<player>().hasStartedGoing == false)
        //{
        //    turn(player1);
        //    player1Mana.text = player1.GetComponent<player>().CurrentMana.ToString();
        //    player1.GetComponent<player>().hasStartedGoing = true;

        //}

        // Runs once at the start of Player 2's turn
        //if (player2.GetComponent<player>().IsTurn == true && player2.GetComponent<player>().hasStartedGoing == false)
        //{
        //    turn(player1);
        //    player2Mana.text = player2.GetComponent<player>().CurrentMana.ToString();
        //    player2.GetComponent<player>().hasStartedGoing = true;

        //}

        // The check for the end turn buttons loop
        //if (player1.GetComponent<player>().IsTurn == true)
        //{
        //    player1EndTurnButton.interactable = true;
        //    player2EndTurnButton.interactable = true;
        //}

        //if (player2.GetComponent<player>().IsTurn == true)
        //{
        //    player2EndTurnButton.interactable = true;
        //    player1EndTurnButton.interactable = true;
        //}

                /*List<Card> deck = new List<Card>();

        DeckPath = Application.dataPath + "/scripts/xml/cards.xml";

        DeckReader reader = new DeckReader();

        List<Card> archiveDeck = reader.load(DeckPath);

        Debug.Log(archiveDeck.Count);

        for (int i = 0; i < archiveDeck.Count; i++)
        {
            deck.Add(archiveDeck[i]);

            if (i == 26)
            {
                Debug.Log("End of the line");
                Debug.Log(deck[10].cardName);
            }
        }

        ///// UPDATE USING THE DECK THAT IS IN THE PLAYER OBJECT - MAKE SURE THE PLAYER DECK IS LOADED IN START!

    String DeckPath = Application.dataPath + "/scripts/xml/cards.xml";

    DeckReader reader = new DeckReader();

    List<Card> deck = new List<Card>();
    List<Card> archiveDeck = reader.load(DeckPath);

        for (int i = 0; i<archiveDeck.Count; i++)
        {
            deck.Add(archiveDeck[i]);
        }
    */
    //should create cards for each one in a deck and then instanstiate them in the game
    public void generateDeck(GameObject player)
    {
        string path;
        path = Application.dataPath + player.GetComponent<player>().DeckPath;

        List<Card> cards = new List<Card>();
        DeckReader reader = new DeckReader();

        if (path.Equals(Application.dataPath + ""))
        {
            //EditorUtility.DisplayDialog("No Deck Selected", "You need to load a deck!", "Alright. God.");
            Application.Quit();
        }
        else
        {
            cards = reader.load(path);

            //information about the size of the array of cards, and what card the while loop is on
            int totalCards = cards.Count;
            int currentCard = 0;

            //goes through the cards one by one and adds them to the playing field
            while (currentCard < totalCards)
            {
                InstantiateCard(player, cards[currentCard]);
                currentCard++;
            }
        }
    }
Esempio n. 9
0
    //should create one single card from a list of cards, given player object
    public void generateCard(GameObject player)
    {
        string path;
        int card = 0;
        //string path, int cardLocation
        //a list that will hold all the cards
        List<Card> cards = new List<Card>();

        //player.GetComponent<player>().DeckPath = Application.dataPath + player.GetComponent<player>().DeckPath;

        //loads the cards into the list from an XML file
        DeckReader reader = new DeckReader();

        path = Application.dataPath + player.GetComponent<player>().DeckPath;

        if (path.Equals(Application.dataPath + ""))
        {
            //EditorUtility.DisplayDialog("No Deck Selected", "You need to load a deck!", "Alright. God.");
        }
        else
        {
            cards = reader.load(path);
            InstantiateCard(player, cards[card]);
            card++;

            if (card == cards.Count)
            {
                card = 0;
            }
        }

        //generates the card using the prefabCard prefab
        Debug.Log("Method Called");
    }
Esempio n. 10
0
    /// <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;
    }
 public void LoadDatabaseFromFile(String path)
 {
     Debug.Log("TRIGGER:LoadDatabaseFromFile");
     Path = path;
     DeckReader reader = new DeckReader();
     if (File.Exists(Path))
     {
         CardList = reader.load(Path);
         Debug.Log("TRIGGER:CardListLoad");
     }
     else
     {
         Debug.LogError("Error: File not Found");
     }
     Debug.Log(CardList[0].CardName + " is held by CardList @ pos0");
     CompileBook();
 }
Esempio n. 12
0
    private void populate(int direction)
    {
        //populate page with 10 cards from those viable for current player's build
        //load database array from path using Reader
        if (!loadedDatabase)
        {
            Path = Application.dataPath + "/scripts/xml/database.xml";
            DeckReader reader = new DeckReader();
            if (File.Exists(Path))
            {
                List <Card> cardList = reader.load(Path);
                Debug.Log("Card List: " + cardList[0].CardName);
                Database             = new Deck();
                Database.activeDeck  = new List <Card>();
                Database.archiveDeck = new List <Card>();
                foreach (Card c in cardList)
                {
                    Database.archiveDeck.Add(c);
                }
                Debug.Log("archiveDeck: " + Database.archiveDeck[0].CardName);
                foreach (Card c in Database.archiveDeck)
                {
                    Database.activeDeck.Add(c);
                }
                Database.resetActive();
                Debug.Log("activeDeck: " + Database.activeDeck[0].CardName);
                loadedDatabase = true;
                //TODO: Sort Database Deck by cost and lettering
            }
            else
            {
                Debug.Log("Error: File not Found");
            }
        }
        //instantiate the objects/visual representation
        Card current;
        int  DatabaseSize = Database.activeDeck.Count;

        switch (direction)
        {
        case -1:
            for (int i = DatabaseSize - 1; i >= DatabaseSize - 10; i--)
            {
                Debug.LogError(i);
                current = Database.activeDeck[i];
                Database.activeDeck.RemoveAt(i);
                Debug.Log("Current:" + current.CardName);
                DisplayedCards.Add(current);
            }
            break;

        case 0:
            for (int i = 0; i < 10; i++)
            {
                current = Database.activeDeck[i];
                Database.activeDeck.RemoveAt(i);
                Debug.Log("Current:" + current.CardName);
                DisplayedCards.Add(current);
            }
            break;

        case 1:
            for (int i = 0; i < 10; i++)
            {
                current = Database.activeDeck[i];
                Database.activeDeck.RemoveAt(i);
                Debug.Log("Current:" + current.CardName);
                DisplayedCards.Add(current);
            }
            break;
        }
        Debug.LogError("Free From Loop");
        for (int i = 1; i <= 10; i++)
        {
            GameObject card;
            if (Database.hasNext())
            {
                current = DisplayedCards[i - 1];
                // Create the card with creature prefab
                card = (GameObject)Instantiate(displayedCardPrefab, slot1.transform.position, slot1.transform.rotation);
                card.transform.FindChild("Splash").gameObject.GetComponent <Image>().sprite = spriteSheet[UnityEngine.Random.Range(0, 8)]; //TODO: nonrandom sprites
                if (current.Type.Equals("Creature"))
                {
                    card.transform.FindChild("Frame_creature").gameObject.SetActive(true);
                    card.transform.FindChild("Frame_spell").gameObject.SetActive(false);
                }
                // Or create it using the spell prefab
                else
                {
                    card.transform.FindChild("Frame_creature").gameObject.SetActive(false);
                    card.transform.FindChild("Frame_spell").gameObject.SetActive(true);
                }
                //quick reference card's script component
                Card cardsScript = card.GetComponent <Card>();
                switch (i)
                { //TODO: Finish conversions
                case 1:
                    card.transform.SetParent(slot1.transform.parent);
                    card.transform.position = new Vector3(slot1.transform.position.x, slot1.transform.position.y + 6, slot1.transform.position.z);
                    break;

                case 2:
                    card.transform.SetParent(slot2.transform.parent);
                    card.transform.position = new Vector3(slot2.transform.position.x, slot2.transform.position.y + 6, slot2.transform.position.z);
                    break;

                case 3:
                    card.transform.SetParent(slot3.transform.parent);
                    card.transform.position = new Vector3(slot3.transform.position.x, slot3.transform.position.y + 6, slot3.transform.position.z);
                    break;

                case 4:
                    card.transform.SetParent(slot4.transform.parent);
                    card.transform.position = new Vector3(slot4.transform.position.x, slot4.transform.position.y + 6, slot4.transform.position.z);
                    break;

                case 5:
                    card.transform.SetParent(slot5.transform.parent);
                    card.transform.position = new Vector3(slot5.transform.position.x, slot5.transform.position.y + 6, slot5.transform.position.z);
                    break;

                case 6:
                    card.transform.SetParent(slot6.transform.parent);
                    card.transform.position = new Vector3(slot6.transform.position.x, slot6.transform.position.y + 6, slot6.transform.position.z);
                    break;

                case 7:
                    card.transform.SetParent(slot7.transform.parent);
                    card.transform.position = new Vector3(slot7.transform.position.x, slot7.transform.position.y + 6, slot7.transform.position.z);
                    break;

                case 8:
                    card.transform.SetParent(slot8.transform.parent);
                    card.transform.position = new Vector3(slot8.transform.position.x, slot8.transform.position.y + 6, slot8.transform.position.z);
                    break;

                case 9:
                    card.transform.SetParent(slot9.transform.parent);
                    card.transform.position = new Vector3(slot9.transform.position.x, slot9.transform.position.y + 6, slot9.transform.position.z);
                    break;

                case 10:
                    card.transform.SetParent(slot10.transform.parent);
                    card.transform.position = new Vector3(slot10.transform.position.x, slot10.transform.position.y + 6, slot10.transform.position.z);
                    break;
                }

                // Initialize the card's current values
                current.SetCurrents();

                // Set the card's name
                card.GetComponentInChildren <Text>().text = current.CardName;

                //TODO: set all values of script to those of current, or just set equal to that of current
                cardsScript.CardName = current.CardName;
                card.name            = current.CardName;

                // Set all of the remaining information for the card
                Debug.Log("ID" + current.ID);
                cardsScript.ID          = current.ID;
                cardsScript.Image       = current.Image;
                cardsScript.Description = current.Description;
                cardsScript.Alliance    = current.Alliance;
                cardsScript.Cost        = current.Cost;
                cardsScript.Attack      = current.Attack;
                cardsScript.Health      = current.Health;
                cardsScript.Defense     = current.Defense;
                cardsScript.Range       = current.Range;
                cardsScript.OwnerTag    = "Player 1";
                cardsScript.EffectName  = current.EffectName;
                Debug.Log("ScriptID" + current.ID);

                card.transform.Find("Title").gameObject.GetComponent <Text>().text       = cardsScript.CardName;
                card.transform.Find("Description").gameObject.GetComponent <Text>().text = cardsScript.Description;
                //display Creature specific traits
                if (current.Type.Equals("Creature"))
                {
                    card.transform.Find("Attack").gameObject.GetComponent <Text>().text  = cardsScript.Attack;
                    card.transform.Find("Defense").gameObject.GetComponent <Text>().text = cardsScript.Defense;
                    card.transform.Find("Health").gameObject.GetComponent <Text>().text  = cardsScript.Health;
                    //Display M for range if Melee, R if ranged
                    if (cardsScript.Range.Equals("Melee"))
                    {
                        card.transform.Find("Range").gameObject.GetComponent <Text>().text = "M";
                    }
                    else if (cardsScript.Range.Equals("Ranged"))
                    {
                        card.transform.Find("Range").gameObject.GetComponent <Text>().text = "R";
                    }
                    else
                    {
                        card.transform.Find("Range").gameObject.GetComponent <Text>().text = "";
                    }
                }
                else
                {
                    card.transform.Find("Attack").gameObject.SetActive(false);
                    card.transform.Find("Defense").gameObject.SetActive(false);
                    card.transform.Find("Health").gameObject.SetActive(false);
                    card.transform.Find("Range").gameObject.SetActive(false);
                }
                card.transform.Find("Cost").gameObject.GetComponent <Text>().text = cardsScript.Cost;
            }
        }
    }
    /// <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;
    }
    private void populate(int direction)
    {
        //populate page with 10 cards from those viable for current player's build
        //load database array from path using Reader
        if (!loadedDatabase)
        {
            Path = Application.dataPath + "/scripts/xml/database.xml";
            DeckReader reader = new DeckReader();
            if (File.Exists(Path))
            {
                List<Card> cardList = reader.load(Path);
                Debug.Log("Card List: " + cardList[0].CardName);
                Database = new Deck();
                Database.activeDeck = new List<Card>();
                Database.archiveDeck = new List<Card>();
                foreach (Card c in cardList)
                {
                    Database.archiveDeck.Add(c);
                }
                Debug.Log("archiveDeck: " + Database.archiveDeck[0].CardName);
                foreach (Card c in Database.archiveDeck)
                {
                    Database.activeDeck.Add(c);
                }
                Database.resetActive();
                Debug.Log("activeDeck: " + Database.activeDeck[0].CardName);
                loadedDatabase = true;
                //TODO: Sort Database Deck by cost and lettering
            }
            else
            {
                Debug.Log("Error: File not Found");
            }
        }
        //instantiate the objects/visual representation
        Card current;
        int DatabaseSize = Database.activeDeck.Count;
        switch (direction)
        {
            case -1:
                for (int i = DatabaseSize-1; i >= DatabaseSize - 10; i--)
                {
                    Debug.LogError(i);
                    current = Database.activeDeck[i];
                    Database.activeDeck.RemoveAt(i);
                    Debug.Log("Current:" + current.CardName);
                    DisplayedCards.Add(current);
                }
                break;
            case 0:
                for (int i = 0; i < 10; i++)
                {
                    current = Database.activeDeck[i];
                    Database.activeDeck.RemoveAt(i);
                    Debug.Log("Current:" + current.CardName);
                    DisplayedCards.Add(current);
                }
                break;
            case 1:
                for (int i = 0; i < 10; i++)
                {
                    current = Database.activeDeck[i];
                    Database.activeDeck.RemoveAt(i);
                    Debug.Log("Current:" + current.CardName);
                    DisplayedCards.Add(current);
                }
                break;
        }
        Debug.LogError("Free From Loop");
        for (int i = 1; i <= 10; i++)
        {
            GameObject card;
            if (Database.hasNext())
            {
                current = DisplayedCards[i-1];
                // Create the card with creature prefab
                card = (GameObject)Instantiate(displayedCardPrefab, slot1.transform.position, slot1.transform.rotation);
                card.transform.FindChild("Splash").gameObject.GetComponent<Image>().sprite = spriteSheet[UnityEngine.Random.Range(0, 8)]; //TODO: nonrandom sprites
                if (current.Type.Equals("Creature"))
                {
                    card.transform.FindChild("Frame_creature").gameObject.SetActive(true);
                    card.transform.FindChild("Frame_spell").gameObject.SetActive(false);
                }
                // Or create it using the spell prefab
                else
                {
                    card.transform.FindChild("Frame_creature").gameObject.SetActive(false);
                    card.transform.FindChild("Frame_spell").gameObject.SetActive(true);
                }
                //quick reference card's script component
                Card cardsScript = card.GetComponent<Card>();
                switch (i)
                { //TODO: Finish conversions

                    case 1:
                        card.transform.SetParent(slot1.transform.parent);
                        card.transform.position = new Vector3(slot1.transform.position.x, slot1.transform.position.y + 6, slot1.transform.position.z);
                        break;
                    case 2:
                        card.transform.SetParent(slot2.transform.parent);
                        card.transform.position = new Vector3(slot2.transform.position.x, slot2.transform.position.y + 6, slot2.transform.position.z);
                        break;
                    case 3:
                        card.transform.SetParent(slot3.transform.parent);
                        card.transform.position = new Vector3(slot3.transform.position.x, slot3.transform.position.y + 6, slot3.transform.position.z);
                        break;
                    case 4:
                        card.transform.SetParent(slot4.transform.parent);
                        card.transform.position = new Vector3(slot4.transform.position.x, slot4.transform.position.y + 6, slot4.transform.position.z);
                        break;
                    case 5:
                        card.transform.SetParent(slot5.transform.parent);
                        card.transform.position = new Vector3(slot5.transform.position.x, slot5.transform.position.y + 6, slot5.transform.position.z);
                        break;
                    case 6:
                        card.transform.SetParent(slot6.transform.parent);
                        card.transform.position = new Vector3(slot6.transform.position.x, slot6.transform.position.y + 6, slot6.transform.position.z);
                        break;
                    case 7:
                        card.transform.SetParent(slot7.transform.parent);
                        card.transform.position = new Vector3(slot7.transform.position.x, slot7.transform.position.y + 6, slot7.transform.position.z);
                        break;
                    case 8:
                        card.transform.SetParent(slot8.transform.parent);
                        card.transform.position = new Vector3(slot8.transform.position.x, slot8.transform.position.y + 6, slot8.transform.position.z);
                        break;
                    case 9:
                        card.transform.SetParent(slot9.transform.parent);
                        card.transform.position = new Vector3(slot9.transform.position.x, slot9.transform.position.y + 6, slot9.transform.position.z);
                        break;
                    case 10:
                        card.transform.SetParent(slot10.transform.parent);
                        card.transform.position = new Vector3(slot10.transform.position.x, slot10.transform.position.y + 6, slot10.transform.position.z);
                        break;
                }

                // Initialize the card's current values
                current.SetCurrents();

                // Set the card's name
                card.GetComponentInChildren<Text>().text = current.CardName;

                //TODO: set all values of script to those of current, or just set equal to that of current
                cardsScript.CardName = current.CardName;
                card.name = current.CardName;

                // Set all of the remaining information for the card
                Debug.Log("ID" + current.ID);
                cardsScript.ID = current.ID;
                cardsScript.Image = current.Image;
                cardsScript.Description = current.Description;
                cardsScript.Alliance = current.Alliance;
                cardsScript.Cost = current.Cost;
                cardsScript.Attack = current.Attack;
                cardsScript.Health = current.Health;
                cardsScript.Defense = current.Defense;
                cardsScript.Range = current.Range;
                cardsScript.OwnerTag = "Player 1";
                cardsScript.EffectName = current.EffectName;
                Debug.Log("ScriptID" + current.ID);

                card.transform.Find("Title").gameObject.GetComponent<Text>().text = cardsScript.CardName;
                card.transform.Find("Description").gameObject.GetComponent<Text>().text = cardsScript.Description;
                //display Creature specific traits
                if (current.Type.Equals("Creature"))
                {
                card.transform.Find("Attack").gameObject.GetComponent<Text>().text = cardsScript.Attack;
                card.transform.Find("Defense").gameObject.GetComponent<Text>().text = cardsScript.Defense;
                card.transform.Find("Health").gameObject.GetComponent<Text>().text = cardsScript.Health;
                //Display M for range if Melee, R if ranged
                    if (cardsScript.Range.Equals("Melee"))
                    {
                        card.transform.Find("Range").gameObject.GetComponent<Text>().text = "M";
                    }
                    else if (cardsScript.Range.Equals("Ranged"))
                    {
                        card.transform.Find("Range").gameObject.GetComponent<Text>().text = "R";
                    }
                    else
                    {
                        card.transform.Find("Range").gameObject.GetComponent<Text>().text = "";
                    }
                }
                else
                {
                    card.transform.Find("Attack").gameObject.SetActive(false);
                    card.transform.Find("Defense").gameObject.SetActive(false);
                    card.transform.Find("Health").gameObject.SetActive(false);
                    card.transform.Find("Range").gameObject.SetActive(false);
                }
                card.transform.Find("Cost").gameObject.GetComponent<Text>().text = cardsScript.Cost;

            }
        }
    }