/**
* 资源管理
*/
class RESMgr {
private static instance:RESMgr;
public static get Instance():RESMgr
{
if(this.instance==null)
{
this.instance = new RESMgr();
}
return this.instance;
}
private loadConfigCompleteFunc:Function;
private loadGroupCompleteFunc:Function;
/**
* 加载配置文件
*/
public loadConfig(loadConfigCompleteFunc?:Function):Promise<void>
{
this.loadConfigCompleteFunc = loadConfigCompleteFunc;
//添加资源配置加载完成事件
RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
//加载配置
return RES.loadConfig("resource/default.res.json", "resource/");
}
/**
* 配置文件加载完成,开始预加载preload资源组。
*/
private onConfigComplete(event:RES.ResourceEvent):void
{
RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
if(this.loadConfigCompleteFunc)
{
this.loadConfi
egret 资源管理
最新推荐文章于 2024-10-25 14:42:45 发布
本文深入探讨Egret游戏引擎的资源管理机制,包括资源配置、加载、缓存与释放等核心环节,帮助开发者高效地管理和优化游戏资源,提升应用性能。

最低0.47元/天 解锁文章
807

被折叠的 条评论
为什么被折叠?



