Commit 61404551 authored by yu's avatar yu

退出按钮

parent 382b23b4
This diff is collapsed.
......@@ -112,6 +112,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
initEvent() {
this.btn_laba.on(cc.Node.EventType.TOUCH_END, this.playLaba, this);
cc.find("layout_info/btn_return", this.node).on(cc.Node.EventType.TOUCH_END, this.exitGame, this);
// this.btn_record.on(cc.Node.EventType.TOUCH_END, this.onTouchRecord, this);
// this.btn_recording.on(cc.Node.EventType.TOUCH_END, this.onTouchRecordEnd, this);
cc.find("btn_close", this.layout_final).on(cc.Node.EventType.TOUCH_END, this.onCloseFinal, this);
......@@ -123,6 +124,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.roundEnd();
});
}
private exitGame() {
const middleLayer = cc.find('middleLayer')?.getComponent('middleLayer');
if (middleLayer) {
// 有些模板需要在返回时上报数据,直接把数据作为参数传入就可以了
middleLayer.exitGame(null);//this.resData
} else {
console.log("==触发返回事件==");
}
}
private onRestart() {
this.playLocalAudio("btn");
this.layout_final.active = false;
......
{
"ver": "2.3.5",
"uuid": "9f74d2ea-4e9a-4f24-9552-bb65e215675c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 131,
"height": 131,
"platformSettings": {},
"subMetas": {
"btn_return": {
"ver": "1.0.4",
"uuid": "cccde8c0-4880-4287-8ac6-c0662c685392",
"rawTextureUuid": "9f74d2ea-4e9a-4f24-9552-bb65e215675c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 131,
"height": 131,
"rawWidth": 131,
"rawHeight": 131,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment