private static FireFxRoot GetFireSetting(Object t) { TreeWrap.Init(); string path = AssetDatabase.GetAssetPath(t); XDocument doc = XDocument.Load(path); XElement root = doc.Root; string canvasType = StringDataTools.XAttribute(root, "type"); TreeCanvas canvas = TreeEditorFactory.GetCanvas(canvasType); canvas.Read(root); FireFxRoot r = new FireFxRoot(); new TreeToRuntimeComp(canvas, TreeFactory.CreateInstance, r).Transfer(); return(r); }
public static FireFxRoot GetFireSetting(string path) { if (File.Exists(path)) { TreeEditorFactory.Start(); XDocument doc = XDocument.Load(path); XElement root = doc.Root; string canvasType = StringDataTools.XAttribute(root, "type"); TreeCanvas canvas = TreeEditorFactory.GetCanvas(canvasType); canvas.Read(root); FireFxRoot r = new FireFxRoot(); new TreeToRuntimeComp(canvas, TreeFactory.CreateInstance, r).Transfer(); return(r); } GlobalLogger.LogError(string.Format("{0} is not a valid path", path)); return(null); }