Example #1
0
        private void OnEnable()
        {
            m_Controller = new AssetBundleEditorController();
            m_Controller.OnLoadingAssetBundle += OnLoadingAssetBundle;
            m_Controller.OnLoadingAsset       += OnLoadingAsset;
            m_Controller.OnLoadCompleted      += OnLoadCompleted;
            m_Controller.OnAssetAssigned      += OnAssetAssigned;
            m_Controller.OnAssetUnassigned    += OnAssetUnassigned;

            m_MenuState                           = MenuState.Normal;
            m_SelectedAssetBundle                 = null;
            m_AssetBundleRoot                     = new AssetBundleFolder("AssetBundles", null);
            m_ExpandedAssetBundleFolderNames      = new HashSet <string>();
            m_SelectedAssetsInSelectedAssetBundle = new HashSet <Asset>();
            m_ExpandedSourceFolders               = new HashSet <SourceFolder>();
            m_SelectedSourceAssets                = new HashSet <SourceAsset>();
            m_MissingSourceAssetIcon              = EditorGUIUtility.IconContent("console.warnicon.sml").image;

            m_CachedSelectedSourceFolders   = new HashSet <SourceFolder>();
            m_CachedUnselectedSourceFolders = new HashSet <SourceFolder>();
            m_CachedAssignedSourceFolders   = new HashSet <SourceFolder>();
            m_CachedUnassignedSourceFolders = new HashSet <SourceFolder>();
            m_CachedAssignedSourceAssets    = new HashSet <SourceAsset>();
            m_CachedUnassignedSourceAssets  = new HashSet <SourceAsset>();

            m_AssetBundlesViewScroll         = Vector2.zero;
            m_AssetBundleViewScroll          = Vector2.zero;
            m_SourceAssetsViewScroll         = Vector2.zero;
            m_InputAssetBundleName           = null;
            m_InputAssetBundleVariant        = null;
            m_HideAssignedSourceAssets       = false;
            m_CurrentAssetBundleContentCount = 0;
            m_CurrentAssetBundleRowOnDraw    = 0;
            m_CurrentSourceRowOnDraw         = 0;

            if (m_Controller.Load())
            {
                Debug.Log("Load configuration success.");
            }
            else
            {
                Debug.LogWarning("Load configuration failure.");
            }

            EditorUtility.DisplayProgressBar("Prepare AssetBundle Editor", "Processing...", 0f);
            RefreshAssetBundleTree();
            EditorUtility.ClearProgressBar();
        }