Exemplo n.º 1
0
        public static BundleRes Allocate(ResData data)
        {
            var res = ObjectPool <BundleRes> .Instance.Allocate();

            res.Init(data);
            return(res);
        }
Exemplo n.º 2
0
 public void Init(ResData data)
 {
     m_assetName = data.assetName;
     m_state     = ResState.Waiting;
     m_type      = ResType.Resource;
     m_asset     = null;
 }
Exemplo n.º 3
0
Arquivo: ResPool.cs Projeto: ayuexs/C-
        /// <summary>
        /// 获取Res对象
        /// </summary>
        /// <param name="data"></param>
        /// <param name="create"></param>
        public Res _Get(ResData data, bool create = false)
        {
            Res res = null;

            if (poolDic.TryGetValue(data.poolKey, out res))
            {
                res.Retain();
                return(res);
            }

            if (!create)
            {
                return(null);
            }

            res = ResFactory.Create(data);

            if (res == null)
            {
                return(null);
            }

            res.Retain();

            poolDic.Add(data.poolKey, res);
            if (!poolList.Contains(res))
            {
                poolList.Add(res);
            }

            return(res);
        }
Exemplo n.º 4
0
 public void Init(ResData data)
 {
     m_bundleName  = data.bundleName;
     m_state       = ResState.Waiting;
     m_type        = ResType.Bundle;
     m_asset       = null;
     m_assetBundle = null;
 }
Exemplo n.º 5
0
        /// <summary>
        /// 查找依赖
        /// </summary>
        private bool FindDependencies()
        {
            string[] ds     = AssetBundleDependencies.Instance.GetDependencies(m_bundleName);
            int      length = ds.Length;

            m_dependencies = new BundleRes[length];
            for (int i = 0; i < length; i++)
            {
                m_dependencies[i] = ResPool.Get <BundleRes>(ResData.AllocateBundle(ds[i]), true);
            }
            return(length > 0);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 搜索bundle
 /// </summary>
 private bool SearchAssetBundle()
 {
     if (m_assetBundle == null)
     {
         m_bundleRes = ResPool.Get <BundleRes>(ResData.AllocateBundle(bundleName));
         if (m_bundleRes != null)
         {
             m_assetBundle = m_bundleRes.assetBundle;
         }
     }
     return(m_assetBundle != null);
 }
Exemplo n.º 7
0
        public void Init(string bundleName, string assetName, ResNotificationListener listener)
        {
            m_only = string.IsNullOrEmpty(assetName);

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

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

            m_listener = listener;
        }
Exemplo n.º 8
0
 public void Init(string assetName, ResNotificationListener listener)
 {
     m_mainRes  = ResPool.Get <ResourceRes>(ResData.AllocateResource(assetName), true);
     m_listener = listener;
 }
Exemplo n.º 9
0
Arquivo: ResPool.cs Projeto: ayuexs/C-
 /// <summary>
 /// 获取资源
 /// </summary>
 /// <param name="data"></param>
 /// <param name="createNew">如果没有是否创建</param>
 public static Res Get(ResData data, bool createNew = false)
 {
     return(Instance._Get(data, createNew));
 }
Exemplo n.º 10
0
Arquivo: ResPool.cs Projeto: ayuexs/C-
 /// <summary>
 /// 获取资源
 /// </summary>
 /// <param name="data"></param>
 /// <param name="createNew">如果没有是否创建</param>
 public static T Get <T>(ResData data, bool createNew = false) where T : Res
 {
     return(Get(data, createNew) as T);
 }