private static bool TryGetValidAssetBundleManagerSetting(out AssetBundleManagerSetting setting)
 {
     setting = GetOrCreateAssetBundleManagerSetting();
     if (setting.IsValid)
     {
         return(true);
     }
     Debug.LogError("Please set the correct path in AssetBundleManagerSetting! Click me to select AssetBundleManagerSetting.", setting);
     setting = null;
     return(false);
 }
 private void InitSetting()
 {
     mSetting = AssetBundleEditorTools.GetAssetBundleManagerSetting();
     DisposeSerializedObject();
     if (mSetting)
     {
         mSerializedObject      = new SerializedObject(mSetting);
         mShowBuildTarget.value = !mSerializedObject.FindProperty(nameof(AssetBundleManagerSetting.UseActiveBuildTarget)).boolValue;
         mShowBuildTarget.valueChanged.AddListener(Repaint);
     }
 }
 public static string GetAssetBundlePath(AssetBundleManagerSetting.LoadBundlePathMode loadBundlePathMode, string bundleName,
                                         bool autoAddExtension = true)
 {
     return(Path.Combine(AssetBundleManagerSetting.GetLoadBundleFullPath(loadBundlePathMode, LoadBundlePath),
                         GetAssetBundleName(bundleName, autoAddExtension)));
 }
        private void OnGUI()
        {
            mPosition = GUILayout.BeginScrollView(mPosition);
            //Deleted or move or change name, reload.
            if (!mSetting || AssetDatabase.GetAssetPath(mSetting) != AssetBundleManager.AssetBundleManagerSettingPath)
            {
                InitSetting();
            }
            if (!mSetting)
            {
                //init or skin changed
                if (mSetupButtonStyle == null || mIsProSkin != EditorGUIUtility.isProSkin)
                {
                    mIsProSkin        = EditorGUIUtility.isProSkin;
                    mSetupButtonStyle = new GUIStyle(GUI.skin.button)
                    {
                        fontSize = 20
                    };
                }
                EditorGUILayout.HelpBox("Click the button below to setup AssetBundleManager.", MessageType.Info);
                if (GUILayout.Button("Setup AssetBundleManager", mSetupButtonStyle, GUILayout.Height(50)))
                {
                    mSetting          = AssetBundleEditorTools.GetOrCreateAssetBundleManagerSetting();
                    mSerializedObject = new SerializedObject(mSetting);
                }
            }
            else
            {
                AssetBundleManagerSettingEditor.Draw(mSerializedObject, mShowBuildTarget, false);

                if (GUILayout.Button("Build"))
                {
                    AssetBundleEditorTools.Build();
                }
                if (GUILayout.Button("Set AssetBundle Name"))
                {
                    AssetBundleEditorTools.SetAssetBundleName();
                }

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Clear StreamingAssets Bundle Path"))
                {
                    AssetBundleEditorTools.ClearStreamingAssetsBundlePath();
                }
                if (GUILayout.Button("Copy To StreamingAssets Bundle Path"))
                {
                    AssetBundleEditorTools.CopyToStreamingAssetsBundlePath();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Clear Load AssetBundle Path"))
                {
                    AssetBundleEditorTools.ClearLoadAssetBundlePath();
                }
                if (GUILayout.Button("Copy To Load AssetBundle Path"))
                {
                    AssetBundleEditorTools.CopyToLoadAssetBundlePath();
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
        }