Commit 144337b0 authored by limingzhe's avatar limingzhe

fix: 点击播放音频 返回音效

parent 6227a63f
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{
"ver": "1.1.2",
"uuid": "4fd428f3-cf22-467b-8ae4-09dfc1fa94c2",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "d36dd89b-a002-4dc6-8383-ea534341830e",
"downloadMode": 0,
"duration": 1.802449,
"subMetas": {}
}
\ No newline at end of file
...@@ -90,16 +90,16 @@ ...@@ -90,16 +90,16 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 52 "__id__": 54
}, },
{ {
"__id__": 53 "__id__": 55
}, },
{ {
"__id__": 54 "__id__": 56
}, },
{ {
"__id__": 55 "__id__": 57
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1888,12 +1888,15 @@ ...@@ -1888,12 +1888,15 @@
}, },
{ {
"__id__": 49 "__id__": 49
},
{
"__id__": 51
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 51 "__id__": 53
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2132,6 +2135,86 @@ ...@@ -2132,6 +2135,86 @@
"_atlas": null, "_atlas": null,
"_id": "735KnSkDlGq7CTWO843StW" "_id": "735KnSkDlGq7CTWO843StW"
}, },
{
"__type__": "cc.Node",
"_name": "wrong_audio",
"_objFlags": 0,
"_parent": {
"__id__": 46
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 52
}
],
"_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": "79Y7ITmj5FDq00IFEjMEnj"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
},
"_enabled": true,
"_clip": {
"__uuid__": "d36dd89b-a002-4dc6-8383-ea534341830e"
},
"_volume": 0.4,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": true,
"_id": "e4FqxYDQ5DMavcb/jH9rzz"
},
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
......
...@@ -195,9 +195,15 @@ cc.Class({ ...@@ -195,9 +195,15 @@ cc.Class({
loadEnd() { loadEnd() {
this.initView(); this.initView();
this.initAudio();
this.initListener(); this.initListener();
}, },
_wrongAudioSource: null,
initAudio() {
this._wrongAudioSource = cc.find('Canvas/res/wrong_audio').getComponent(cc.AudioSource);
},
initListener() { initListener() {
const bgBottom = cc.find('Canvas/bgBottom'); const bgBottom = cc.find('Canvas/bgBottom');
// bgBottom.on('item_click', (item) => { // bgBottom.on('item_click', (item) => {
...@@ -739,9 +745,11 @@ cc.Class({ ...@@ -739,9 +745,11 @@ cc.Class({
touchStartItem(item) { touchStartItem(item) {
if (item.data.dragEnd) { if (item.data.isDrag) {
return; return;
} }
item.data.isDrag = true;
const circleSmallNode = cc.find('Canvas/res/circle_bg_small') const circleSmallNode = cc.find('Canvas/res/circle_bg_small')
...@@ -822,7 +830,6 @@ cc.Class({ ...@@ -822,7 +830,6 @@ cc.Class({
circle.active = false; circle.active = false;
this._curShowItem.active = false; this._curShowItem.active = false;
circle.data.dragEnd = true;
cc.tween(this._curShowItem.data.pic) cc.tween(this._curShowItem.data.pic)
.to(3, {opacity: 255}, {easing: 'cubicOut'}) .to(3, {opacity: 255}, {easing: 'cubicOut'})
...@@ -836,14 +843,27 @@ cc.Class({ ...@@ -836,14 +843,27 @@ cc.Class({
itemBack() { itemBack() {
const startPos = cc.v2(this._curShowItem.x, this._curShowItem.y);
const endPos = cc.v2(this._curShowItem.baseX, this._curShowItem.baseY);
let distance = startPos.sub(endPos).mag();
if (distance <= 20 && this._curShowItem.data.audioClip) {
cc.audioEngine.stopAll();
cc.audioEngine.play(this._curShowItem.data.audioClip, false, 0.8);
} else {
this._wrongAudioSource.play();
}
const backItem = this._curShowItem; const backItem = this._curShowItem;
cc.tween(backItem) cc.tween(backItem)
.to(0.3, {x: backItem.baseX, y: backItem.baseY}, {easing: 'elasticOut'}) .to(0.3, {x: backItem.baseX, y: backItem.baseY}, {easing: 'elasticOut'})
.call(( ) => { .call(( ) => {
backItem.bgBottomItem.opacity = 255; backItem.bgBottomItem.opacity = 255;
backItem.removeFromParent(); backItem.removeFromParent();
backItem.data.isDrag = false;
}) })
.start(); .start();
}, },
......
{"paths":{},"types":[],"uuids":["c38YYUxxZPH4mfCfBzrGxD","02delMVqdBD70a/HSD99FK","10jEphdBFOu6ZZQmSeBs3z","1ejl+z0StELb2mEvEiZ6vl","2cft3BKilLWYRehZ1Q6yQk","35MdfsfclJvb6Ukmd9ybfA","3dKPHJglZBzI+eAcfj4Tcf","43dIM3eEVID7q17+J3if3y","47IBQCBJVA+JgCZj8hhYJe","58amK658xERYqfswqnS0cS","715WE7gFNIGbQtzftIwBVD","7fzFsTopZEqKXU6N7lZOLJ","82nQe40gpGGLBfTRrGc7FO","8bAJ+sKehJ1J1k2EgZ9QAz","8e8ut3kpRBhpKmX4dq0oBB","8fjHmUGH5DnrGqgruYvYar","99k7fI5ORLSIkinFX0I72z","9bvaMerUlDyary99mJa6xp","a2MjXRFdtLlYQ5ouAFv/+R","a61QWNTm1PcKeDbmxqviuz","a8ok1LbyZDWKL7JK1OVhjE","abBAGcwMFDC6xD0tMtsFUn","b8nYBWqRFFm6W9ONFNUD7C","c8Gskh2AlF1Zhou/3P22sh","d8HsitJHxOYqo801xBk8ev","d9dporjeBOSIy7GiRYxWEt","e5N4U/fdJDP7EIQ6GrCaVv","ecpdLyjvZBwrvm+cedCcQy"],"scenes":{"db://assets/mz_003/scene/scene.fire":0},"redirect":[1,0,27,0],"deps":["internal"],"packs":{"04d1e4274":[3,4,5,6,7,8,11,13,19,23,24],"0cd3ee167":[2,9,10,12,14,15,16,17,18,20,21,22,0,25,26]},"name":"main","importBase":"import","nativeBase":"native","debug":false,"isZip":false,"encrypted":true} {"paths":{},"types":[],"uuids":["c38YYUxxZPH4mfCfBzrGxD","02delMVqdBD70a/HSD99FK","10jEphdBFOu6ZZQmSeBs3z","1ejl+z0StELb2mEvEiZ6vl","2cft3BKilLWYRehZ1Q6yQk","35MdfsfclJvb6Ukmd9ybfA","3dKPHJglZBzI+eAcfj4Tcf","43dIM3eEVID7q17+J3if3y","47IBQCBJVA+JgCZj8hhYJe","58amK658xERYqfswqnS0cS","715WE7gFNIGbQtzftIwBVD","7fzFsTopZEqKXU6N7lZOLJ","82nQe40gpGGLBfTRrGc7FO","8bAJ+sKehJ1J1k2EgZ9QAz","8e8ut3kpRBhpKmX4dq0oBB","8fjHmUGH5DnrGqgruYvYar","99k7fI5ORLSIkinFX0I72z","9bvaMerUlDyary99mJa6xp","a2MjXRFdtLlYQ5ouAFv/+R","a61QWNTm1PcKeDbmxqviuz","a8ok1LbyZDWKL7JK1OVhjE","abBAGcwMFDC6xD0tMtsFUn","b8nYBWqRFFm6W9ONFNUD7C","c8Gskh2AlF1Zhou/3P22sh","d3bdiboAJNxoOD6lNDQYMO","d8HsitJHxOYqo801xBk8ev","d9dporjeBOSIy7GiRYxWEt","e5N4U/fdJDP7EIQ6GrCaVv","ecpdLyjvZBwrvm+cedCcQy"],"scenes":{"db://assets/mz_003/scene/scene.fire":0},"redirect":[1,0,28,0],"deps":["internal"],"packs":{"04d1e4274":[3,4,5,6,7,8,11,13,19,23,25],"084ae3525":[2,9,10,12,14,15,16,17,18,20,21,22,0,24,26,27]},"name":"main","importBase":"import","nativeBase":"native","debug":false,"isZip":false,"encrypted":true}
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
...@@ -186,8 +186,13 @@ cc.Class({ ...@@ -186,8 +186,13 @@ cc.Class({
}, },
loadEnd: function loadEnd() { loadEnd: function loadEnd() {
this.initView(); this.initView();
this.initAudio();
this.initListener(); this.initListener();
}, },
_wrongAudioSource: null,
initAudio: function initAudio() {
this._wrongAudioSource = cc.find('Canvas/res/wrong_audio').getComponent(cc.AudioSource);
},
initListener: function initListener() { initListener: function initListener() {
var _this4 = this; var _this4 = this;
...@@ -628,10 +633,11 @@ cc.Class({ ...@@ -628,10 +633,11 @@ cc.Class({
this.hideCurShowItem(); this.hideCurShowItem();
}, },
touchStartItem: function touchStartItem(item) { touchStartItem: function touchStartItem(item) {
if (item.data.dragEnd) { if (item.data.isDrag) {
return; return;
} }
item.data.isDrag = true;
var circleSmallNode = cc.find('Canvas/res/circle_bg_small'); var circleSmallNode = cc.find('Canvas/res/circle_bg_small');
var bgBottom = cc.find('Canvas/bgBottom'); var bgBottom = cc.find('Canvas/bgBottom');
item.opacity = 0; item.opacity = 0;
...@@ -689,7 +695,6 @@ cc.Class({ ...@@ -689,7 +695,6 @@ cc.Class({
itemAppear: function itemAppear(circle) { itemAppear: function itemAppear(circle) {
circle.active = false; circle.active = false;
this._curShowItem.active = false; this._curShowItem.active = false;
circle.data.dragEnd = true;
cc.tween(this._curShowItem.data.pic).to(3, { cc.tween(this._curShowItem.data.pic).to(3, {
opacity: 255 opacity: 255
}, { }, {
...@@ -702,6 +707,17 @@ cc.Class({ ...@@ -702,6 +707,17 @@ cc.Class({
} }
}, },
itemBack: function itemBack() { itemBack: function itemBack() {
var startPos = cc.v2(this._curShowItem.x, this._curShowItem.y);
var endPos = cc.v2(this._curShowItem.baseX, this._curShowItem.baseY);
var distance = startPos.sub(endPos).mag();
if (distance <= 20 && this._curShowItem.data.audioClip) {
cc.audioEngine.stopAll();
cc.audioEngine.play(this._curShowItem.data.audioClip, false, 0.8);
} else {
this._wrongAudioSource.play();
}
var backItem = this._curShowItem; var backItem = this._curShowItem;
cc.tween(backItem).to(0.3, { cc.tween(backItem).to(0.3, {
x: backItem.baseX, x: backItem.baseX,
...@@ -711,6 +727,7 @@ cc.Class({ ...@@ -711,6 +727,7 @@ cc.Class({
}).call(function () { }).call(function () {
backItem.bgBottomItem.opacity = 255; backItem.bgBottomItem.opacity = 255;
backItem.removeFromParent(); backItem.removeFromParent();
backItem.data.isDrag = false;
}).start(); }).start();
}, },
canvasTouchMove: function canvasTouchMove(e) { canvasTouchMove: function canvasTouchMove(e) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -91,16 +91,16 @@ ...@@ -91,16 +91,16 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 52 "__id__": 54
}, },
{ {
"__id__": 53 "__id__": 55
}, },
{ {
"__id__": 54 "__id__": 56
}, },
{ {
"__id__": 55 "__id__": 57
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1889,12 +1889,15 @@ ...@@ -1889,12 +1889,15 @@
}, },
{ {
"__id__": 49 "__id__": 49
},
{
"__id__": 51
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 51 "__id__": 53
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2133,6 +2136,86 @@ ...@@ -2133,6 +2136,86 @@
"_atlas": null, "_atlas": null,
"_id": "735KnSkDlGq7CTWO843StW" "_id": "735KnSkDlGq7CTWO843StW"
}, },
{
"__type__": "cc.Node",
"_name": "wrong_audio",
"_objFlags": 0,
"_parent": {
"__id__": 46
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 52
}
],
"_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": "79Y7ITmj5FDq00IFEjMEnj"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
},
"_enabled": true,
"_clip": {
"__uuid__": "d36dd89b-a002-4dc6-8383-ea534341830e"
},
"_volume": 0.4,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": true,
"_id": "e4FqxYDQ5DMavcb/jH9rzz"
},
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
......
{
"__type__": "cc.AudioClip",
"_name": "wrong",
"_objFlags": 0,
"_native": ".mp3",
"duration": 1.802449,
"loadMode": 0
}
\ No newline at end of file
...@@ -515,13 +515,13 @@ ...@@ -515,13 +515,13 @@
"relativePath": "mz_003/scene" "relativePath": "mz_003/scene"
}, },
"c3f18614-c716-4f1f-899f-09f073ac6c43": { "c3f18614-c716-4f1f-899f-09f073ac6c43": {
"asset": 1597227117683, "asset": 1597370954795,
"meta": 1597227117689, "meta": 1597370954802,
"relativePath": "mz_003/scene/scene.fire" "relativePath": "mz_003/scene/scene.fire"
}, },
"b5c6439b-d99b-428f-9454-22f767de4a02": { "b5c6439b-d99b-428f-9454-22f767de4a02": {
"asset": 1597227114157, "asset": 1597368895290,
"meta": 1597283962188, "meta": 1597368919166,
"relativePath": "mz_003/script" "relativePath": "mz_003/script"
}, },
"3531d7ec-7dc9-49bd-be94-92677dc9b7c0": { "3531d7ec-7dc9-49bd-be94-92677dc9b7c0": {
...@@ -599,9 +599,19 @@ ...@@ -599,9 +599,19 @@
"meta": 1597226532515, "meta": 1597226532515,
"relativePath": "mz_003/prefab/bgBottom.js" "relativePath": "mz_003/prefab/bgBottom.js"
}, },
"4fd428f3-cf22-467b-8ae4-09dfc1fa94c2": {
"asset": 1597369244594,
"meta": 1597369244595,
"relativePath": "mz_003/audio"
},
"d36dd89b-a002-4dc6-8383-ea534341830e": {
"asset": 1597369249347,
"meta": 1597369249939,
"relativePath": "mz_003/audio/wrong.mp3"
},
"335fe6b8-2b52-45a9-a9c9-cb3b54014251": { "335fe6b8-2b52-45a9-a9c9-cb3b54014251": {
"asset": 1597284541361, "asset": 1597370866564,
"meta": 1597284544320, "meta": 1597370869301,
"relativePath": "mz_003/script/scene.js" "relativePath": "mz_003/script/scene.js"
} }
} }
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"children": [ "children": [
"hierarchy" "hierarchy"
], ],
"height": 295.828125, "height": 296.6875,
"type": "panel", "type": "panel",
"width": 306 "width": 306
}, },
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
"assets", "assets",
"cloud-function" "cloud-function"
], ],
"height": 559.671875, "height": 561.3125,
"type": "panel", "type": "panel",
"width": 306 "width": 306
} }
], ],
"height": 858.5, "height": 861,
"type": "dock-v", "type": "dock-v",
"width": 306 "width": 306
}, },
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"children": [ "children": [
"scene" "scene"
], ],
"height": 587.65625, "height": 589.375,
"type": "panel", "type": "panel",
"width": 701.984375 "width": 701.984375
}, },
...@@ -55,12 +55,12 @@ ...@@ -55,12 +55,12 @@
"children": [ "children": [
"node-library" "node-library"
], ],
"height": 587.65625, "height": 589.375,
"type": "panel", "type": "panel",
"width": 264 "width": 264
} }
], ],
"height": 587.65625, "height": 589.375,
"type": "dock-h", "type": "dock-h",
"width": 969 "width": 969
}, },
...@@ -71,12 +71,12 @@ ...@@ -71,12 +71,12 @@
"timeline", "timeline",
"game-window" "game-window"
], ],
"height": 267.84375, "height": 268.625,
"type": "panel", "type": "panel",
"width": 969 "width": 969
} }
], ],
"height": 858.5, "height": 861,
"type": "dock-v", "type": "dock-v",
"width": 969 "width": 969
}, },
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
"inspector", "inspector",
"cocos-services" "cocos-services"
], ],
"height": 858.5, "height": 861,
"type": "panel", "type": "panel",
"width": 399 "width": 399
} }
...@@ -106,8 +106,7 @@ ...@@ -106,8 +106,7 @@
"cocos-services" "cocos-services"
] ]
}, },
"window-1597286493869": {}, "window-1597372045932": {}
"worker": {}
}, },
"panels": { "panels": {
"sprite-editor": { "sprite-editor": {
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
"39Y15OWDlFc76I4DuYwljw", "39Y15OWDlFc76I4DuYwljw",
"3bOMn6N4hJP5WlpEgN1tyP", "3bOMn6N4hJP5WlpEgN1tyP",
"3fjtSSnnNNBb9Db9xNkttL", "3fjtSSnnNNBb9Db9xNkttL",
"5aAwYeWN5GlpJJBm6cMCUR" "5aAwYeWN5GlpJJBm6cMCUR",
"2daSEONptJQLYU9aq8TOd+",
"01Xreos21IrrsAvhvN44JE"
] ]
} }
No preview for this file type
{"paths":{},"types":[],"uuids":["c38YYUxxZPH4mfCfBzrGxD","02delMVqdBD70a/HSD99FK","10jEphdBFOu6ZZQmSeBs3z","1ejl+z0StELb2mEvEiZ6vl","2cft3BKilLWYRehZ1Q6yQk","35MdfsfclJvb6Ukmd9ybfA","3dKPHJglZBzI+eAcfj4Tcf","43dIM3eEVID7q17+J3if3y","47IBQCBJVA+JgCZj8hhYJe","58amK658xERYqfswqnS0cS","715WE7gFNIGbQtzftIwBVD","7fzFsTopZEqKXU6N7lZOLJ","82nQe40gpGGLBfTRrGc7FO","8bAJ+sKehJ1J1k2EgZ9QAz","8e8ut3kpRBhpKmX4dq0oBB","8fjHmUGH5DnrGqgruYvYar","99k7fI5ORLSIkinFX0I72z","9bvaMerUlDyary99mJa6xp","a2MjXRFdtLlYQ5ouAFv/+R","a61QWNTm1PcKeDbmxqviuz","a8ok1LbyZDWKL7JK1OVhjE","abBAGcwMFDC6xD0tMtsFUn","b8nYBWqRFFm6W9ONFNUD7C","c8Gskh2AlF1Zhou/3P22sh","d8HsitJHxOYqo801xBk8ev","d9dporjeBOSIy7GiRYxWEt","e5N4U/fdJDP7EIQ6GrCaVv","ecpdLyjvZBwrvm+cedCcQy"],"scenes":{"db://assets/mz_003/scene/scene.fire":0},"redirect":[1,0,27,0],"deps":["internal"],"packs":{"04d1e4274":[3,4,5,6,7,8,11,13,19,23,24],"0cd3ee167":[2,9,10,12,14,15,16,17,18,20,21,22,0,25,26]},"name":"main","importBase":"import","nativeBase":"native","debug":false,"isZip":false,"encrypted":true} {"paths":{},"types":[],"uuids":["c38YYUxxZPH4mfCfBzrGxD","02delMVqdBD70a/HSD99FK","10jEphdBFOu6ZZQmSeBs3z","1ejl+z0StELb2mEvEiZ6vl","2cft3BKilLWYRehZ1Q6yQk","35MdfsfclJvb6Ukmd9ybfA","3dKPHJglZBzI+eAcfj4Tcf","43dIM3eEVID7q17+J3if3y","47IBQCBJVA+JgCZj8hhYJe","58amK658xERYqfswqnS0cS","715WE7gFNIGbQtzftIwBVD","7fzFsTopZEqKXU6N7lZOLJ","82nQe40gpGGLBfTRrGc7FO","8bAJ+sKehJ1J1k2EgZ9QAz","8e8ut3kpRBhpKmX4dq0oBB","8fjHmUGH5DnrGqgruYvYar","99k7fI5ORLSIkinFX0I72z","9bvaMerUlDyary99mJa6xp","a2MjXRFdtLlYQ5ouAFv/+R","a61QWNTm1PcKeDbmxqviuz","a8ok1LbyZDWKL7JK1OVhjE","abBAGcwMFDC6xD0tMtsFUn","b8nYBWqRFFm6W9ONFNUD7C","c8Gskh2AlF1Zhou/3P22sh","d3bdiboAJNxoOD6lNDQYMO","d8HsitJHxOYqo801xBk8ev","d9dporjeBOSIy7GiRYxWEt","e5N4U/fdJDP7EIQ6GrCaVv","ecpdLyjvZBwrvm+cedCcQy"],"scenes":{"db://assets/mz_003/scene/scene.fire":0},"redirect":[1,0,28,0],"deps":["internal"],"packs":{"04d1e4274":[3,4,5,6,7,8,11,13,19,23,25],"084ae3525":[2,9,10,12,14,15,16,17,18,20,21,22,0,24,26,27]},"name":"main","importBase":"import","nativeBase":"native","debug":false,"isZip":false,"encrypted":true}
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
{ {
"last-module-event-record-time": 1596700248647 "last-module-event-record-time": 1597372049578
} }
...@@ -90,16 +90,16 @@ ...@@ -90,16 +90,16 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 52 "__id__": 54
}, },
{ {
"__id__": 53 "__id__": 55
}, },
{ {
"__id__": 54 "__id__": 56
}, },
{ {
"__id__": 55 "__id__": 57
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1888,12 +1888,15 @@ ...@@ -1888,12 +1888,15 @@
}, },
{ {
"__id__": 49 "__id__": 49
},
{
"__id__": 51
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 51 "__id__": 53
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2132,6 +2135,86 @@ ...@@ -2132,6 +2135,86 @@
"_atlas": null, "_atlas": null,
"_id": "735KnSkDlGq7CTWO843StW" "_id": "735KnSkDlGq7CTWO843StW"
}, },
{
"__type__": "cc.Node",
"_name": "wrong_audio",
"_objFlags": 0,
"_parent": {
"__id__": 46
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 52
}
],
"_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": "79Y7ITmj5FDq00IFEjMEnj"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
},
"_enabled": true,
"_clip": {
"__uuid__": "d36dd89b-a002-4dc6-8383-ea534341830e"
},
"_volume": 0.6,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": true,
"_id": "e4FqxYDQ5DMavcb/jH9rzz"
},
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
......
{"version":"1.0.8","stats":{"/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/__qc_index__.js":"2020-08-13T01:59:22.307Z","/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/assets/mz_003/prefab/bgBottom.js":"2020-08-13T01:59:22.290Z","/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/assets/mz_003/script/scene.js":"2020-08-13T01:59:22.286Z","/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/assets/mz_003/script/util.js":"2020-08-13T01:59:22.288Z"}} {"version":"1.0.8","stats":{"/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/__qc_index__.js":"2020-08-14T01:35:19.685Z","/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/assets/mz_003/prefab/bgBottom.js":"2020-08-14T01:35:19.667Z","/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/assets/mz_003/script/util.js":"2020-08-14T01:35:19.665Z","/Users/lmz/Documents/workspace/git_project/cocos/cc_mz_003/play/temp/quick-scripts/src/assets/mz_003/script/scene.js":"2020-08-14T01:35:19.664Z"}}
This source diff could not be displayed because it is too large. You can view the blob instead.
(function () { (function () {
var scripts = [{"deps":{"./assets/mz_003/prefab/bgBottom":1,"./assets/mz_003/script/scene":2,"./assets/mz_003/script/util":3},"path":"preview-scripts/__qc_index__.js"},{"deps":{"../script/util":3},"path":"preview-scripts/assets/mz_003/prefab/bgBottom.js"},{"deps":{"./util":3},"path":"preview-scripts/assets/mz_003/script/scene.js"},{"deps":{},"path":"preview-scripts/assets/mz_003/script/util.js"}]; var scripts = [{"deps":{"./assets/mz_003/script/util":2,"./assets/mz_003/prefab/bgBottom":1,"./assets/mz_003/script/scene":3},"path":"preview-scripts/__qc_index__.js"},{"deps":{"../script/util":2},"path":"preview-scripts/assets/mz_003/prefab/bgBottom.js"},{"deps":{},"path":"preview-scripts/assets/mz_003/script/util.js"},{"deps":{"./util":2},"path":"preview-scripts/assets/mz_003/script/scene.js"}];
var entries = ["preview-scripts/__qc_index__.js"]; var entries = ["preview-scripts/__qc_index__.js"];
var bundleScript = 'preview-scripts/__qc_bundle__.js'; var bundleScript = 'preview-scripts/__qc_bundle__.js';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -186,8 +186,13 @@ cc.Class({ ...@@ -186,8 +186,13 @@ cc.Class({
}, },
loadEnd: function loadEnd() { loadEnd: function loadEnd() {
this.initView(); this.initView();
this.initAudio();
this.initListener(); this.initListener();
}, },
_wrongAudioSource: null,
initAudio: function initAudio() {
this._wrongAudioSource = cc.find('Canvas/res/wrong_audio').getComponent(cc.AudioSource);
},
initListener: function initListener() { initListener: function initListener() {
var _this4 = this; var _this4 = this;
...@@ -628,10 +633,11 @@ cc.Class({ ...@@ -628,10 +633,11 @@ cc.Class({
this.hideCurShowItem(); this.hideCurShowItem();
}, },
touchStartItem: function touchStartItem(item) { touchStartItem: function touchStartItem(item) {
if (item.data.dragEnd) { if (item.data.isDrag) {
return; return;
} }
item.data.isDrag = true;
var circleSmallNode = cc.find('Canvas/res/circle_bg_small'); var circleSmallNode = cc.find('Canvas/res/circle_bg_small');
var bgBottom = cc.find('Canvas/bgBottom'); var bgBottom = cc.find('Canvas/bgBottom');
item.opacity = 0; item.opacity = 0;
...@@ -689,7 +695,6 @@ cc.Class({ ...@@ -689,7 +695,6 @@ cc.Class({
itemAppear: function itemAppear(circle) { itemAppear: function itemAppear(circle) {
circle.active = false; circle.active = false;
this._curShowItem.active = false; this._curShowItem.active = false;
circle.data.dragEnd = true;
cc.tween(this._curShowItem.data.pic).to(3, { cc.tween(this._curShowItem.data.pic).to(3, {
opacity: 255 opacity: 255
}, { }, {
...@@ -702,6 +707,17 @@ cc.Class({ ...@@ -702,6 +707,17 @@ cc.Class({
} }
}, },
itemBack: function itemBack() { itemBack: function itemBack() {
var startPos = cc.v2(this._curShowItem.x, this._curShowItem.y);
var endPos = cc.v2(this._curShowItem.baseX, this._curShowItem.baseY);
var distance = startPos.sub(endPos).mag();
if (distance <= 20 && this._curShowItem.data.audioClip) {
cc.audioEngine.stopAll();
cc.audioEngine.play(this._curShowItem.data.audioClip, false, 0.8);
} else {
this._wrongAudioSource.play();
}
var backItem = this._curShowItem; var backItem = this._curShowItem;
cc.tween(backItem).to(0.3, { cc.tween(backItem).to(0.3, {
x: backItem.baseX, x: backItem.baseX,
...@@ -711,6 +727,7 @@ cc.Class({ ...@@ -711,6 +727,7 @@ cc.Class({
}).call(function () { }).call(function () {
backItem.bgBottomItem.opacity = 255; backItem.bgBottomItem.opacity = 255;
backItem.removeFromParent(); backItem.removeFromParent();
backItem.data.isDrag = false;
}).start(); }).start();
}, },
canvasTouchMove: function canvasTouchMove(e) { canvasTouchMove: function canvasTouchMove(e) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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