Ejemplo n.º 1
0
        public void OnGUI()
        {
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            GUILayoutHelper.DrawHeader("Texture Folders");
            settings.TextureFolders = drawFoldersGUI(settings.TextureFolders);

            GUILayoutHelper.DrawHeader("Model Folders");
            settings.ModelFolders = drawFoldersGUI(settings.ModelFolders);

            GUILayoutHelper.DrawHeader("Audio Folders");
            settings.AudioFolders = drawFoldersGUI(settings.AudioFolders);

            EditorGUILayout.EndScrollView();

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Save"))
            {
                if (File.Exists(ImportPreferences.settingPath))
                {
                    EditorUtility.SetDirty(settings);
                }
                else
                {
                    AssetDatabase.CreateAsset(settings, ImportPreferences.settingPath);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 被依赖的Bundle
        /// </summary>
        private void drawBeDepdencieBundle()
        {
            float width = ABMainChecker.MainChecker.Width * 0.5f - 10;

            GUILayout.BeginVertical(GUILayout.Width(width));
            GUILayoutHelper.DrawHeader("被其它AssetBundle依赖");
            beDepScrollPos = GUILayout.BeginScrollView(beDepScrollPos);

            int indexRow = 0;

            foreach (EditorBundleBean bundle in curBundle.GetBedependencies())
            {
                indexRow++;
                GUI.backgroundColor = indexRow % 2 == 0 ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                GUI.backgroundColor = Color.white;

                //Name
                GUILayout.Label(bundle.BundleName);

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();
            GUILayout.EndVertical();
        }
Ejemplo n.º 3
0
        private void drawAllAssetBundle()
        {
            //all assets
            GUILayoutHelper.DrawHeader("All AssetBundle");
            //Search
            GUILayout.BeginHorizontal();
            {
                searchFilter = EditorGUILayout.TextField("", searchFilter, "SearchTextField", GUILayout.Width(Screen.width - 20f));

                if (GUILayout.Button("", "SearchCancelButton", GUILayout.Width(18f)))
                {
                    searchFilter = "";
                    GUIUtility.keyboardControl = 0;
                }
            }
            GUILayout.EndHorizontal();

            if (bundleArr == null)
            {
                var bundleDic = ABMainChecker.MainChecker.BundleList;
                bundleArr = new EditorBundleBean[bundleDic.Count];
                bundleDic.Values.CopyTo(bundleArr, 0);

                Array.Sort(bundleArr);
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Toggle(false, "AssetBundle 名称", "ButtonLeft", GUILayout.Width(200)))
            {
                Array.Sort(bundleArr);
            }
            if (GUILayout.Toggle(false, "依赖数量", "ButtonMid", GUILayout.Width(80)))
            {
                sortCount *= -1;
                Array.Sort(bundleArr, (x, y) => x.GetAllDependencies().Count > y.GetAllDependencies().Count ? sortCount : sortCount * -1);
            }
            if (GUILayout.Toggle(false, "文件大小", "ButtonMid", GUILayout.Width(80)))
            {
                sortFileSize *= -1;
                Array.Sort(bundleArr, (x, y) => x.FileSize > y.FileSize ? sortFileSize : sortFileSize * -1);
            }
            GUILayout.Toggle(false, "具体依赖文件", "ButtonMid");
            GUILayout.Toggle(false, "详细", "ButtonRight", GUILayout.Width(80));
            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos);
            indexRow  = 0;

            foreach (EditorBundleBean bundle in bundleArr)
            {
                if (string.IsNullOrEmpty(searchFilter) || bundle.BundleName.Contains(searchFilter))
                {
                    drawRowBundle(bundle);
                }
            }
            GUILayout.EndScrollView();
        }
Ejemplo n.º 4
0
        public void OnGUI()
        {
            GUI.color = Color.yellow;
            GUILayout.Label(tipStr);
            GUI.color = Color.white;

            drawTitle();

            GUILayoutHelper.DrawHeader("详情");

            if (lastTabIndex != curTabIndex)
            {
                lastTabIndex = curTabIndex;
                searchFilter = "";
                GUIUtility.keyboardControl = 0;
            }
            //Search
            GUILayout.BeginHorizontal();
            {
                searchFilter = EditorGUILayout.TextField("", searchFilter, "SearchTextField", GUILayout.Width(Screen.width - 20f));

                if (GUILayout.Button("", "SearchCancelButton", GUILayout.Width(18f)))
                {
                    searchFilter = "";
                    GUIUtility.keyboardControl = 0;
                }
            }
            GUILayout.EndHorizontal();

            if (curTabIndex == 0)
            {
                drawAllAssets();
            }
            else if (curTabIndex == 1)
            {
                drawTextureAssets();
            }
            else if (curTabIndex == 2)
            {
                drawMaterialAssets();
            }
            else if (curTabIndex == 3)
            {
                drawMeshAssets();
            }
            else if (curTabIndex == 4)
            {
                drawShaderAssets();
            }
        }
Ejemplo n.º 5
0
        private void drawDependencieAsset()
        {
            GUILayoutHelper.DrawHeader("Dependencies");

            int column      = 3;
            int columnWidth = Mathf.Max(1, (int)(ABMainChecker.MainChecker.Width - 30) / column);

            GUILayout.BeginVertical();
            int    endIndex   = 0;
            string missingStr = "{0}(missing)";
            int    i          = 0;

            foreach (ResoucresBean depRes in curRes.Dependencies.Values)
            {
                if (i % column == 0)
                {
                    endIndex = i + column - 1;
                    GUILayout.BeginHorizontal();
                }

                if (depRes.IsMissing)
                {
                    GUI.backgroundColor = Color.red;
                    GUILayout.Button(string.Format(missingStr, depRes.Name), GUILayout.Width(columnWidth));
                    GUI.backgroundColor = Color.white;
                }
                else
                {
                    if (GUILayout.Button(depRes.Name, GUILayout.Width(columnWidth)))
                    {
                        ABMainChecker.MainChecker.AssetView.SetResoucre(depRes);
                    }
                }

                GUILayout.Space(5);

                if (i == endIndex)
                {
                    endIndex = 0;
                    GUILayout.EndHorizontal();
                }
                i++;
            }
            if (endIndex != 0)
            {
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
Ejemplo n.º 6
0
        public void OnGUI()
        {
            GUILayoutHelper.DrawHeader("检测AssetBundle");
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Asset Bundles", "DropDown", GUILayout.Width(120)))
            {
                string path = EditorUtility.OpenFolderPanel("Select", CurFolderRoot, "");
                CurFolderRoot = path;
                curFolder     = path;
            }

            if (curFolder.StartsWith(Application.dataPath))
            {
                curFolder = curFolder.Replace(Application.dataPath, "Assets");
            }
            GUILayout.TextField(curFolder);

            GUILayout.Space(10);
            GUILayout.EndHorizontal();

            GUI.backgroundColor = Color.green;
            if (GUILayout.Button("Go Check", GUILayout.Height(25)))
            {
                bundleArr = null;
                this.FindAllBundles();
            }
            GUI.backgroundColor = Color.white;

            //Overview
            GUILayoutHelper.DrawSeparator();
            drawOverview();

            switch (curView)
            {
            case EView.ALLAsset:
                drawAllAssetBundle();
                break;

            case EView.RedundancyAssets:
                drawAllRedundancyAsset();
                break;

            case EView.MissingAsset:
                drawMissingAsset();
                break;
            }
        }
Ejemplo n.º 7
0
        private void drawMissingAsset()
        {
            //all assets
            GUILayoutHelper.DrawHeader("All Missing AssetBundle");

            List <ResoucresBean> missingResList = ABMainChecker.MainChecker.MissingRes;

            GUILayout.BeginHorizontal();
            if (GUILayout.Toggle(false, "Asset 名称", "ButtonLeft", GUILayout.Width(200)))
            {
                missingResList.Sort((x, y) => (new CaseInsensitiveComparer()).Compare(x.Name, y.Name));
            }
            if (GUILayout.Toggle(false, "类型", "ButtonMid", GUILayout.Width(100)))
            {
                missingResList.Sort((x, y) => (new CaseInsensitiveComparer()).Compare(x.ResourceType, y.ResourceType));
            }
            GUILayout.Toggle(false, "路径", "ButtonRight");
            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos);
            indexRow  = 0;

            foreach (ResoucresBean res in missingResList)
            {
                indexRow++;
                GUI.backgroundColor = indexRow % 2 == 0 ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                GUI.backgroundColor = Color.white;

                bool isCheck = false;
                //名称
                GUI.color = selectAsset == res.Name ? Color.green : Color.white;
                isCheck   = GUILayout.Button(res.Name, EditorStyles.label, GUILayout.Width(200));
                //type
                GUILayout.Label(res.ResourceType, GUILayout.Width(100));
                //Path
                isCheck   = (GUILayout.Button(res.AssetPath, EditorStyles.label) ? true : isCheck);
                GUI.color = Color.white;
                if (isCheck)
                {
                    selectAsset            = res.Name;
                    Selection.activeObject = AssetDatabase.LoadAssetAtPath <Object>(res.AssetPath);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 冗余的资源
        /// </summary>
        private void drawAllRedundancyAsset()
        {
            //all assets
            GUILayoutHelper.DrawHeader("All Redundancy AssetBundle");


            GUILayout.BeginHorizontal();
            if (GUILayout.Toggle(false, "AssetBundle 名称", "ButtonLeft", GUILayout.MinWidth(300)))
            {
                sortToggle *= -1;
                redundancyList.Sort((x, y) => (new CaseInsensitiveComparer()).Compare(x.BundleName, y.BundleName) * sortToggle);
            }
            if (GUILayout.Toggle(false, "Mesh", "ButtonMid", GUILayout.MinWidth(100)))
            {
                sortToggle *= -1;
                redundancyList.Sort((x, y) => comparerAssetCount(x, y, EResoucresTypes.MeshType));
            }
            if (GUILayout.Toggle(false, "Material", "ButtonMid", GUILayout.MinWidth(100)))
            {
                sortToggle *= -1;
                redundancyList.Sort((x, y) => comparerAssetCount(x, y, EResoucresTypes.MatrialType));
            }
            if (GUILayout.Toggle(false, "Texture", "ButtonMid", GUILayout.MinWidth(100)))
            {
                sortToggle *= -1;
                redundancyList.Sort((x, y) => comparerAssetCount(x, y, EResoucresTypes.TextureType));
            }
            if (GUILayout.Toggle(false, "Shader", "ButtonMid", GUILayout.MinWidth(100)))
            {
                sortToggle *= -1;
                redundancyList.Sort((x, y) => comparerAssetCount(x, y, EResoucresTypes.ShaderType));
            }
            GUILayout.Toggle(false, "详细", "ButtonRight", GUILayout.Width(100));
            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos);
            indexRow  = 0;

            foreach (EditorBundleBean bundle in redundancyList)
            {
                if (string.IsNullOrEmpty(searchFilter) || bundle.BundleName.Contains(searchFilter))
                {
                    drawRowRedundancyAsset(bundle);
                }
            }
            GUILayout.EndScrollView();
        }
Ejemplo n.º 9
0
        public virtual void OnGUI()
        {
            EditorGUILayout.BeginHorizontal();

            Rect windowRect = AssetImporterWindow.Instance.position;

            EditorGUILayout.BeginVertical(GUILayout.Width(windowRect.width * 0.5f), GUILayout.ExpandHeight(true));
            GUILayoutHelper.DrawHeader(typeof(T).Name);
            //            dirScrollPos = GUILayout.BeginScrollView(dirScrollPos);
            //            this.OnFolderGUI();
            //            GUILayout.EndScrollView();
            this.folderTree.OnGUI(multiColumnTreeViewRect(ref windowRect));
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            onParamsGUI();
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 10
0
        private void OnGUI()
        {
            GUILayoutHelper.DrawHeader("Import");

            this.importFoldersGUI();

            GUILayoutHelper.DrawHeader("Option");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("翻译:", GUILayout.Width(80));

            targetLanguage = (Language)EditorGUILayout.EnumPopup("", targetLanguage);

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Export")) //, GUILayout.Width(80)
            {
                this.exportSourcesLanguage();
            }

            if (GUILayout.Button("Export + Online")) //, GUILayout.Width(80)
            {
                this.exportSourcesAndOnlineLanguage();
            }
            //            GUILayoutHelper.DrawHeader("Translater");

            EditorGUILayout.EndHorizontal();

            GUI.backgroundColor = Color.green;
            if (GUILayout.Button("Translater", GUILayout.Height(30)))
            {
                this.onTranlateAssets();
            }
            GUI.backgroundColor = Color.white;
            GUILayout.Space(10);
        }
Ejemplo n.º 11
0
        public void OnGUI()
        {
            if (settings == null)
            {
                this.Initizalize();
            }

            GUILayoutHelper.DrawHeader("模型规范设置");
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("清空", GUILayout.Width(80)))
                {
                    if (File.Exists(OverviewSetting.LocalParticleFilePath))
                    {
                        File.Delete(OverviewSetting.LocalParticleFilePath);
                    }
                    OverviewSetting.LocalParticleFilePath = "";
                }

                if (GUILayout.Button("加载", GUILayout.Width(80)))
                {
                    string filePath = EditorUtility.OpenFilePanel("打开", Application.dataPath, "xml");
                    OverviewSetting.LocalParticleFilePath = filePath.Replace(Application.dataPath, "Assets");
                    OverviewSetting.Instance.ReadParticelEffectSettings();
                    this.Initizalize();
                }
                GUILayout.Space(10);
            }

            GUILayout.Space(5);
            GUILayoutHelper.DrawSeparator();
            if (settings != null)
            {
                scrollPos = GUILayout.BeginScrollView(scrollPos);
                for (int i = 0; i < settings.Count; i++)
                {
                    GUILayout.Space(5);
                    drawSetting(settings[i]);
                    GUILayoutHelper.DrawSeparator();
                }

                if (removeSettings.Count > 0)
                {
                    for (int i = 0; i < removeSettings.Count; i++)
                    {
                        settings.Remove(removeSettings[i]);
                    }
                    removeSettings.Clear();
                }
                GUILayout.EndScrollView();
            }

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("保存"))
            {
                if (string.IsNullOrEmpty(OverviewSetting.LocalParticleFilePath))
                {
                    string filePath = EditorUtility.SaveFilePanel("保存", Application.dataPath, "new file", "xml");
                    OverviewSetting.LocalParticleFilePath = filePath.Replace(Application.dataPath, "Assets");
                }
                this.saveSettingRule(OverviewSetting.LocalParticleFilePath);
                AssetDatabase.Refresh();
                Debug.Log("Save Success !");
            }
            GUILayout.Space(10);
            if (GUILayout.Button("添加规则"))
            {
                ParticleEffectSettingBean msb = new ParticleEffectSettingBean();
                msb.Folder.Add(string.Empty);
                settings.Add(msb);
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 12
0
        private void drawOverviewGUI()
        {
            GUILayoutHelper.DrawHeader("文件详情");
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Label("筛选:");
                selectAssetType = EditorGUILayout.Popup(selectAssetType, AssetAllTypes);

                GUILayout.FlexibleSpace();
                if (GUILayout.Button("刷新", GUILayout.Width(80)))
                {
                    findModels();
                }
                GUILayout.Space(10);
            }
            GUILayout.Space(5);

            GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
            if (GUILayout.Toggle(false, "模型名称", "ButtonLeft", GUILayout.MaxWidth(200f)))
            {
                sortName *= -1;
                modelList.Sort((x, y) => x.Name.CompareTo(y.Name) * sortName);
            }
            GUILayout.Toggle(false, "资源类型", "ButtonMid", GUILayout.MinWidth(100F));
            GUILayout.Toggle(false, "顶点数", "ButtonMid", GUILayout.MinWidth(80f));
            if (GUILayout.Toggle(false, "三角面数", "ButtonMid", GUILayout.MinWidth(80f)))
            {
                sortTriangle *= -1;
                modelList.Sort((x, y) => x.TriangleCount.CompareTo(y.TriangleCount) * sortTriangle);
            }
            if (GUILayout.Toggle(false, "骨骼数", "ButtonMid", GUILayout.MinWidth(50f)))
            {
                sortBond *= -1;
                modelList.Sort((x, y) => x.BondCount.CompareTo(y.BondCount) * sortBond);
            }
            //            GUILayout.Label("贴图名称", GUILayout.Width(150F));
            GUILayout.Toggle(false, "贴图尺寸", "ButtonMid", GUILayout.MinWidth(100F));
            if (GUILayout.Toggle(false, "综合评分", "ButtonRight", GUILayout.MinWidth(100F)))
            {
                sortScore *= -1;
                modelList.Sort((x, y) => x.Score.CompareTo(y.Score) * sortScore);
            }
            GUILayout.Space(10);
            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos);
            int index = 0;

            for (int i = 0; i < modelList.Count; i++)
            {
                if (selectAssetType != 0 && !modelList[i].AssetDesc.Equals(AssetAllTypes[selectAssetType]))
                {
                    continue;
                }

                GUI.backgroundColor = index % 2 == 1 ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                GUI.backgroundColor = Color.white;

                drawRow(modelList[i]);

                GUILayout.EndHorizontal();
                index++;
            }
            GUILayout.EndScrollView();
        }
Ejemplo n.º 13
0
        public void drawOverviewGUI()
        {
            GUILayoutHelper.DrawHeader("文件详情");
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Label("筛选:");
                selectAssetType = EditorGUILayout.Popup(selectAssetType, AssetAllTypes);

                GUILayout.FlexibleSpace();
                if (GUILayout.Button("关闭MipMaps", GUILayout.Width(100F)))
                {
                    List <TextureBean> _textures = new List <TextureBean>();
                    for (int i = 0; i < assetList.Count; i++)
                    {
                        if (selectAssetType != 0 && !assetList[i].AssetDesc.Equals(AssetAllTypes[selectAssetType]))
                        {
                            continue;
                        }
                        if (!assetList[i].MipMaps)
                        {
                            continue;
                        }
                        _textures.Add(assetList[i]);
                    }

                    for (int i = 0; i < _textures.Count; i++)
                    {
                        EditorUtility.DisplayProgressBar("Hold On", "正在自动处理...", i / (float)_textures.Count);
                        TextureImporter texImp = AssetImporter.GetAtPath(_textures[i].FilePath) as TextureImporter;
                        texImp.mipmapEnabled = false;
                        _textures[i].MipMaps = false;
                    }
                    EditorUtility.ClearProgressBar();
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();
                }

                if (GUILayout.Button("刷新", GUILayout.Width(80)))
                {
                    findAllTextures();
                }
                GUILayout.Space(10);
            }
            GUILayout.Space(5);

            GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
            if (GUILayout.Toggle(false, "名称", "ButtonLeft", GUILayout.MaxWidth(200f)))
            {
                sortName *= -1;
                assetList.Sort((x, y) => x.Name.CompareTo(y.Name) * sortName);
            }
            GUILayout.Toggle(false, "资源类型", "ButtonMid", GUILayout.MinWidth(100F));
            if (GUILayout.Toggle(false, "宽度", "ButtonMid", GUILayout.MinWidth(80f)))
            {
                sortWidth *= -1;
                assetList.Sort((x, y) => x.Width.CompareTo(y.Width) * sortWidth);
            }
            if (GUILayout.Toggle(false, "高度", "ButtonMid", GUILayout.MinWidth(80f)))
            {
                sortHeight *= -1;
                assetList.Sort((x, y) => x.Height.CompareTo(y.Height) * sortHeight);
            }
            GUILayout.Toggle(false, "MipMaps", "ButtonMid", GUILayout.MinWidth(100f));
            if (GUILayout.Toggle(false, "MaxSize", "ButtonMid", GUILayout.MinWidth(80F)))
            {
                sortMaxSize *= -1;
                assetList.Sort((x, y) => x.MaxSize.CompareTo(y.MaxSize) * sortMaxSize);
            }
            GUILayout.Toggle(false, "压缩格式", "ButtonMid", GUILayout.MinWidth(100F));
            if (GUILayout.Toggle(false, "内存消耗", "ButtonRight", GUILayout.MinWidth(100F)))
            {
                sortMemorySize *= -1;
                assetList.Sort((x, y) => x.MemorySize.CompareTo(y.MemorySize) * sortMemorySize);
            }
            GUILayout.Space(10);
            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos);
            int index = 0;

            for (int i = 0; i < assetList.Count; i++)
            {
                if (selectAssetType != 0 && !assetList[i].AssetDesc.Equals(AssetAllTypes[selectAssetType]))
                {
                    continue;
                }

                GUI.backgroundColor = index % 2 == 1 ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                GUI.backgroundColor = Color.white;

                drawRow(index, assetList[i]);

                GUILayout.EndHorizontal();
                index++;
            }
            GUILayout.EndScrollView();
        }
Ejemplo n.º 14
0
        public void drawOverviewGUI()
        {
            GUILayoutHelper.DrawHeader("文件详情");
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Label("筛选:");
                selectAssetType = EditorGUILayout.Popup(selectAssetType, AssetAllTypes);

                GUILayout.FlexibleSpace();
                if (GUILayout.Button("刷新", GUILayout.Width(80)))
                {
                    findAllParticleEffects();
                }
                GUILayout.Space(10);
            }
            GUILayout.Space(5);

            GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
            if (GUILayout.Toggle(false, "名称", "ButtonLeft", GUILayout.MaxWidth(200f)))
            {
                sortName *= -1;
                assetList.Sort((x, y) => x.Name.CompareTo(y.Name) * sortName);
            }
            GUILayout.Toggle(false, "资源类型", "ButtonMid", GUILayout.MinWidth(100F));
            if (GUILayout.Toggle(false, "DrawCall数", "ButtonMid", GUILayout.MinWidth(100f)))
            {
                sortDc *= -1;
                assetList.Sort((x, y) => x.DrawCallCount.CompareTo(y.DrawCallCount) * sortDc);
            }
            if (GUILayout.Toggle(false, "贴图数", "ButtonMid", GUILayout.MinWidth(80f)))
            {
                sortTexture *= -1;
                assetList.Sort((x, y) => x.TextureCount.CompareTo(y.TextureCount) * sortTexture);
            }
            if (GUILayout.Toggle(false, "粒子总数", "ButtonMid", GUILayout.MinWidth(100f)))
            {
                sortParticles *= -1;
                assetList.Sort((x, y) => x.ParticelCount.CompareTo(y.ParticelCount) * sortParticles);
            }
            if (GUILayout.Toggle(false, "综合评分", "ButtonRight", GUILayout.MinWidth(100F)))
            {
                sortScore *= -1;
                assetList.Sort((x, y) => x.Score.CompareTo(y.Score) * sortParticles);
            }
            GUILayout.Space(10);
            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos);
            int index = 0;

            for (int i = 0; i < assetList.Count; i++)
            {
                if (selectAssetType != 0 && !assetList[i].AssetDesc.Equals(AssetAllTypes[selectAssetType]))
                {
                    continue;
                }

                GUI.backgroundColor = index % 2 == 1 ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                GUI.backgroundColor = Color.white;

                drawRow(assetList[i]);

                GUILayout.EndHorizontal();
                index++;
            }
            GUILayout.EndScrollView();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 冗余的资源
        /// </summary>
        private void drawAllBundles()
        {
            EditorGUILayout.HelpBox(tipStr, MessageType.Info);
            //all assets
            GUILayoutHelper.DrawHeader("All AssetBundle");

            //Search
            GUILayout.BeginHorizontal();
            {
                searchFilter = EditorGUILayout.TextField("", searchFilter, "SearchTextField", GUILayout.Width(Screen.width - 20f));

                if (GUILayout.Button("", "SearchCancelButton", GUILayout.Width(18f)))
                {
                    searchFilter = "";
                    GUIUtility.keyboardControl = 0;
                }
            }
            GUILayout.EndHorizontal();

//            GUILayout.BeginHorizontal();
//            GUILayout.Toggle(false, "所属AssetBundle名称", "ButtonLeft");
//            //GUILayout.Toggle(false, "依赖数量", "ButtonMid", GUILayout.Width(80));
//            //GUILayout.Toggle(false, "所属AssetBundle文件", "ButtonMid");
//            GUILayout.Toggle(false, "详细", "ButtonRight", GUILayout.Width(100));
//            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos, false, true);


            GUILayout.BeginVertical();
            int countIndex = 0;
            int endIndex   = 0;
            int column     = 4;
            int width      = (int)(ABMainChecker.MainChecker.Width - 50) / column;

            for (int i = 0, maxCount = curRes.IncludeBundles.Count; i < maxCount; i++)
            {
                EditorBundleBean bundle = curRes.IncludeBundles[i];

                if (countIndex % column == 0)
                {
                    endIndex = countIndex + column - 1;
                    GUILayout.BeginHorizontal();
                }

                if (GUILayout.Button(bundle.BundleName, GUILayout.Width(width)))
                {
                    ABMainChecker.MainChecker.DetailBundleView.SetCurrentBundle(bundle);
                }

                if (countIndex == endIndex)
                {
                    endIndex = 0;
                    GUILayout.EndHorizontal();
                }
                countIndex++;
            }
            if (endIndex != 0)
            {
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();

//            foreach (EditorBundleBean bundle in curRes.IncludeBundles)
//            {
//                if(string.IsNullOrEmpty(searchFilter) || bundle.BundleName.Contains(searchFilter))
//                    drawBundle(bundle);
//            }
            GUILayout.EndScrollView();
        }