static public void ImportLayout() { string prefab = EditorTool.GetCurrentSelectedAssetPath(); string layout_file = LayoutTool.GetLayoutFullPath(prefab); if (string.IsNullOrEmpty(layout_file)) { return; } if (!File.Exists(layout_file)) { EditorUtility.DisplayDialog("", "\"" + layout_file + "\"不存在,无法导入", "确定"); return; } GameObject layout_obj = LayoutTool.LoadLayout(layout_file); Dictionary <GameObject, string> subPrefabs = LayoutTool.ProcessSubPrefabWhenImport(layout_obj); if (subPrefabs != null) { foreach (KeyValuePair <GameObject, string> kvp in subPrefabs) { ImportLayout(kvp.Key, kvp.Value); Object.DestroyImmediate(kvp.Key); } } ImportLayout(layout_obj, prefab); Object.DestroyImmediate(layout_obj); EditorUtility.DisplayDialog("", "导入成功", "确定"); }
public bool Load(string layout_file) { GameObject root = LayoutTool.LoadLayout(layout_file, true); if (root != null) { Release(); m_root = root; m_dirty = false; m_layout_file = layout_file; m_name = EditorTool.GetFileName(layout_file, false); UpdateHierarchyInfo(m_root, 0); } return(root != null); }