Exemplo n.º 1
0
 private void AddConfigUnit(string fullPath, ABStateUnit unit)
 {
     fullPath = fullPath.Replace("\\", "/");
     if (m_StateMap.ContainsKey(fullPath))
     {
         return;
     }
     m_StateMap.Add(fullPath, unit);
 }
Exemplo n.º 2
0
        public void AddConfig(string folderFullPath, ABState state)
        {
            ABStateUnit unit = null;

            if (!m_StateMap.TryGetValue(folderFullPath, out unit))
            {
                unit = new ABStateUnit();
                AddConfigUnit(folderFullPath, unit);
            }

            unit.folderAssetPath = EditorUtils.ABSPath2AssetsPath(folderFullPath);
            unit.state           = state;
        }
Exemplo n.º 3
0
        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);
                    }
                }
            }
        }