egret加载资源的三种方式

本文详细介绍了Egret游戏引擎中资源加载的三种主要方式,包括使用default.res.json配置文件加载、Main.ts代码动态加载以及手动加载资源的方法,帮助开发者更好地理解和掌握Egret资源管理。
摘要由CSDN通过智能技术生成

 

default.res.json文件内容

{
	"groups": [
		{
			"keys": "bg_jpg,description_json",
			"name": "preload"
		},
		{
			"keys": "avatar_default_png,back_png,login_wx_png",
			"name": "stload"
		},
		{
			"keys": "bg_jpg",
			"name": "defaultload"
		}
	],
	"resources": [
		{
			"url": "assets/bg.jpg",
			"type": "image",
			"name": "bg_jpg"
		},
		{
			"url": "config/description.json",
			"type": "json",
			"name": "description_json"
		},
		{
			"url": "assets/lobby/avatar_default.png",
			"type": "image",
			"name": "avatar_default_png"
		},
		{
			"url": "assets/lobby/back.png",
			"type": "image",
			"name": "back_png"
		},
		{
			"url": "assets/lobby/login_wx.png",
			"type": "image",
			"name": "login_wx_png"
		}
	]
}

 

Main.ts代码内容

//
//
//  Copyright (c) 2014-present, Egret Technology.
//  All rights reserved.
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the followin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值