Commit e6a89b70 authored by Tt's avatar Tt

基础音效增加完成

parent 7558dbf9
This diff is collapsed.
...@@ -181,6 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -181,6 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
meetCurrentTouchNode: cc.Node; meetCurrentTouchNode: cc.Node;
onTouchMeetStart(event) { onTouchMeetStart(event) {
this.playLocalAudio('dragdown')
this.waitTime = 8; this.waitTime = 8;
if (this.guide == 1) return; if (this.guide == 1) return;
let node = event.target; let node = event.target;
...@@ -318,6 +319,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -318,6 +319,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
vegetableCurrentTouchNode: cc.Node; vegetableCurrentTouchNode: cc.Node;
onTouchVegetableStart(event) { onTouchVegetableStart(event) {
this.playLocalAudio('dragdown')
this.waitTime = 8; this.waitTime = 8;
if (this.guide == 0) return; if (this.guide == 0) return;
let node = event.target; let node = event.target;
...@@ -400,15 +402,17 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -400,15 +402,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
node.x = SceneComponent.pieStartPos.x; node.x = SceneComponent.pieStartPos.x;
node.y = SceneComponent.pieStartPos.y; node.y = SceneComponent.pieStartPos.y;
this.updateItemPie(node, this.currentQuestion); this.updateItemPie(node, this.currentQuestion);
this.playLocalAudio('pie_drop')
cc.tween(node) cc.tween(node)
.to(0.5, { x: SceneComponent.pieDefaultPos.x, y: SceneComponent.pieDefaultPos.y - 50 }) .to(0.5, { x: SceneComponent.pieDefaultPos.x, y: SceneComponent.pieDefaultPos.y - 50 })
.to(0.06, { x: SceneComponent.pieDefaultPos.x, y: SceneComponent.pieDefaultPos.y }) .to(0.06, { x: SceneComponent.pieDefaultPos.x, y: SceneComponent.pieDefaultPos.y })
.call(() => { .call(() => {
this.playLocalAudio('boom')
let ani = pg.view.find(node, 'ani') let ani = pg.view.find(node, 'ani')
ani.active = true; ani.active = true;
pg.view.playDBAnimation(ani, 'normal', 1) pg.view.playDBAnimation(ani, 'normal', 1)
node.parent = this.currentMain node.parent = this.currentMain
}).delay(0.5).call(() => { }).delay(0.9).call(() => {
this.nextStage(); this.nextStage();
}) })
.start(); .start();
...@@ -525,6 +529,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -525,6 +529,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.discardCurrent(); this.discardCurrent();
// 中间移出 // 中间移出
cc.tween(this.currentMain).by(1, { y: -1800 }).start(); cc.tween(this.currentMain).by(1, { y: -1800 }).start();
this.playLocalAudio('nextgame')
// 中间移入 // 中间移入
let node = this.nextLayoutMain(this.nextQuestion); let node = this.nextLayoutMain(this.nextQuestion);
// 切换题目主体 // 切换题目主体
...@@ -545,6 +550,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -545,6 +550,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.createCurrent(); this.createCurrent();
// 中间移出 // 中间移出
cc.tween(this.currentMain).by(1, { y: -1800 }).start(); cc.tween(this.currentMain).by(1, { y: -1800 }).start();
this.playLocalAudio('nextgame')
// 中间移入 // 中间移入
let node = this.nextLayoutMain(this.preQuestion); let node = this.nextLayoutMain(this.preQuestion);
// 切换题目主体 // 切换题目主体
......
...@@ -570,7 +570,10 @@ let pg = { ...@@ -570,7 +570,10 @@ let pg = {
audio: { audio: {
playAudioByUrl(audio_url, cb = null, loadCb = null) { playAudioByUrl(audio_url, cb = null, loadCb = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!audio_url) return resolve(null); if (!audio_url) {
cb && cb();
return resolve(null);
}
cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => { cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
const audioId = cc.audioEngine.play(audioClip, false, 0.8); const audioId = cc.audioEngine.play(audioClip, false, 0.8);
......
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