예제 #1
0
    //-------------------------------------------------------------------------
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();
        int select_index = 0;

        if (CurrentProject != null)
        {
            if (!MapProjectIndexCombineWithSelectIndex.TryGetValue(CurrentProject.ProjectIndex, out select_index))
            {
                return;
            }

            select_index = EditorGUILayout.Popup("当前项目:", select_index, ArrayProjectBundleIdentity);
            if (CurrentSelectIndex != select_index)
            {
                _decideCurrentProject(select_index);
                _initCurrentProject();
                _checkResourcesPath();
                _getCurrentTargetPath();
                _translatePatchXml(mPatchInfoPath);
                CurrentSelectIndex = select_index;
                ListNeedBuildPlatform.Clear();
                ListNeedCopyRawPlatform.Clear();
            }
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        mIsPackSelectItem = EditorGUILayout.Toggle("BuildSelectItems", mIsPackSelectItem);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("AB资源所在路径:", mAssetBundleResourcesPath);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("裸资源所在路径:", mRowAssetPath);
        EditorGUILayout.EndHorizontal();

        //EditorGUILayout.BeginHorizontal();
        //EditorGUILayout.LabelField("Config所在路径:", mConfigPath);
        //EditorGUILayout.EndHorizontal();

        _drawSplitLine();

        MapProjectPlatformInfoChanged.Clear();
        foreach (var item in MapProjectPlatformInfo)
        {
            var platform_info = _drwaProjectPlatformInfo(item.Value);
            MapProjectPlatformInfoChanged[item.Key] = platform_info;
        }

        foreach (var i in MapProjectPlatformInfoChanged)
        {
            ProjectPlatformInfo project_info = null;
            MapProjectPlatformInfo.TryGetValue(i.Key, out project_info);
            if (project_info != null)
            {
                project_info.cloneData(i.Value);
            }
        }

        EditorGUILayout.BeginHorizontal();
        bool click_build_asset = GUILayout.Button("打AssetBundle包(压缩)", GUILayout.Width(200));

        if (click_build_asset)
        {
            _startBuild();
        }

        bool click_build_copy_raw = GUILayout.Button("CopyAssetsRawFoldToABFold", GUILayout.Width(200));

        if (click_build_copy_raw)
        {
            _startCopyRawAndConfig();
        }
        EditorGUILayout.EndHorizontal();

        _drawSplitLine();

        EditorGUILayout.BeginHorizontal();
        bool copy_android = mCopyAndroid;

        copy_android = EditorGUILayout.Toggle("Copy&DeleteAndroidAB", copy_android);
        if (mCopyAndroid != copy_android)
        {
            mCopyAndroid = copy_android;
            _checkIfNeedCopyPlatform(mCopyAndroid, MapProjectPlatformInfo["ANDROID"]);
        }

        bool copy_ios = mCopyIOS;

        copy_ios = EditorGUILayout.Toggle("Copy&DeleteIOSAB", copy_ios);
        if (mCopyIOS != copy_ios)
        {
            mCopyIOS = copy_ios;
            _checkIfNeedCopyPlatform(mCopyIOS, MapProjectPlatformInfo["IOS"]);
        }

        bool copy_pc = mCopyPC;

        copy_pc = EditorGUILayout.Toggle("Copy&DeletePCAB", copy_pc);
        if (mCopyPC != copy_pc)
        {
            mCopyPC = copy_pc;
            _checkIfNeedCopyPlatform(mCopyPC, MapProjectPlatformInfo["PC"]);
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        bool copy_asset = GUILayout.Button("复制选中平台AB资源到persistentPath");

        if (copy_asset)
        {
            foreach (var i in ListNeedCopyPlatform)
            {
                _copyOrDeleteToPersistentDataPath(i, false);
                _copyOrDeleteToPersistentDataPath(i, true);
            }
        }
        bool delete_asset = GUILayout.Button("删除选中平台persistentPath中的AB资源");

        if (delete_asset)
        {
            foreach (var i in ListNeedCopyPlatform)
            {
                _copyOrDeleteToPersistentDataPath(i, false);
            }
        }
        EditorGUILayout.EndHorizontal();
    }
예제 #2
0
    //-------------------------------------------------------------------------
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();
        int select_index = 0;

        if (CurrentProject != null)
        {
            if (!MapProjectIndexCombineWithSelectIndex.TryGetValue(CurrentProject.ProjectIndex, out select_index))
            {
                return;
            }

            select_index = EditorGUILayout.Popup("当前项目:", select_index, ArrayProjectBundleIdentity);
            if (CurrentSelectIndex != select_index)
            {
                _decideCurrentProject(select_index);
                _initCurrentProject();
                _checkResourcesPath();
                _getCurrentTargetPath();
                _translatePatchXml(mPatchInfoPath);
                CurrentSelectIndex = select_index;
                ListNeedBuildPlatform.Clear();
                ListNeedCopyRawPlatform.Clear();
            }
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        mIsPackSelectItem = EditorGUILayout.Toggle("BuildSelectItems", mIsPackSelectItem);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("AB资源所在路径:", mAssetBundleResourcesPath);
        //Rect ab_resourcesrect = EditorGUILayout.GetControlRect(GUILayout.Width(500));
        //mAssetBundleResourcesPath = EditorGUI.TextField(ab_resourcesrect, mAssetBundleResourcesPath);
        //if ((Event.current.type == EventType.DragUpdated ||
        //  Event.current.type == EventType.DragExited) &&
        //  ab_resourcesrect.Contains(Event.current.mousePosition))
        //{
        //    string path = DragAndDrop.paths[0];
        //    if (!string.IsNullOrEmpty(path))
        //    {
        //        DragAndDrop.AcceptDrag();
        //        mAssetBundleResourcesPath = path;
        //    }
        //}
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("裸资源所在路径:", mRowAssetPath);
        //Rect ab_rowrect = EditorGUILayout.GetControlRect(GUILayout.Width(500));
        //mRowAssetPath = EditorGUI.TextField(ab_rowrect, mRowAssetPath);
        //if ((Event.current.type == EventType.DragUpdated ||
        //  Event.current.type == EventType.DragExited) &&
        //  ab_rowrect.Contains(Event.current.mousePosition))
        //{
        //    string path = DragAndDrop.paths[0];
        //    if (!string.IsNullOrEmpty(path))
        //    {
        //        DragAndDrop.AcceptDrag();
        //        mRowAssetPath = path;
        //    }
        //}
        EditorGUILayout.EndHorizontal();

        _drawSplitLine();

        MapProjectPlatformInfoChanged.Clear();
        foreach (var item in MapProjectPlatformInfo)
        {
            var platform_info = _drwaProjectPlatformInfo(item.Value);
            MapProjectPlatformInfoChanged[item.Key] = platform_info;
        }

        foreach (var i in MapProjectPlatformInfoChanged)
        {
            ProjectPlatformInfo project_info = null;
            MapProjectPlatformInfo.TryGetValue(i.Key, out project_info);
            if (project_info != null)
            {
                project_info.cloneData(i.Value);
            }
        }

        //bool check_path = GUILayout.Button("重设路径", GUILayout.Width(200));
        //if (check_path)
        //{
        //    _checkPath();
        //    _checkPatchData();
        //}

        EditorGUILayout.BeginHorizontal();
        bool click_build_asset = GUILayout.Button("打AssetBundle包(压缩)", GUILayout.Width(200));

        if (click_build_asset)
        {
            _startBuild();
        }

        bool click_build_copy_raw = GUILayout.Button("CopyAssetsRawFoldToABFold", GUILayout.Width(200));

        if (click_build_copy_raw)
        {
            _startCopyRaw();
        }
        EditorGUILayout.EndHorizontal();

        _drawSplitLine();

        EditorGUILayout.BeginHorizontal();
        bool copy_android = mCopyAndroid;

        copy_android = EditorGUILayout.Toggle("Copy&DeleteAndroidAB", copy_android);
        if (mCopyAndroid != copy_android)
        {
            mCopyAndroid = copy_android;
            _checkIfNeedCopyPlatform(mCopyAndroid, MapProjectPlatformInfo["ANDROID"]);
        }

        bool copy_ios = mCopyIOS;

        copy_ios = EditorGUILayout.Toggle("Copy&DeleteIOSAB", copy_ios);
        if (mCopyIOS != copy_ios)
        {
            mCopyIOS = copy_ios;
            _checkIfNeedCopyPlatform(mCopyIOS, MapProjectPlatformInfo["IOS"]);
        }

        bool copy_pc = mCopyPC;

        copy_pc = EditorGUILayout.Toggle("Copy&DeletePCAB", copy_pc);
        if (mCopyPC != copy_pc)
        {
            mCopyPC = copy_pc;
            _checkIfNeedCopyPlatform(mCopyPC, MapProjectPlatformInfo["PC"]);
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        bool copy_asset = GUILayout.Button("复制选中平台AB资源到persistentPath");

        if (copy_asset)
        {
            foreach (var i in ListNeedCopyPlatform)
            {
                _copyOrDeleteToPersistentDataPath(i, false);
                _copyOrDeleteToPersistentDataPath(i, true);
            }
        }
        bool delete_asset = GUILayout.Button("删除选中平台persistentPath中的AB资源");

        if (delete_asset)
        {
            foreach (var i in ListNeedCopyPlatform)
            {
                _copyOrDeleteToPersistentDataPath(i, false);
            }
        }
        EditorGUILayout.EndHorizontal();
    }