Commit f400be83 authored by 李维's avatar 李维

添加返回按钮

parent 1d722888
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
}
handleClickBack() {
const middleLayer = global["middleLayer"];
if (middleLayer) {
// 有些模板需要在返回时上报数据,直接把数据作为参数传入就可以了
middleLayer.exitGame({});
} else {
console.log("==触发返回事件==");
}
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "0a3c462f-1dee-4a1d-aea5-18a025386912",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "b3dc9174-6b08-43d9-b7c6-9075feb4aebe",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 139,
"height": 97,
"platformSettings": {},
"subMetas": {
"btn_return": {
"ver": "1.0.4",
"uuid": "2edc0e9d-cd34-4b06-9ae5-31339c08d5f4",
"rawTextureUuid": "b3dc9174-6b08-43d9-b7c6-9075feb4aebe",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 139,
"height": 97,
"rawWidth": 139,
"rawHeight": 97,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
...@@ -93,22 +93,25 @@ ...@@ -93,22 +93,25 @@
"__id__": 69 "__id__": 69
}, },
{ {
"__id__": 73 "__id__": 75
}, },
{ {
"__id__": 75 "__id__": 79
},
{
"__id__": 81
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 81 "__id__": 87
}, },
{ {
"__id__": 82 "__id__": 88
}, },
{ {
"__id__": 83 "__id__": 89
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3029,13 +3032,13 @@ ...@@ -3029,13 +3032,13 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "animBg", "_name": "btn_return",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 70 "__id__": 70
...@@ -3045,6 +3048,228 @@ ...@@ -3045,6 +3048,228 @@
}, },
{ {
"__id__": 72 "__id__": 72
},
{
"__id__": 73
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 139,
"height": 97
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-840.5,
441.5,
0,
0,
0,
0,
1,
1,
1,
0
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "12b1m9/BRFY4MEvSzWfbQy"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 69
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "2edc0e9d-cd34-4b06-9ae5-31339c08d5f4"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "cb4rz7jeJFd7Xe3Nka4cG0"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 69
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": 50,
"_right": 0,
"_top": 50,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "eb+O7GfFtAArThp2MyOb3M"
},
{
"__type__": "0a3c4YvHe5KHa6lGKAlOGkS",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 69
},
"_enabled": true,
"_id": "06B4Q4M+pD4J/92NbkO4qQ"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 69
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.1,
"clickEvents": [
{
"__id__": 74
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "2d8hqAPcJMBbPo+ZvmKlnH"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 69
},
"component": "",
"_componentId": "0a3c4YvHe5KHa6lGKAlOGkS",
"handler": "handleClickBack",
"customEventData": ""
},
{
"__type__": "cc.Node",
"_name": "animBg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 76
},
{
"__id__": 77
},
{
"__id__": 78
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3100,7 +3325,7 @@ ...@@ -3100,7 +3325,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 69 "__id__": 75
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3132,7 +3357,7 @@ ...@@ -3132,7 +3357,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 69 "__id__": 75
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -3159,7 +3384,7 @@ ...@@ -3159,7 +3384,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 69 "__id__": 75
}, },
"_enabled": true, "_enabled": true,
"_id": "beaGv1g0JBZ59RUOJpzt0W" "_id": "beaGv1g0JBZ59RUOJpzt0W"
...@@ -3175,7 +3400,7 @@ ...@@ -3175,7 +3400,7 @@
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 74 "__id__": 80
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3231,7 +3456,7 @@ ...@@ -3231,7 +3456,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 73 "__id__": 79
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -3262,16 +3487,16 @@ ...@@ -3262,16 +3487,16 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 76 "__id__": 82
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 79 "__id__": 85
}, },
{ {
"__id__": 80 "__id__": 86
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3327,16 +3552,16 @@ ...@@ -3327,16 +3552,16 @@
"_name": "title", "_name": "title",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 75 "__id__": 81
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 77 "__id__": 83
}, },
{ {
"__id__": 78 "__id__": 84
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3392,7 +3617,7 @@ ...@@ -3392,7 +3617,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 76 "__id__": 82
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3427,7 +3652,7 @@ ...@@ -3427,7 +3652,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 76 "__id__": 82
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -3454,7 +3679,7 @@ ...@@ -3454,7 +3679,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 75 "__id__": 81
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3486,7 +3711,7 @@ ...@@ -3486,7 +3711,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 75 "__id__": 81
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
......
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