コード例 #1
0
        void Request(string name, string hash, uint crc, Action <BundleRef> onLoad, Action <Exception> onFail)
        {
            //ロード済だったらすぐに返す
            BundleRef bundleRef = null;

            if (m_LoadedBundles.TryGetValue(name, out bundleRef))
            {
                Log.Assert(bundleRef != null);
                if (bundleRef.Bundle != null)
                {
                    onLoad(bundleRef);
                    return;
                }
                else
                {
                    //管理していない形でアンロードされた
                    m_LoadedBundles.Remove(name);
                    Log.Warning("[ilib-abloader] unhandle unloaded name {0}.", name);
                }
            }

            if (!m_LoadOperator.IsDownload(name, hash) || IsCache(name, hash))
            {
                LoadRequest(name, hash, crc, onLoad, onFail);
            }
            else
            {
                var url = m_LoadOperator.RequestUrl(name, hash);
                DownloadRequest(url, name, hash, () => LoadRequest(name, hash, crc, onLoad, onFail), onFail);
            }
        }
コード例 #2
0
        internal void UnloadRef(BundleRef bundleRef)
        {
            switch (ABLoader.UnloadMode)
            {
            case UnloadMode.Immediately:
                m_LoadedBundles.Remove(bundleRef.Name);
                bundleRef.Dispose();
                break;

            case UnloadMode.Manual:
            case UnloadMode.Auto:
                lock (m_UnloadList)
                {
                    m_UnloadList.Add(bundleRef);
                }
                break;
            }
        }
コード例 #3
0
 public void Dispose()
 {
     if (m_Disposed)
     {
         return;
     }
     m_Disposed = true;
     m_Owner.UnloadContainer(this);
     m_BundleRef?.RemoveRef();
     if (m_Deps != null)
     {
         for (int i = 0; i < m_Deps.Length; i++)
         {
             m_Deps[i]?.RemoveRef();
         }
     }
     m_BundleRef = null;
     m_Deps      = null;
 }
コード例 #4
0
 public void OnLoad(BundleRef bundle)
 {
     if (m_Error || m_Disposed)
     {
         return;
     }
     bundle.AddRef();
     if (Name == bundle.Name)
     {
         m_BundleRef = bundle;
     }
     else
     {
         m_Deps[m_DepCount++] = bundle;
     }
     //ロード済みかチェック
     if (m_BundleRef != null && m_DepLength == m_DepCount)
     {
         Success();
     }
 }
コード例 #5
0
 internal BundleRef CreateBundleRef(string name, AssetBundle bundle)
 {
     return(m_LoadedBundles[name] = new BundleRef(this, name, bundle));
 }