Esempio n. 1
0
 /// <summary>
 /// 搜索bundle
 /// </summary>
 private bool SearchAssetBundle()
 {
     if (m_assetBundle == null)
     {
         m_bundleRes = ResPool.Get <BundleRes>(ResData.AllocateBundle(bundleName));
         if (m_bundleRes != null)
         {
             m_assetBundle = m_bundleRes.assetBundle;
         }
     }
     return(m_assetBundle != null);
 }
Esempio n. 2
0
        public void Init(string bundleName, string assetName, ResNotificationListener listener)
        {
            m_only = string.IsNullOrEmpty(assetName);

            m_bundleRes = ResPool.Get <BundleRes>(ResData.AllocateBundle(bundleName), true);

            if (!m_only)
            {
                m_assetRes = ResPool.Get <AssetRes>(ResData.AllocateAsset(assetName, bundleName), true);
            }

            m_listener = listener;
        }
Esempio n. 3
0
        /// <summary>
        /// 卸载资源
        /// </summary>
        public override void Unload()
        {
            if (m_bundleRes != null)
            {
                m_bundleRes.RemoveNotification(OnReceiveNotification);
                m_bundleRes.Unload();
                m_bundleRes = null;
            }

            if (m_assetRes != null)
            {
                m_assetRes.RemoveNotification(OnReceiveNotification);
                m_assetRes.Unload();
                m_assetRes = null;
            }

            m_listener = null;

            Recycle();
        }
Esempio n. 4
0
        /// <summary>
        /// 引用次数为0处理
        /// </summary>
        protected override void OnZeroRef()
        {
            if (m_asset != null)
            {
                if (m_asset is GameObject)
                {
                }
                else
                {
                    Resources.UnloadAsset(m_asset);
                }
            }

            if (m_bundleRes != null)
            {
                m_bundleRes.Unload();
                m_bundleRes = null;
            }

            m_assetBundle = null;
            m_asset       = null;

            Recycle();
        }