完善 docs
12
demo/assets/multi-render/multi-batcher/images.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "805c842a-631c-48df-a8bc-2381a7ca3674",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/1.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
36
demo/assets/multi-render/multi-batcher/images/1.png.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "77844f44-c0da-4c94-a97f-fac1ab844551",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"1": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "c4f9ea14-b9a8-4039-ae25-982ff81e4762",
|
||||
"rawTextureUuid": "77844f44-c0da-4c94-a97f-fac1ab844551",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -6,
|
||||
"offsetY": -8,
|
||||
"trimX": 32,
|
||||
"trimY": 36,
|
||||
"width": 152,
|
||||
"height": 103,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/etc1_rgb_a.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "b6161231-4d65-475c-a6bb-a8199e851e88",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"etc1_rgb_a": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "ea8530c6-52b6-4157-863e-8be26c953b96",
|
||||
"rawTextureUuid": "b6161231-4d65-475c-a6bb-a8199e851e88",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -13,
|
||||
"offsetY": 2,
|
||||
"trimX": 24,
|
||||
"trimY": 12,
|
||||
"width": 154,
|
||||
"height": 131,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/png.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
36
demo/assets/multi-render/multi-batcher/images/png.png.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "eb72a5a2-8837-4f45-a24a-2486eef5fb78",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "0ae51d4d-4f69-43c6-a708-da9c2d81f6f5",
|
||||
"rawTextureUuid": "eb72a5a2-8837-4f45-a24a-2486eef5fb78",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -9.5,
|
||||
"offsetY": -0.5,
|
||||
"trimX": 33,
|
||||
"trimY": 5,
|
||||
"width": 143,
|
||||
"height": 150,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/pvrtc2_rgb_a.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "22247785-ef30-4b66-a9d2-ebcaf6a7f6e8",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"pvrtc2_rgb_a": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "41673f76-dab9-4965-9999-9c566a3f154a",
|
||||
"rawTextureUuid": "22247785-ef30-4b66-a9d2-ebcaf6a7f6e8",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -11.5,
|
||||
"offsetY": -2.5,
|
||||
"trimX": 29,
|
||||
"trimY": 13,
|
||||
"width": 147,
|
||||
"height": 138,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/sheep_down_0.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "438c0fd3-74ca-4503-b2bc-2088cd6dbf4c",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"sheep_down_0": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "8f1f3994-e88e-4406-a8e9-1c46f45e5de2",
|
||||
"rawTextureUuid": "438c0fd3-74ca-4503-b2bc-2088cd6dbf4c",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": -25,
|
||||
"trimX": 2,
|
||||
"trimY": 61,
|
||||
"width": 224,
|
||||
"height": 87,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/sheep_jump_2.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "100eba2c-cfa2-4fb0-a5ac-a95f9b461fc0",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"sheep_jump_2": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "2d3ce116-db4a-424c-bb3b-f5cd16c99569",
|
||||
"rawTextureUuid": "100eba2c-cfa2-4fb0-a5ac-a95f9b461fc0",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -10,
|
||||
"offsetY": 3.5,
|
||||
"trimX": 24,
|
||||
"trimY": 24,
|
||||
"width": 160,
|
||||
"height": 104,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/sheep_jump_3.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "44999d18-51d1-4017-9ea6-98dcad8ecdf5",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"sheep_jump_3": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "b4f1cb90-0aa4-4c2d-a233-7fd2357d36d6",
|
||||
"rawTextureUuid": "44999d18-51d1-4017-9ea6-98dcad8ecdf5",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -12,
|
||||
"offsetY": -2,
|
||||
"trimX": 26,
|
||||
"trimY": 24,
|
||||
"width": 152,
|
||||
"height": 115,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
demo/assets/multi-render/multi-batcher/images/sheep_run_1.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "7a788430-6621-4bd5-86ce-0957a216dd69",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 228,
|
||||
"height": 159,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"sheep_run_1": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "555112d2-35fe-4adc-8c99-05ecdf88c29a",
|
||||
"rawTextureUuid": "7a788430-6621-4bd5-86ce-0957a216dd69",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 1,
|
||||
"offsetY": 2,
|
||||
"trimX": 27,
|
||||
"trimY": 20,
|
||||
"width": 176,
|
||||
"height": 115,
|
||||
"rawWidth": 228,
|
||||
"rawHeight": 159,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,10 +4,35 @@ const { ccclass, property } = cc._decorator;
|
||||
@ccclass
|
||||
export default class MultiBatcher extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
@property(cc.Node)
|
||||
batchBtn: cc.Node = null;
|
||||
|
||||
@property(cc.Node)
|
||||
cancelBtn: cc.Node = null;
|
||||
|
||||
@property(cc.Node)
|
||||
textures: cc.Node = null;
|
||||
|
||||
|
||||
protected onLoad(): void {
|
||||
this.batchBtn.on('click', () => {
|
||||
const batcher = new cc.sp.MultiBatcher();
|
||||
batcher.init();
|
||||
this.textures.children.forEach(v => {
|
||||
const sprite = v.getComponent(cc.Sprite);
|
||||
batcher.requsetMaterial(sprite.spriteFrame.getTexture());
|
||||
sprite.setVertsDirty();
|
||||
});
|
||||
});
|
||||
|
||||
this.cancelBtn.on('click', () => {
|
||||
this.textures.children.forEach(v => {
|
||||
const sprite = v.getComponent(cc.Sprite);
|
||||
sprite.spriteFrame.getTexture().unlinkMaterial();
|
||||
sprite.setMaterial(0, cc.Material.getBuiltinMaterial('2d-sprite'));
|
||||
sprite.setVertsDirty();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|