FileUtils.FileList loadFileList(string folder) { //XmlSerializer serial = new XmlSerializer(typeof(FileUtils.FileList)); // Stream reader = new FileStream(folder + "file_list.xml", FileMode.Open); //FileUtils.FileList list = (FileUtils.FileList)serial.Deserialize(reader); String path = folder + "file_list"; TextAsset data = Resources.Load(path) as TextAsset; //XmlDocument xmldoc = new XmlDocument (); //xmldoc.LoadXml ( data.text ); Debug.Log(path); Debug.Log(data.text); TextReader sr = new StringReader(data.text); XmlSerializer serial = new XmlSerializer(typeof(FileUtils.FileList)); FileUtils.FileList list = (FileUtils.FileList)serial.Deserialize(sr); foreach (string f in list.files) { list.loaded.Add(toChar(loadTileGroup(folder, f))); } return(list); }
// Use this for initialization void Awake() { FileUtils.FileList block = new FileUtils.FileList(); block = loadFileList("LevelGeneration/"); for (int x = 0; x < tileGroupsNumber; ++x) { List <char> layout; if (genStyle == GenerationStyle.Random) { layout = block.getOneRandom(); } else //if(genStyle == GenerationStyle.InOrder) { layout = block.getNextOne(); } int xStart = (int)(bottomLeftXPos + x * tileWidth * xTilePerSection); createSection(layout, xStart, (int)bottomLeftYPos); } }