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

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

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

            m_listener = listener;
        }
Exemplo 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;

            Recycle2Cache();
        }
Exemplo 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;
            Recycle2Cache();
        }