Esempio 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;
         }
     }
 }
Esempio n. 2
0
 private static PackFileConfig GetPackFileConfig()
 {
     if (mCofig == null)
     {
         mCofig = new PackFileConfig();
         mCofig.ReadFile();
     }
     return(mCofig);
 }
Esempio n. 3
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));
                        }
                    }
                }
            };
        }
    }
Esempio n. 4
0
    //资源特殊文件显示
    public override void OnInspectorGUI()
    {
        if (mIsValidFolder)
        {
            //assetbundle文件夹
            mGui.fontSize         = 24;
            mGui.normal.textColor = Color.green;
            GUILayout.Label(ResConfig.ASSETBUNDLE + "文件夹", mGui);

            if (mIsHeadFolder)
            {
                GUI.enabled           = mIsModify && (!Application.isPlaying);
                mGui.fontSize         = 16;
                mGui.normal.textColor = Color.green;
                var pmode = Enum.GetValues(typeof(FPackageEditor.PackType));
                foreach (var fp in pmode)
                {
                    FPackageEditor.PackType tempType = (FPackageEditor.PackType)fp;
                    if (tempType != FPackageEditor.PackType.none)
                    {
                        bool isSelect = IsHaveSameWinType(mPackType.type, (int)tempType);
                        bool rSelect  = EditorGUILayout.Toggle("当前模式状态:[" + tempType.ToString() + "]", isSelect);
                        if (mIsModify)
                        {
                            if (rSelect)
                            {
                                mPackType.type |= (int)tempType;
                            }
                            else
                            {
                                mPackType.type &= (~(int)tempType);
                            }
                        }
                        if (isSelect && tempType == FPackageEditor.PackType.micro)
                        {
                            //微端额外配置
                            mPackType.microEx = EditorGUILayout.TextField(mPackType.microEx);
                        }
                    }
                }

                if (mIsModify)
                {
                    if (GUI.changed)
                    {
                        PackFileConfig.SetPackType(mPathFile, mPackType);
                        if (mTextureTypes.ContainsKey(mPathFile))
                        {
                            mTextureTypes.Remove(mPathFile);
                        }
                    }
                }
                GUI.enabled = false;
            }
            else
            {
                mGui.fontSize         = 14;
                mGui.normal.textColor = Color.red;
                GUILayout.Label(ResConfig.ASSETBUNDLE + ":为资源文件夹,放入里面的资源文件将进入打包系统", mGui);
                mGui.normal.textColor = Color.green;
                GUILayout.Label("标签:[" + FPackageEditor.PackType.part + "]:资源分开打包", mGui);
                GUILayout.Label("标签:[" + FPackageEditor.PackType.asy + "]:资源用于异步加载", mGui);
                GUILayout.Label("标签:[" + FPackageEditor.PackType.nb + "]:资源不打包", mGui);
                GUILayout.Label("标签:[" + FPackageEditor.PackType.only + "]:资源只有被引用才打包", mGui);
                GUILayout.Label("标签:[" + FPackageEditor.PackType.micro + "]:微端资源,排除关键字文件,多个以;隔开", mGui);
                GUILayout.Label("标签:[" + FPackageEditor.PackType.cache + "]:缓存标记", mGui);
            }
        }
    }