Commit e1287bad authored by liujiangnan's avatar liujiangnan

feat: 加音效

parent b83c9a96
...@@ -79,18 +79,21 @@ ...@@ -79,18 +79,21 @@
}, },
{ {
"__id__": 22 "__id__": 22
},
{
"__id__": 33
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 33 "__id__": 36
}, },
{ {
"__id__": 34 "__id__": 37
}, },
{ {
"__id__": 35 "__id__": 38
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1547,6 +1550,149 @@ ...@@ -1547,6 +1550,149 @@
"_originalHeight": 0, "_originalHeight": 0,
"_id": "b36Ubd5olJrpvGM0wzH0oD" "_id": "b36Ubd5olJrpvGM0wzH0oD"
}, },
{
"__type__": "cc.Node",
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 34
}
],
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
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": "f91HKwauZLt51g7SWo6nMO"
},
{
"__type__": "cc.Node",
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 33
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 35
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
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": "3flu4UbJdBPK6Cbe2Wk5rz"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
},
"_enabled": true,
"_clip": {
"__uuid__": "77fede7e-1b07-44f7-b87d-4b576c476e14"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "46FtHjay1M44bERqTxhOho"
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",
......
...@@ -589,6 +589,11 @@ export function buttonOnClick(button: cc.Node, callback: Function, scale = 1.0) ...@@ -589,6 +589,11 @@ export function buttonOnClick(button: cc.Node, callback: Function, scale = 1.0)
if (button['cantClick']) { if (button['cantClick']) {
return; return;
} }
cc.audioEngine.stopAll();
const audio = cc.find(`Canvas/audio/btn`).getComponent(cc.AudioSource);
cc.audioEngine.playEffect(audio.clip, false);
button['cantClick'] = true; button['cantClick'] = true;
cc.tween(button) cc.tween(button)
.to(0.1, { scale: scale * 1.1 }) .to(0.1, { scale: scale * 1.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