Example #1
0
    /// <summary>
    /// 资源加载模块初始化
    /// </summary>
    public override void init()
    {
        base.init();
        // 初始化ABLoader和ABInfo可重用的基础数量
        AssetBundleLoaderFactory.initialize(20);             // 考虑到大部分都是采用同步加载,所以AssetBundleLoader并不需要初始化太多
        AssetBundleInfoFactory.initialize(200);
        mAssetBundleDpMap = new Dictionary <string, string[]>();

        ResLoadMode = ResourceLoadMode.AssetBundle;

        mABRequestTaskMap = new Dictionary <string, AssetBundleLoader>();
        mUnsedABInfoList  = new List <AbstractResourceInfo>();

        // TODO: 根据设备设定相关参数,改成读表控制
        mCheckUnsedABTimeInterval    = 5.0f;
        mWaitForCheckUnsedABInterval = new WaitForSeconds(mCheckUnsedABTimeInterval);
        mMaxUnloadABNumberPerFrame   = 10;
        mABMinimumLifeTime           = 20.0f;
        mABRecycleFPSThreshold       = 20;

        MaxMaximumAsyncCoroutine  = 2;
        AssetBundleAsyncQueueList = new List <AssetBundleAsyncQueue>();
        for (int i = 0; i < MaxMaximumAsyncCoroutine; i++)
        {
            var abaq = new AssetBundleAsyncQueue();
            AssetBundleAsyncQueueList.Add(abaq);
            abaq.startABAsyncLoad();
        }
        loadAllDpInfo();
    }
Example #2
0
 /// <summary>
 /// 加载自身AB
 /// </summary>
 private void loadSelfAssetBundle()
 {
     if (LoadMethod == ResourceLoadMethod.Sync)
     {
         LoadState = ResourceLoadState.Loading;
         loadAssetBundleSync();
     }
     else
     {
         //异步加载AB修改成限制携程数量,入队列的形式
         //ModuleManager.Singleton.getModule<ResourceModuleManager>().StartCoroutine(loadAssetBundleAsync());
         AssetBundleAsyncQueue.enqueue(this);
     }
 }
 /// <summary>
 /// 显示一个AB异步加载队列信息
 /// </summary>
 /// <param name="abaq">队列信息</param>
 /// <param name="queueindex">队列索引</param>
 private void displayOneAssetBundleAsyncQueueInfoUI(AssetBundleAsyncQueue abaq, int queueindex)
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField(string.Format("AB异步携程索引号 : {0}", queueindex), GUILayout.Width(250.0f));
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField("当前AB异步加载信息 : ", GUILayout.Width(250.0f));
     EditorGUILayout.EndHorizontal();
     if (abaq.CurrentLoadingAssetBundleLoader != null)
     {
         displayOneAssetBundleLoaderInfoUI(abaq.CurrentLoadingAssetBundleLoader);
     }
     else
     {
         EditorGUILayout.BeginHorizontal();
         EditorGUILayout.LabelField("无", GUILayout.Width(250.0f));
         EditorGUILayout.EndHorizontal();
     }
 }