addCard() публичный Метод

public addCard ( Card, submission ) : void
submission Card,
Результат void
Пример #1
0
/*
 * Core Hooks
 */

    /**
     * Instructs the database to parse the XML file given by filename and add it to the collection
     */
    public int addBinderFromXML(string filename)
    {
        Binder newBinder = new Binder(filename);                                  // Declare a new binder to be later added.

        TextAsset   xmlFile     = Resources.Load("XML/" + filename) as TextAsset; // We'll see how this works for now :)
        XmlDocument questionDoc = new XmlDocument();

        questionDoc.LoadXml(xmlFile.text);

        XmlNodeList questionNodes = questionDoc.DocumentElement.SelectNodes("/Flipbook/Card");

        // For each question in the XML file...
        foreach (XmlNode card in questionNodes)
        {
            // Parse and assemble the question
            Card newCard = new Card(card.SelectSingleNode("Question").InnerText, card.SelectSingleNode("Answer").InnerText);
            // Push the question into the binder
            newBinder.addCard(newCard);
        }

        // Now we here
        // Add the set to the collection and return its ID number
        loadedBinders.Add(newBinder);          // Binders full of women
        return(loadedBinders.Count - 1);
    }
Пример #2
0
    /*
     * Core Hooks
     */
    /**
     * Instructs the database to parse the XML file given by filename and add it to the collection
     */
    public int addBinderFromXML(string filename)
    {
        Binder newBinder = new Binder (filename); // Declare a new binder to be later added.

        TextAsset xmlFile = Resources.Load ("XML/" + filename) as TextAsset; // We'll see how this works for now :)
        XmlDocument questionDoc = new XmlDocument ();
        questionDoc.LoadXml (xmlFile.text);

        XmlNodeList questionNodes = questionDoc.DocumentElement.SelectNodes ("/Flipbook/Card");

        // For each question in the XML file...
        foreach (XmlNode card in questionNodes) {
            // Parse and assemble the question
            Card newCard = new Card(card.SelectSingleNode("Question").InnerText, card.SelectSingleNode ("Answer").InnerText);
            // Push the question into the binder
            newBinder.addCard (newCard);
        }

        // Now we here
        // Add the set to the collection and return its ID number
        loadedBinders.Add (newBinder); // Binders full of women
        return (loadedBinders.Count - 1);
    }