Exemplo n.º 1
0
 private void OnEnable()
 {
     mPathFile      = AssetDatabase.GetAssetPath(target);
     mIsValidFolder = (!string.IsNullOrEmpty(mPathFile) && AssetDatabase.IsValidFolder(mPathFile) && mPathFile.Contains(APATH));
     mIsModify      = false;
     if (mIsValidFolder)
     {
         mGui          = new GUIStyle();
         mIsHeadFolder = mPathFile.Contains(ResConfig.ASSETBUNDLE + "/");
         mPackType     = PackFileConfig.GetPackType(mPathFile);
         if (mPackType == null)
         {
             mPackType      = new PackFileConfig.FileParam();
             mPackType.type = 0;
         }
         mSetting = (PackFileSettingType)FSettingEdior.GetSettingInt(PACKFILEEDITOR);
         if (mSetting == PackFileSettingType.SET_NONE)
         {
             mIsValidFolder = false;
         }
         else if (mSetting == PackFileSettingType.SET_Modify)
         {
             mIsModify = true;
         }
     }
 }
Exemplo n.º 2
0
    static void ProjectFileIcon()
    {
        if ((PackFileSettingType)FSettingEdior.GetSettingInt(PACKFILEEDITOR) != PackFileSettingType.SET_NONE)
        {
            //文件夹变名字
            EditorApplication.projectWindowItemOnGUI += (string guid, Rect selectionRect) =>
            {
                if (Application.isPlaying)
                {
                    return;
                }
                if (selectionRect.height < 20)
                {
                    var path = AssetDatabase.GUIDToAssetPath(guid);
                    if (!AssetDatabase.IsValidFolder(path))
                    {
                        return;
                    }

                    if (path.IndexOf(APATH) != -1)
                    {
                        int imageType = 0;
                        if (mTextureTypes.ContainsKey(path))
                        {
                            imageType = mTextureTypes[path];
                        }
                        else
                        {
                            PackFileConfig.FileParam param = PackFileConfig.GetPackType(path);
                            int cType = 0;
                            if (param != null)
                            {
                                cType = param.type;
                            }

                            if (!mShowIcon.TryGetValue(cType, out imageType))
                            {
                                if (IsHaveSameWinType(cType, (int)FPackageEditor.PackType.nb))
                                {
                                    imageType = mShowIcon[(int)FPackageEditor.PackType.nb];
                                }
                                else
                                {
                                    if (IsHaveSameWinType(cType, (int)FPackageEditor.PackType.micro))
                                    {
                                        imageType = mShowIcon[(int)FPackageEditor.PackType.micro];
                                    }
                                    else
                                    {
                                        imageType = 9;
                                    }
                                }
                            }
                            mTextureTypes[path] = imageType;
                        }
                        selectionRect.width = selectionRect.height;
                        GUI.DrawTexture(selectionRect, GetDefaultFolderIcon(imageType));
                    }
                    else
                    {
                        if (PackFileConfig.GetHeadType(path) != -1)
                        {
                            selectionRect.width = selectionRect.height;
                            GUI.DrawTexture(selectionRect, GetDefaultFolderIcon(8));
                        }
                    }
                }
            };
        }
    }