Commit bfd1bb43 authored by Tt's avatar Tt

修改切换逻辑

parent a3d7439a
...@@ -34,7 +34,7 @@ export default class LayerRecord extends cc.Component { ...@@ -34,7 +34,7 @@ export default class LayerRecord extends cc.Component {
this.layout_record.active = true; this.layout_record.active = true;
this.letter = data.letter this.letter = data.letter
this.targetTime = data.targetTime this.targetTime = data.targetTime
if(data.reset){ if (data.reset) {
this.recordAudio = null; this.recordAudio = null;
this.showPlay(); this.showPlay();
} }
...@@ -48,8 +48,9 @@ export default class LayerRecord extends cc.Component { ...@@ -48,8 +48,9 @@ export default class LayerRecord extends cc.Component {
}) })
let btn_record = pg.view.find(this.layout_record, 'btn_record'); let btn_record = pg.view.find(this.layout_record, 'btn_record');
let btn_play = pg.view.find(this.layout_record, 'btn_play'); let btn_play = pg.view.find(this.layout_record, 'btn_play');
btn_record.on(cc.Node.EventType.TOUCH_START, this.onTouchRecord, this); // btn_record.on(cc.Node.EventType.TOUCH_START, this.onTouchRecord, this);
btn_record.on(cc.Node.EventType.TOUCH_END, this.onTouchRecordEnd, this); // btn_record.on(cc.Node.EventType.TOUCH_END, this.onTouchRecordEnd, this);
btn_record.on(cc.Node.EventType.TOUCH_END, this.onTouchRecordClick, this);
btn_play.on(cc.Node.EventType.TOUCH_END, this.onTouchPlayRecord, this); btn_play.on(cc.Node.EventType.TOUCH_END, this.onTouchPlayRecord, this);
} }
...@@ -147,8 +148,18 @@ export default class LayerRecord extends cc.Component { ...@@ -147,8 +148,18 @@ export default class LayerRecord extends cc.Component {
protected update(dt: number): void { protected update(dt: number): void {
this.showTimeUpdate(); this.showTimeUpdate();
} }
private recording: boolean;
onTouchRecordClick() {
if (this.recording) {
this.onTouchRecordEnd();
} else {
this.onTouchRecord();
}
}
//按钮触发,使用的方法 //按钮触发,使用的方法
async onTouchRecord() { async onTouchRecord() {
this.recording = true;
this.recordAudio = ''; this.recordAudio = '';
this.showPlay(); this.showPlay();
let AniNode = pg.view.find(this.layout_record, 'AniNode'); let AniNode = pg.view.find(this.layout_record, 'AniNode');
...@@ -194,6 +205,7 @@ export default class LayerRecord extends cc.Component { ...@@ -194,6 +205,7 @@ export default class LayerRecord extends cc.Component {
}); //结束录音 }); //结束录音
} }
async recrodEnd(data) { async recrodEnd(data) {
this.recording = false;
this.recordAudio = data.audioUrl; this.recordAudio = data.audioUrl;
this.showPlay(); this.showPlay();
let score = data.result.overall; let score = data.result.overall;
......
...@@ -3812,7 +3812,7 @@ ...@@ -3812,7 +3812,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 152.6, "width": 150.74,
"height": 63 "height": 63
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -3898,7 +3898,7 @@ ...@@ -3898,7 +3898,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
210.81399999999996, 208.95399999999995,
0, 0,
0, 0,
0, 0,
......
...@@ -196,12 +196,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -196,12 +196,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.currentAudioId = null; this.currentAudioId = null;
com.playVoiceEnd(); com.playVoiceEnd();
this.touchForbid = true; this.touchForbid = true;
pg.event.once('layer_coin_show_coin_end', () => { this.touchForbid = false;
this.touchForbid = false; this.nextLayer();
this.nextLayer(); // pg.event.once('layer_coin_show_coin_end', () => {
}) // 动画回调\ // this.touchForbid = false;
this.score += 3; // this.nextLayer();
pg.event.emit('layer_coin_show_coin', 3) //1 2 3硬币数量 // }) // 动画回调\
// this.score += 3;
// pg.event.emit('layer_coin_show_coin', 3) //1 2 3硬币数量
}, (audioId) => { }, (audioId) => {
this.currentAudioId = audioId; this.currentAudioId = audioId;
}) })
...@@ -263,7 +265,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -263,7 +265,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
preLayer() { preLayer() {
// 积分需要计算,未获取的内容 // 积分需要计算,未获取的内容
if (!this.LastData) return; if (!this.LastData) {
this.touchForbid = false;
return;
}
this.tempCount = 0; this.tempCount = 0;
cc.audioEngine.stopEffect(this.currentAudioId); cc.audioEngine.stopEffect(this.currentAudioId);
pg.event.emit('img_voice_play_voice_end'); pg.event.emit('img_voice_play_voice_end');
...@@ -277,7 +282,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -277,7 +282,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.count--; this.count--;
this.startPlay(); this.startPlay();
}, 3) }, 1)
} }
nextLayer() { nextLayer() {
this.touchForbid = true; this.touchForbid = true;
......
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