Ejemplo n.º 1
0
    public void Start()
    {
        SetScreenCanvas();
        SetUIAudio();

        StandardItems.LoadStandardItems();
        SceneManager.sceneLoaded += SceneChanged;
    }
Ejemplo n.º 2
0
    public static void LoadStandardItems()
    {
        //string xmlText = File.ReadAllText("Assets/Standard Items.xml"); //Doesn't work on build
        string xmlText = Resources.Load <TextAsset>("Standard Items").text;
        int    index   = xmlText.IndexOf('<');

        if (index > 0)
        {
            xmlText = xmlText.Substring(index);
        }

        XmlSerializer serializer = new XmlSerializer(typeof(StandardItems), new XmlRootAttribute("StandardItems"));
        StringReader  reader     = new StringReader(xmlText);

        instance = (serializer.Deserialize(reader) as StandardItems);
        reader.Close();

        /*Debug.Log("There are " + Items.Count + " items in the Item Database! (Standard Items.xml)");
         * for (int i = 0; i < Items.Count; i++)
         *      Debug.Log(Items[i].ToString());*/
    }