private void DrawFolder(ABFolderInfo info) { if (info == null) { return; } if (!string.IsNullOrEmpty(info.folderFullPath)) { EditorGUI.indentLevel = info.level; DrawGUIData(info); } if (info.isOpen || info.level <= 0) { if (info.childFolderInfo != null) { for (int i = 0; i < info.childFolderInfo.Length; ++i) { if (info.childFolderInfo[i] == null) { continue; } DrawFolder(info.childFolderInfo[i]); } } } }
public void AddFolder(string absPath) { if (!Directory.Exists(absPath)) { return; } if (m_ChildFolderInfos == null) { m_ChildFolderInfos = new ABFolderInfo[1]; } else { ABFolderInfo[] temp = new ABFolderInfo[m_ChildFolderInfos.Length + 1]; Array.Copy(m_ChildFolderInfos, temp, m_ChildFolderInfos.Length); m_ChildFolderInfos = temp; } m_ChildFolderInfos[m_ChildFolderInfos.Length - 1] = new ABFolderInfo(absPath, m_Level); }
private void Init() { m_ABConfigInfo = new ABConfigInfo(); m_ABConfigInfo.LoadFromEditorConfig("abConfig.xml"); m_ABConfigInfo.RefreshConfig(); m_ABStateInfo = new ABStateInfo(); //m_ABStateInfo.LoadFromFile("abState.xml"); m_RootFolder = new ABFolderInfo(); var list = m_ABConfigInfo.GetRootFolderList(); if (list != null) { for (int i = 0; i < list.Count; ++i) { m_ABStateInfo.AddFolder(list[i].folderAssetsPath, null); m_RootFolder.AddFolder(EditorUtils.AssetsPath2ABSPath(list[i].folderAssetsPath)); } } }
private void Init(ABFolderInfo[] history) { string[] dires = Directory.GetDirectories(m_FolderFullPath); if (dires != null && dires.Length > 0) { m_ChildFolderInfos = new ABFolderInfo[dires.Length]; for (int i = 0; i < m_ChildFolderInfos.Length; ++i) { m_ChildFolderInfos[i] = new ABFolderInfo(dires[i], m_Level); ABFolderInfo old = FindInArray(history, m_ChildFolderInfos [i].folderFullPath); if (old != null) { m_ChildFolderInfos [i] = old; } } } else { m_ChildFolderInfos = null; } }
private void DrawGUIData(ABFolderInfo info) { Rect rt = GUILayoutUtility.GetRect(800, 20, m_Style); rt.x += (16 * EditorGUI.indentLevel); using (var h = new EditorGUILayout.HorizontalScope()) { if (info.childFolderInfo != null) { rt.width = 20; //EditorGUI.DrawRect(rt, Color.white); if (info.isOpen) { if (GUI.Button(rt, m_TrangleDownIcon, m_Style)) { info.isOpen = !info.isOpen; } } else { if (GUI.Button(rt, m_TrangleRightIcon, m_Style)) { info.isOpen = !info.isOpen; } } } rt.x += 20; GUI.Label(rt, m_FolderIcon, m_Style); rt.x += 20; rt.width = 120; m_Style.normal.textColor = Color.white; GUI.Label(rt, info.folderName); ABConfigUnit configUnit = m_Mgr.GetConfigUnit(info.folderFullPath); bool isFolderFlag = true; if (configUnit != null) { isFolderFlag = configUnit.isFolderFlag; } if (configUnit != null) { rt.x += 120; if (configUnit.isFolderFlag) { configUnit.isFolderFlag = GUI.Toggle(rt, configUnit.isFolderFlag, "文件夹模式"); } else { configUnit.isFolderFlag = GUI.Toggle(rt, configUnit.isFolderFlag, "文件模式"); } } ABStateUnit stateUnit = m_Mgr.GetStateUnit(info.folderFullPath); if (stateUnit != null) { rt.x += 120; rt.width = 160; string stateMsg = null; if (ABState2Msg(stateUnit.state, out stateMsg)) { if (isFolderFlag != stateUnit.state.isFolderFlag && !stateUnit.state.isNoneFlag) { m_Style.normal.textColor = Color.red; } else { m_Style.normal.textColor = Color.gray; } stateMsg = string.Format("当前状态:{0}", stateMsg); GUI.Label(rt, stateMsg, m_Style); rt.x += 180; if (GUI.Button(rt, "重置")) { m_Mgr.FixedFolder(stateUnit.folderAssetPath); } } else { m_Style.normal.textColor = Color.red; stateMsg = string.Format("当前状态:{0}", stateMsg); GUI.Label(rt, stateMsg, m_Style); rt.x += 180; if (GUI.Button(rt, "修复")) { m_Mgr.FixedFolder(stateUnit.folderAssetPath); } } rt.x += 180; if (GUI.Button(rt, "构建AB")) { AssetBundleExporter.BuildAssetBundlesInSelectFolder(stateUnit.folderAssetPath); } } } }