public void UnLoadAssetBundle(string ABName)
    {
        uint crc = Crc32.GetCrc32(ABName);

        if (ABItemDic.ContainsKey(crc))
        {
            AssetBundleItem abItem = ABItemDic[crc];
            abItem.refCount--;
            if (abItem.refCount <= 0 && abItem.assetBundle != null)
            {
                abItem.assetBundle.Unload(true);
                abItem.Reset();
                ABItemPool.Recyle(abItem);
                ABItemDic.Remove(crc);
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 按资源名 卸载资源
    /// </summary>
    private void UnLoadAssetBundle(string name)
    {
        AssetBundleItem item = null;
        uint            crc  = CRC32.GetCRC32(name);

        if (abItemDict.TryGetValue(crc, out item) && item != null)
        {
            item.m_RefCount--;
            if (item.m_RefCount <= 0 && item.m_AssetBundle != null)
            {
                item.m_AssetBundle.Unload(true);
                item.Reset();
                abItemClassPool.UnSpawn(item);
                abItemDict.Remove(crc);
            }
        }
    }
Esempio n. 3
0
    /// <summary>
    /// 卸载AssetBundle
    /// </summary>
    private void UnLoadAssetBundle(string name)
    {
        AssetBundleItem item = null;
        uint            crc  = CRC32.GetCRC32(name);

        if (_assetBundleItemDic.TryGetValue(crc, out item) && item != null)
        {
            item.refCount--;
            if (item.refCount <= 0 && item.assetbundle != null)
            {
                item.assetbundle.Unload(true);
                item.Reset();
                _assetBundleItemPool.Recycle(item);
                _assetBundleItemDic.Remove(crc);
            }
        }
    }
Esempio n. 4
0
    public void UnLoadAssetBundle(string name)
    {
        AssetBundleItem item = null;
        string          crc  = CRC32.GetCRC32(name).ToString();

        if (m_AssetBundleItemDic.TryGetValue(crc, out item) && item != null)
        {
            item.RefCount--;
            if (item.RefCount <= 0 && item.assetBundle != null)
            {
                item.assetBundle.Unload(true);
                item.Reset();
                m_AssetBundleItemPool.Recycle(item);
                m_AssetBundleItemDic.Remove(crc);
            }
        }
    }
Esempio n. 5
0
    void UnloadAssetBundle(string bundleName)
    {
        var             bundleCrc = CRC32.GetCRC32(bundleName);
        AssetBundleItem item      = null;

        if (cacheAssetBundleItemDic.TryGetValue(bundleCrc, out item))
        {
            item.RefCount--;
            if (item.RefCount <= 0)
            {
                item.Bundle.Unload(true);
                item.Reset();
                assetBundleItemPool.Recycle(item);
                cacheAssetBundleItemDic.Remove(bundleCrc);
            }
        }
    }
Esempio n. 6
0
    private void UnloadAB(string name)
    {
        AssetBundleItem abItem  = null;
        uint            nameCrc = Crc32.GetCRC32(name);

        if (m_crcABItemDic.TryGetValue(nameCrc, out abItem) && abItem != null)
        {
            abItem.RefCount--;
            if (abItem.RefCount <= 0 && abItem.AB != null)
            {
                abItem.AB.Unload(true);
                abItem.Reset();
                m_abItemPool.Recycle(abItem);
                m_crcABItemDic.Remove(nameCrc);
            }
        }
        else
        {
            Debug.LogError("没有对应crc的ab包");
        }
    }