1.
理集的使用 :http://www.codeandweb.com/
下载软件: TexturePacker
github: 相关工具:https://github.com/ping-chen/egret-tool
2.
{
"groups": [{
"keys": "logo",
"name": "lg"
}
], "resources": [
{
"name": "logo",
"type": "sheet",
"url": "assets/logo.png.json"
}
]
}
class MyMaps extends egret.DisplayObjectContainer {
public constructor() {
super();
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
}
private onAddToStage(event: egret.Event) {
RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.addImg, this);
RES.loadConfig("resource/default.res.json", "resource/");
RES.loadGroup("lg");//倒入 纹理集生成的 .json
}
private addImg() {
let imgs: egret.SpriteSheet = RES.getRes("logo");//引入需要的img部分
let img: egret.Bitmap = new egret.Bitmap();
img.texture = imgs.getTexture("toolt");
this.addChild(img);
}
}