Beispiel #1
0
    void Load()
    {
        TextAsset       xml  = Resources.Load <TextAsset>(Path);
        TextureDataList data = DataManager.XMLUnmarshallingFromText <TextureDataList>(xml.text);

        foreach (TextureData tdata in data.textures)
        {
            string id      = tdata.id;
            Sprite texture = Resources.Load <Sprite>(tdata.path);

            pool.Add(id, texture);
            Debug.Log(texture + " LOADED");
        }
    }
Beispiel #2
0
    public void XMLExample()
    {
        TextureData td1 = new TextureData();

        td1.id          = "001";
        td1.path        = "Blegh";
        td1.name        = "Ble";
        td1.description = "This is a Bleg";

        TextureData td2 = new TextureData();

        td2.id          = "td02";
        td2.path        = "Dani";
        td2.name        = "Daniela";
        td2.description = "This is a Dani";

        TextureDataList tdl = new TextureDataList();

        tdl.textures    = new TextureData[2];
        tdl.textures[0] = td1;
        tdl.textures[1] = td2;

        DataManager.XMLMarshalling(Path, tdl);
    }