示例#1
0
        /// <summary>
        /// 从资源组读取资源
        /// </summary>
        /// <typeparam name="T">资源类型</typeparam>
        /// <param name="setting">资源设置</param>
        /// <param name="index">下标</param>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public T loadAssetFromGroup <T>(AssetSetting setting, int index, int id = 0) where T : Object
        {
            var assets = loadAssets <T>(setting, id);

            if (index < 0 || assets.Length >= index)
            {
                return(null);
            }

            return(assets[index]);
        }
示例#2
0
        /// <summary>
        /// 读取资源(多个,组合资源)
        /// </summary>
        /// <typeparam name="T">资源类型</typeparam>
        /// <param name="setting">资源设置</param>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public T[] loadAssets <T>(AssetSetting setting, int id = 0) where T : Object
        {
            var fileName = string.Format(setting.format, id);

            return(loadAssets <T>(setting.path, fileName));
        }