Framework.ResMgr资源管理
This commit is contained in:
97
client/assets/scripts/Framework/ResMgr/ResConfig.ts
Normal file
97
client/assets/scripts/Framework/ResMgr/ResConfig.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* 资源加载配置
|
||||
*/
|
||||
export interface ResLoadConfig {
|
||||
/** 是否显示加载进度 */
|
||||
showProgress?: boolean;
|
||||
|
||||
/** 加载超时时间(ms) */
|
||||
timeout?: number;
|
||||
|
||||
/** 失败重试次数 */
|
||||
retryCount?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预加载配置
|
||||
*/
|
||||
export interface PreloadConfig extends ResLoadConfig {
|
||||
/** 进度回调 */
|
||||
onProgress?: (finished: number, total: number) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认资源加载配置
|
||||
*/
|
||||
export const DefaultResConfig: ResLoadConfig = {
|
||||
showProgress: false,
|
||||
timeout: 30000, // 30秒超时
|
||||
retryCount: 3 // 重试3次
|
||||
};
|
||||
|
||||
/**
|
||||
* Bundle配置
|
||||
*/
|
||||
export interface BundleConfig {
|
||||
/** Bundle名称 */
|
||||
name: string;
|
||||
|
||||
/** Bundle路径(可选,默认从远程服务器加载) */
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源路径配置
|
||||
* 统一管理常用资源路径
|
||||
*/
|
||||
export class ResPath {
|
||||
/** UI预制体路径 */
|
||||
static readonly UI_PREFAB = 'prefabs/ui';
|
||||
|
||||
/** 角色预制体路径 */
|
||||
static readonly ACTOR_PREFAB = 'prefabs/actor';
|
||||
|
||||
/** 特效预制体路径 */
|
||||
static readonly EFFECT_PREFAB = 'prefabs/effect';
|
||||
|
||||
/** UI纹理路径 */
|
||||
static readonly UI_TEXTURE = 'textures/ui';
|
||||
|
||||
/** 角色纹理路径 */
|
||||
static readonly ACTOR_TEXTURE = 'textures/actor';
|
||||
|
||||
/** 音效路径 */
|
||||
static readonly AUDIO_EFFECT = 'audio/effect';
|
||||
|
||||
/** 背景音乐路径 */
|
||||
static readonly AUDIO_MUSIC = 'audio/music';
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源类型枚举
|
||||
*/
|
||||
export enum ResType {
|
||||
/** 预制体 */
|
||||
PREFAB = 'Prefab',
|
||||
|
||||
/** 纹理 */
|
||||
TEXTURE = 'Texture2D',
|
||||
|
||||
/** 精灵帧 */
|
||||
SPRITE_FRAME = 'SpriteFrame',
|
||||
|
||||
/** 音频片段 */
|
||||
AUDIO_CLIP = 'AudioClip',
|
||||
|
||||
/** JSON */
|
||||
JSON = 'JsonAsset',
|
||||
|
||||
/** 文本 */
|
||||
TEXT = 'TextAsset',
|
||||
|
||||
/** 材质 */
|
||||
MATERIAL = 'Material',
|
||||
|
||||
/** 动画片段 */
|
||||
ANIMATION_CLIP = 'AnimationClip'
|
||||
}
|
||||
Reference in New Issue
Block a user