Exemplo n.º 1
0
 public void ResetInfo(string path, AssetManageMode bundleMode, AssetEncryptMode encryption, ELoadType loadType, float delayDelTime)
 {
     this.path         = path;
     this.loadType     = loadType;
     this.delayDelTime = delayDelTime;
 }
Exemplo n.º 2
0
    private LoadedAssetBundle LoadBundleByFileStream(string bundleName, LoadFromType loadFromType, AssetEncryptMode encript = AssetEncryptMode.None)
    {
        if (string.IsNullOrEmpty(bundleName))
        {
            return(null);
        }

        int nHashCode            = bundleName.GetHashCode();
        LoadedAssetBundle loaded = ABManager.Instance.GetLoadedBundle(nHashCode);

        if (loaded != null)
        {
            loaded.Count();
            return(loaded);
        }

        //在对应目录里进行AB创建
        m_strFullName.Length = 0;
        if (loadFromType == LoadFromType.LoadFromDownLoad)
        {
            m_strFullName.Append(ABPathHelper.AssetsURL);
        }
        else
        {
            m_strFullName.Append(ABPathHelper.AssetsLocalABURL);
        }
        m_strFullName.Append(bundleName);

        string path = m_strFullName.ToString();

        if (File.Exists(path))
        {
            AssetBundle ab = AssetBundle.LoadFromFile(path);
            if (ab != null)
            {
                loaded = ABManager.Instance.AddLoadedBundle(nHashCode, ab);
            }
        }
        else
        {
            if (GameUtils.OnlyShowInInner)
            {
                Debug.Log("<color=red>资源: " + m_strFullName + "不存在</color>");
            }
        }

        return(loaded);
    }