Esempio n. 1
0
    private Dictionary <string, Queue <AssetPoolItem> > _entityPoolMap = new Dictionary <string, Queue <AssetPoolItem> >(); //

    void Awake()
    {
        DontDestroyOnLoad(this);
        CreateInstance(this);
        _longTermAssetPool = gameObject.AddComponent <AssetCachePool>();
        _shortAssetPool    = gameObject.AddComponent <AssetCachePool>();
    }
Esempio n. 2
0
        /// <summary>
        /// 读取资源(多个,组合资源)
        /// </summary>
        /// <typeparam name="T">资源类型</typeparam>
        /// <param name="path">路径</param>
        /// <param name="fileName">文件名</param>
        /// <returns></returns>
        public static T[] loadAssets <T>(string path, string fileName) where T : Object
        {
            var key = path + fileName;

            Debug.Log("LoadAssets<" + typeof(T) + "> from " + key);

            if (!AssetCachePool <T[]> .contains(key))
            {
                var obj = Resources.LoadAll <T>(key);
                return(AssetCachePool <T[]> .set(key, obj));
            }
            return(AssetCachePool <T[]> .get(key));
        }