Ejemplo n.º 1
0
    //Load the tree store from a simple file list (not json)
    public static TreeStore LoadTreeStoreFromSimpleManifest(string manifestSimple)
    {
        TreeStore ts          = new TreeStore();
        string    curFileName = "";

        try
        {
            string[] lineArray = manifestSimple.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            foreach (var line in lineArray.ToList <String>())
            {
                string[] treeArray = line.Split(';');
                curFileName = treeArray[0];
                TextAsset treeText = Resources.Load <TextAsset>(treeArray[0]);

                ITree tempTree = SimpleTreeParser.getTreeFromString(treeText.text, (TreeType)Int32.Parse(treeArray[1]), ts.globalFlags);
                tempTree.treeName = treeArray[2];
                ts.treeDictionary.Add(Int32.Parse(treeArray[3]), tempTree);
            }
        }

        catch (Exception ex)
        {
            Debug.Log(curFileName + ex.Message + ex.StackTrace);
            string error = ex.Message + ex.StackTrace;
            return(null);
        }

        //select the first manifest item as current tree index
        ts.currentTreeIndex = ts.treeDictionary.Keys.ToList()[0];

        return(ts);
    }
Ejemplo n.º 2
0
    private void loadTreeStore()
    {
        TextAsset manifestTextAsset = Resources.Load <TextAsset>("Data/SimpleWorld1/manifestSimple");

        this.treeStore = SimpleTreeParser.LoadTreeStoreFromSimpleManifest(manifestTextAsset.text);
    }