Commit 266ee383 authored by Tt's avatar Tt

细节修改

parent ca00bc71
...@@ -1321,8 +1321,8 @@ ...@@ -1321,8 +1321,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1320, "width": 1342,
"height": 960 "height": 919
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1377,7 +1377,7 @@ ...@@ -1377,7 +1377,7 @@
"__uuid__": "c9f7d5ba-b915-4205-b652-ff3a0db89faa" "__uuid__": "c9f7d5ba-b915-4205-b652-ff3a0db89faa"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 0, "_sizeMode": 1,
"_fillType": 0, "_fillType": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1397,7 +1397,7 @@ ...@@ -1397,7 +1397,7 @@
"node": { "node": {
"__id__": 29 "__id__": 29
}, },
"_enabled": true, "_enabled": false,
"r_width": 1, "r_width": 1,
"r_height": 1, "r_height": 1,
"r_top": 0, "r_top": 0,
...@@ -1405,7 +1405,7 @@ ...@@ -1405,7 +1405,7 @@
"p_left": 0, "p_left": 0,
"p_right": 0, "p_right": 0,
"p_top": 0, "p_top": 0,
"p_bottom": 0, "p_bottom": 1,
"black": 0, "black": 0,
"noHead": 0, "noHead": 0,
"debug": 0, "debug": 0,
...@@ -1418,7 +1418,7 @@ ...@@ -1418,7 +1418,7 @@
"node": { "node": {
"__id__": 29 "__id__": 29
}, },
"_enabled": true, "_enabled": false,
"alignMode": 1, "alignMode": 1,
"_target": null, "_target": null,
"_alignFlags": 45, "_alignFlags": 45,
...@@ -1637,8 +1637,8 @@ ...@@ -1637,8 +1637,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 327, "width": 325,
"height": 266 "height": 264
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
......
...@@ -218,34 +218,42 @@ cc.Class({ ...@@ -218,34 +218,42 @@ cc.Class({
onTouchAudio(touch) { onTouchAudio(touch) {
if (this._gameCode != 0) return resolve(''); if (this._gameCode != 0) return resolve('');
if (!this._cantouch) return; if (!this._cantouch) return;
this._cantouch = false; // this._cantouch = false;
let item = touch.target.parent; let item = touch.target.parent;
this.playAudioAni(item).then(() => { this.playAudioAni(item).then(() => {
this._cantouch = true; // this._cantouch = true;
}); });
}, },
onTouchItem(touch, info) { onTouchItem(touch, info) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this._gameCode != 0) return resolve(''); if (this._gameCode != 0) return resolve('');
if (!this._cantouch) return resolve(''); if (!this._cantouch) return resolve('');
if (this._runId) {
//执行中断并直接完成
}
if (!this._runId) {
this._runId = Math.random() * 1000000000;
} else {
this._runId++;
}
let runId = this._runId;
let item = touch.target; let item = touch.target;
if (this._successItems.indexOf(item) > -1) return resolve(''); if (this._successItems.indexOf(item) > -1) return resolve('');
let data = item.data; let data = item.data;
this._cantouch = false; // this._cantouch = false;
if (data.right) { if (data.right) {
this.catRight(); this.catRight();
pg.view.visible(pg.view.find(item, 'box'), true); pg.view.visible(pg.view.find(item, 'box'), true);
this.playSFX("audio_right").then(() => { this.playSFX("audio_right").then(() => {
//audio 播放的时候动画播放, audio停的时候 动画正好能停下 if (runId != this._runId) {
//如果动画停的位置不对,直接强制设置对应的效果 this.touchStep5();
//下一次播放没有问题即可 resolve('');
} else {
this.playAudioAni(item).then(() => { this.playAudioAni(item).then(() => {
this._cantouch = true; this.touchStep5();
this._successItems.push(item);
this.catNormal();
this.groupEnd();
resolve(''); resolve('');
}) })
}
}); });
} else { } else {
this.catError(); this.catError();
...@@ -262,18 +270,31 @@ cc.Class({ ...@@ -262,18 +270,31 @@ cc.Class({
}); });
}, },
touchStep5(item) {
this.catNormal();
if (this._successItems.every(it => it.id != item.id)) {
this._successItems.push(item);
}
this.groupEnd();
},
playAudioAni(item) { playAudioAni(item) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// var anim = pg.view.find(item, `audio`).getComponent(cc.Animation); let items = this._cardLayout.children;
// anim.play(); items.forEach(it => {
let audio = pg.view.find(it, `audio`);
let icon_1 = pg.view.find(audio, "icon_1");
icon_1.active = false;
})
let audio = pg.view.find(item, `audio`); let audio = pg.view.find(item, `audio`);
let icon_1 = pg.view.find(audio, "icon_1"); let icon_1 = pg.view.find(audio, "icon_1");
let icon_2 = pg.view.find(audio, "icon_2"); let icon_2 = pg.view.find(audio, "icon_2");
let icon_3 = pg.view.find(audio, "icon_3"); let icon_3 = pg.view.find(audio, "icon_3");
icon_1.active = true; icon_1.active = true;
//如果没有audio也要能正常走 //如果没有audio也要能正常走
pg.audio.playAudioByUrl(item.data.audio).then(() => { cc.audioEngine.stopAll();
// anim.stop(); // this.playUrlId && cc.audioEngine.stop(this.playUrlId);
pg.audio.playAudioByUrl(item.data.audio).then((audioId) => {
this.playUrlId = audioId;
icon_1.active = false; icon_1.active = false;
resolve(''); resolve('');
}); });
......
...@@ -810,7 +810,7 @@ class AudioUtil { ...@@ -810,7 +810,7 @@ class AudioUtil {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => { cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8); const audioId = cc.audioEngine.play(audioClip, false, 0.8);
cc.audioEngine.setFinishCallback(audioId, () => { cc.audioEngine.setFinishCallback(audioId, () => {
resolve(audioClip); resolve(audioId);
}); });
}); });
}); });
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1332, "width": 1342,
"height": 960, "height": 919,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_1": { "bg_1": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 1332, "width": 1342,
"height": 960, "height": 919,
"rawWidth": 1332, "rawWidth": 1342,
"rawHeight": 960, "rawHeight": 919,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 327, "width": 325,
"height": 266, "height": 264,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_pic-bg": { "bg_pic-bg": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 327, "width": 325,
"height": 266, "height": 264,
"rawWidth": 327, "rawWidth": 325,
"rawHeight": 266, "rawHeight": 264,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
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