示例#1
0
    private FetchedResourceRef RetainInternal(string url, EType type, bool threeD, bool streaming)
    {
        FetchedResourceRef fetchedres = FindFetchedRes(url);
        WWW fetchedWWW = FindFetchedWWW(url);

        if (fetchedres == null && fetchedWWW == null)
        {
            DebugUtil.Error("attempt to retain an unfetched resource, url: " + url);
            return(null);
        }
        else if (fetchedres != null)
        {
            fetchedres.AddRef();
            return(fetchedres);
        }
        else if (fetchedWWW != null)
        {
            FetchedResourceRef res = new FetchedResourceRef();
            res.type = type;
            res.SetObj(fetchedWWW, threeD, streaming);
            res.AddRef();
            fetchedResourceMap[url] = res;

            fetchedWWW.Dispose();
            fetchedWWWMap.Remove(url);

            return(res);
        }
        else //should never be here
        {
            throw new System.Exception("entering impossible code path");
        }
    }
示例#2
0
    /*
     * public void LateUnloadUnusedAssets()
     * {
     *  LastScript.NeedUnloadUnusedAssets = true;
     * }*/

    public bool HasResource(string url)
    {
        FetchedResourceRef fetchedres = FindFetchedRes(url);
        WWW fetchedWWW = FindFetchedWWW(url);

        if (fetchedres == null && fetchedWWW == null)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
示例#3
0
    public void Release(string url)
    {
        FetchedResourceRef res = FindFetchedRes(url);

        if (res == null)
        {
            return;
        }
        int refcount = res.Release();

        if (refcount <= 0)
        {
            fetchedResourceMap.Remove(url);
            //LateUnloadUnusedAssets();
        }
        return;
    }