Exemplo n.º 1
0
    /// <summary>
    /// Write the event list
    /// </summary>
    /// <param name="controls"></param>
    public void XMLWriteEventList(GameManager.ControlScheme controls)
    {
        //create the filename at the current time
        filename = sessionID + controls.ToString()
                   + "_" + DateTime.Now.Hour.ToString()
                   + "_" + DateTime.Now.Minute.ToString()
                   + "_" + DateTime.Now.Second.ToString()
                   + ".xml";


        //if on android, put it at the Application data
#if UNITY_ANDROID
        filename = Application.persistentDataPath + "/" + filename;
#endif

        //using the XMLWriter on a new file
        using (XmlWriter writer = XmlWriter.Create(filename))
        {
            //start the document
            writer.WriteStartDocument();
            writer.WriteStartElement("Events");

            //for each event, write the event
            foreach (Event e in _eventList)
            {
                e.WriteEvent(writer);
            }

            //finish the document
            writer.WriteEndElement();
            writer.WriteEndDocument();
        }

        //check the file exists
#if UNITY_ANDROID
        FileInfo f = new FileInfo(filename);
        if (f.Exists)
        {
            print("file exists at " + filename);
        }
#endif
    }
Exemplo n.º 2
0
 public override void WriteEvent(XmlWriter w)
 {
     MonoBehaviour.print("writing start event");
     w.WriteStartElement(currentControls.ToString());
 }