예제 #1
0
    /// <summary>
    /// 取消资源加载监听
    /// </summary>
    /// <param name="_type">资源类型</param>
    /// <param name="path">资源路径</param>
    /// <param name="call">要取消的回调函数</param>
    public void RemoveAsyncCallback(EAssetProcessFlag assetType, string path, System.Action <AssetRequest> call)
    {
        AssetRequest _entity = null;

        if (m_kAssets.TryGetValue(path, out _entity))
        {
            _entity.RemoveListener(call);
        }
    }
예제 #2
0
    public AssetRequest Load(EAssetProcessFlag assetType, string path, string extension)
    {
        string       realPath = GetRealPath(path, extension);
        AssetRequest request  = null;

        if (!m_kAssets.TryGetValue(path, out request))
        {
            request = new AssetRequest(realPath, assetType);
            m_kAssets.Add(path, request);
            request.SyncLoad();
        }

        return(request);
    }
예제 #3
0
    public AssetRequest AsyncLoad(EAssetProcessFlag assetType, string path, string extension, System.Action <AssetRequest> call)
    {
        string       realPath = GetRealPath(path, extension);
        AssetRequest _entity  = null;

        if (!m_kAssets.TryGetValue(path, out _entity))
        {
            _entity = new AssetRequest(realPath, assetType);
            m_kAssets.Add(path, _entity);
            m_kWaitQueue.Enqueue(_entity);
        }
        if (!_entity.isLoaded)
        {
            _entity.AddListener(call);
        }
        else
        {
            call(_entity);
        }
        return(_entity);
    }
예제 #4
0
 public AssetRequest(string n, EAssetProcessFlag flag)
 {
     assetBundleName  = n;
     hashCode         = assetBundleName.GetHashCode();
     assetProcessFlag = flag;
 }