Commit 0ffd1ed0 authored by liujiangnan's avatar liujiangnan

feat: 按钮状态切换

parent e063f0d2
...@@ -290,15 +290,18 @@ ...@@ -290,15 +290,18 @@
}, },
{ {
"__id__": 18 "__id__": 18
},
{
"__id__": 22
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 22 "__id__": 26
}, },
{ {
"__id__": 23 "__id__": 27
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -961,6 +964,201 @@ ...@@ -961,6 +964,201 @@
"_N$target": null, "_N$target": null,
"_id": "a6bJ+Nla1EjIMfhadFdnSw" "_id": "a6bJ+Nla1EjIMfhadFdnSw"
}, },
{
"__type__": "cc.Node",
"_name": "exit",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
},
{
"__id__": 24
},
{
"__id__": 25
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
599.045,
318.126,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "a4zoQ/0AFJw6ytBscansbh"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b64de34b-1f53-4720-9870-f72ff0404706"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "51RnSFGoBLeY4yZgd/imme"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 33,
"_left": 0,
"_right": 20.95500000000004,
"_top": 21.874000000000024,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "7bv9/7IFJEip0qzxx9Oo5l"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_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": "b1TBLbudZLopk1vcyucuPh"
},
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
......
...@@ -158,6 +158,18 @@ cc.Class({ ...@@ -158,6 +158,18 @@ cc.Class({
this.canTouch = true; this.canTouch = true;
}, 200); }, 200);
}); });
cc.find(`middleLayer/exit`).on('click', () => {
if (!this.canTouch) {
return;
}
this.canTouch = false;
this.showWaitingLetters();
cc.audioEngine.stopAll();
this.loadOnlineBundle("wordgame_learning");
setTimeout(() => {
this.canTouch = true;
}, 200);
});
}, },
async saveAnswer(data) { async saveAnswer(data) {
...@@ -183,6 +195,23 @@ cc.Class({ ...@@ -183,6 +195,23 @@ cc.Class({
}, },
async loadOnlineBundle(bundleName) { async loadOnlineBundle(bundleName) {
if (bundleName === "wordgame_syllabus") {
cc.find(`middleLayer/book`).active = false;
cc.find(`middleLayer/game`).active = false;
cc.find(`middleLayer/exit`).active = false;
}
if (bundleName === "wordgame_learning") {
cc.find(`middleLayer/book`).active = true;
cc.find(`middleLayer/game`).active = true;
cc.find(`middleLayer/exit`).active = false;
}
if (bundleName === "wordgame_playing") {
cc.find(`middleLayer/book`).active = false;
cc.find(`middleLayer/game`).active = false;
cc.find(`middleLayer/exit`).active = true;
}
cc.audioEngine.stopAll(); cc.audioEngine.stopAll();
this.currentSceneName = bundleName; this.currentSceneName = bundleName;
......
{
"ver": "2.3.5",
"uuid": "40212283-49fd-4a31-8b7b-e3249c3f2185",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 128,
"height": 128,
"platformSettings": {},
"subMetas": {
"exit": {
"ver": "1.0.4",
"uuid": "b64de34b-1f53-4720-9870-f72ff0404706",
"rawTextureUuid": "40212283-49fd-4a31-8b7b-e3249c3f2185",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 4,
"width": 128,
"height": 120,
"rawWidth": 128,
"rawHeight": 128,
"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