示例#1
0
        private void DrawConfigList(Rect configListRect)
        {
            GUILayout.BeginArea(configListRect);
            {
                EditorGUILayout.LabelField("Flyer Data List", boldCenterStyle, GUILayout.Width(configListRect.width));

                m_ScrollListPos = EditorGUILayout.BeginScrollView(m_ScrollListPos, false, true, GUILayout.Width(configListRect.width));
                {
                    foreach (var kvp in m_DataDic)
                    {
                        if (!string.IsNullOrEmpty(m_SelectedDataFullPath) && kvp.Key == m_SelectedDataFullPath)
                        {
                            EditorGUIUtil.BeginGUIBackgroundColor(Color.cyan);
                            {
                                if (GUILayout.Button(Path.GetFileNameWithoutExtension(kvp.Key)))
                                {
                                    SelectedDataFullPath = kvp.Key;
                                }
                            }
                            EditorGUIUtil.EndGUIBackgroundColor();
                        }
                        else
                        {
                            if (GUILayout.Button(Path.GetFileNameWithoutExtension(kvp.Key)))
                            {
                                SelectedDataFullPath = kvp.Key;
                            }
                        }
                    }
                }
                EditorGUILayout.EndScrollView();
            }
            GUILayout.EndArea();
        }
示例#2
0
        /// <summary>
        /// 绘制当前使用的BundleNode的信息
        /// </summary>
        private void DrawBundleNodes()
        {
            foreach (var node in m_BundleNodes)
            {
                string bundlePath = node.AsDynamic().m_BundlePath;
                if (!m_BundleNodeFoldoutDic.TryGetValue(bundlePath, out bool isFoldout))
                {
                    isFoldout = false;
                    m_BundleNodeFoldoutDic.Add(bundlePath, isFoldout);
                }

                bool isDone = node.AsDynamic().IsDone;
                if (!isDone)
                {
                    bundlePath += "(Loading)";
                }

                m_BundleNodeFoldoutDic[bundlePath] = EditorGUILayout.Foldout(isFoldout, bundlePath);
                if (isFoldout)
                {
                    EditorGUIUtil.BeginGUIBackgroundColor(m_NodeBGColor);
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUIUtil.BeginIndent();
                            {
                                EditorGUILayout.LabelField("Bundle Node:");
                                EditorGUIUtil.BeginIndent();
                                {
                                    DrawBundleNode(node);
                                }
                                EditorGUIUtil.EndIndent();

                                if (m_IsShowBundleNodeDirect)
                                {
                                    EditorGUILayout.LabelField("Direct Bundle:");
                                    string[] depends = m_AssetBundleManifest.GetDirectDependencies(bundlePath);
                                    EditorGUIUtil.BeginIndent();
                                    {
                                        foreach (var depend in depends)
                                        {
                                            BundleNode dependNode = m_BundleNodeDic[depend];
                                            DrawBundleNode(dependNode);
                                            EditorGUILayout.Space();
                                        }
                                    }
                                    EditorGUIUtil.EndIndent();
                                }
                            }
                            EditorGUIUtil.EndIndent();
                        }
                        EditorGUILayout.EndVertical();
                    }
                    EditorGUIUtil.EndGUIBackgroundColor();
                }
            }
        }
示例#3
0
        /// <summary>
        /// 绘制AssetNode的详细信息
        /// </summary>
        /// <param name="assetNode">AssetNode数据</param>
        /// <param name="showMainBundle">是否显示其所在的Bundle</param>
        /// <param name="showDependBundle">是否显示依赖的Bundle</param>
        private void DrawAssetNode(AssetNode assetNode, bool showMainBundle = false, bool showDependBundle = false)
        {
            dynamic assetNodeDynamic        = assetNode.AsDynamic();
            string  assetPath               = assetNodeDynamic.m_AssetPath;
            bool    isDone                  = assetNodeDynamic.IsDone;
            bool    isAlive                 = assetNodeDynamic.IsAlive();
            int     loadCount               = assetNodeDynamic.m_LoadCount;
            List <WeakReference> weakAssets = assetNodeDynamic.m_WeakAssets;

            EditorGUIUtil.BeginGUIBackgroundColor(m_NodeBGColor);
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUIUtil.BeginGUIColor(Color.white);
                    {
                        EditorGUIUtil.BeginIndent();
                        {
                            EditorGUILayout.LabelField("Asset Node:");
                            EditorGUIUtil.BeginIndent();
                            {
                                EditorGUILayout.LabelField($"Asset Path:{assetPath}{(isDone?"":"  (Loading)")}");
                                EditorGUILayout.LabelField($"Is Alive:{isAlive}");
                                EditorGUILayout.LabelField($"Load Count:{loadCount}");
                                if (weakAssets.Count > 0)
                                {
                                    EditorGUILayout.LabelField("Weak Ref:");
                                    EditorGUIUtil.BeginIndent();
                                    {
                                        foreach (var weakRef in weakAssets)
                                        {
                                            if (!UnityObjectExtension.IsNull(weakRef.Target))
                                            {
                                                UnityObject uObj = weakRef.Target as UnityObject;
                                                EditorGUILayout.LabelField($"Name:{uObj.name}");
                                            }
                                        }
                                    }
                                    EditorGUIUtil.EndIndent();
                                }
                            }
                            EditorGUIUtil.EndIndent();

                            if (showMainBundle || showDependBundle)
                            {
                                BundleNode mainBundleNode = assetNodeDynamic.m_BundleNode;
                                string     mainBundlePath = mainBundleNode.AsDynamic().m_BundlePath;
                                EditorGUILayout.LabelField("Bundle Node:");
                                EditorGUIUtil.BeginIndent();
                                {
                                    if (showMainBundle)
                                    {
                                        EditorGUILayout.LabelField("Main Bundle:");
                                        EditorGUIUtil.BeginIndent();
                                        {
                                            DrawBundleNode(mainBundleNode);
                                        }
                                        EditorGUIUtil.EndIndent();
                                    }
                                    if (showDependBundle)
                                    {
                                        EditorGUILayout.LabelField("Depend Bundle:");
                                        string[] depends = m_AssetBundleManifest.GetAllDependencies(mainBundlePath);
                                        EditorGUIUtil.BeginIndent();
                                        {
                                            foreach (var depend in depends)
                                            {
                                                BundleNode dependNode = m_BundleNodeDic[depend];
                                                DrawBundleNode(dependNode);
                                                EditorGUILayout.Space();
                                            }
                                        }
                                        EditorGUIUtil.EndIndent();
                                    }
                                }
                                EditorGUIUtil.EndIndent();
                            }
                        }
                        EditorGUIUtil.EndIndent();
                    }
                    EditorGUIUtil.EndGUIColor();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUIUtil.EndGUIBackgroundColor();
        }
示例#4
0
        private void DrawOperation()
        {
            if (GUILayout.Button("Update Asset Group"))
            {
                BundlePackUtil.UpdateTagConfig();

                m_TagConfig = Util.FileUtil.ReadFromBinary <AssetBundleTagConfig>(BundlePackUtil.GetTagConfigPath());
                FilterTreeModel();
            }
            if (GUILayout.Button("Update Address Config"))
            {
                BundlePackUtil.UpdateAddressConfig();
            }
            if (GUILayout.Button("Create Key Class"))
            {
                BundlePackUtil.CreateAddressKeyClass();
            }
            if (GUILayout.Button("Clear Asset Bundle Names"))
            {
                BundlePackUtil.ClearAssetBundleNames(true);
            }
            if (GUILayout.Button("Set Asset Bundle Names"))
            {
                BundlePackUtil.SetAssetBundleNames(true);
            }

            GUILayout.FlexibleSpace();

            EditorGUIUtil.BeginGUIBackgroundColor(Color.red);
            {
                if (GUILayout.Button("Pack Without Depends", GUILayout.Height(30)))
                {
                    EditorApplication.delayCall += () =>
                    {
                        BundlePackUtil.PackBundleSetting packBundleSetting = new BundlePackUtil.PackBundleSetting();
                        packBundleSetting.FindDepend        = false;
                        packBundleSetting.IsShowProgressBar = true;
                        packBundleSetting.ResetBundleName   = true;
                        packBundleSetting.UpdateConfigs     = true;
                        if (BundlePackUtil.PackBundle(out AssetBundleManifest assetBundleManifest, packBundleSetting))
                        {
                            EditorUtility.DisplayDialog("Success", "Pack AssetBundle Success", "OK");
                        }
                    };
                }
                if (GUILayout.Button("Pack With Depends", GUILayout.Height(30)))
                {
                    EditorApplication.delayCall += () =>
                    {
                        BundlePackUtil.PackBundleSetting packBundleSetting = new BundlePackUtil.PackBundleSetting();
                        packBundleSetting.FindDepend        = true;
                        packBundleSetting.IsShowProgressBar = true;
                        packBundleSetting.ResetBundleName   = true;
                        packBundleSetting.UpdateConfigs     = true;
                        if (BundlePackUtil.PackBundle(out AssetBundleManifest assetBundleManifest, packBundleSetting))
                        {
                            EditorUtility.DisplayDialog("Success", "Pack AssetBundle Success", "OK");
                        }
                    };
                }
            }
            EditorGUIUtil.EndGUIBackgroundColor();
        }
    }
}