Commit 9db2a3fa authored by yu's avatar yu

1

parent ecd7466f
......@@ -32,6 +32,10 @@ export default class ImgVoice extends cc.Component {
this.schedule(this.playVoiceRunning, 0.3)
}
playVoiceRunning() {
if (!this.img_npc_voice) {
this.unschedule(this.playVoiceRunning);
return;
}
this.playVoiceCount++;
let p1 = this.img_npc_voice.getChildByName('p1')
let p2 = this.img_npc_voice.getChildByName('p2')
......
// pg.event.emit('layer_record_open', {
// letter: 'test',
// targetTime: 10
// targetTime: 10,
// reset : false
// })
// pg.event.emit('layer_record_close')
//pg.event.on('layer_record_start_record',()=>{});
//pg.event.on('layer_record_end_record',()=>{});
import pg from "../../scene/tool/pg_hy03_zadan";
const { ccclass, property } = cc._decorator;
let win: any = window;
......@@ -24,17 +26,19 @@ export default class LayerRecord extends cc.Component {
btn_play.active = false;
this.initEvent();
this.showVoiceWhite();
this.recording = false;
}
private letter: string;
private targetTime: number;
private recordAudio: string;
private recording;
initEvent() {
pg.event.on('layer_record_open', (data) => {
this.layout_record.active = true;
this.letter = data.letter
this.targetTime = data.targetTime
if (data.reset) {
this.recordAudio = null;
this.showPlay();
}
})
pg.event.on('layer_record_close', (data) => {
this.layout_record.active = false;
......@@ -45,8 +49,9 @@ export default class LayerRecord extends cc.Component {
})
let btn_record = pg.view.find(this.layout_record, 'btn_record');
let btn_play = pg.view.find(this.layout_record, 'btn_play');
btn_record.on(cc.Node.EventType.TOUCH_END, 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.onTouchRecordClick, this);
btn_play.on(cc.Node.EventType.TOUCH_END, this.onTouchPlayRecord, this);
}
......@@ -70,8 +75,6 @@ export default class LayerRecord extends cc.Component {
record_time.getComponent(cc.Sprite).fillRange = percent;
if (percent == 0) {
this.showTimeEnd();
this.onTouchRecordEnd();
this.recording = false;
}
}
showTimeEnd() {
......@@ -146,13 +149,17 @@ export default class LayerRecord extends cc.Component {
protected update(dt: number): void {
this.showTimeUpdate();
}
//按钮触发,使用的方法
async onTouchRecord() {
if(this.recording){
private recording: boolean;
onTouchRecordClick() {
if (this.recording) {
this.onTouchRecordEnd();
this.recording = false;
return;
} else {
this.onTouchRecord();
}
}
//按钮触发,使用的方法
async onTouchRecord() {
this.recording = true;
this.recordAudio = '';
this.showPlay();
......@@ -199,6 +206,7 @@ export default class LayerRecord extends cc.Component {
}); //结束录音
}
async recrodEnd(data) {
this.recording = false;
this.recordAudio = data.audioUrl;
this.showPlay();
let score = data.result.overall;
......
{
"ver": "1.1.0",
"uuid": "d23a8ad9-9272-4969-b238-60ef42f16e67",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
......@@ -139,7 +139,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else {
pg.event.emit('layer_record_open', {
letter: self.touchData.txt,
targetTime: self.touchData.time
targetTime: self.touchData.time,
reset: false
})
}
})
......@@ -208,7 +209,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
broken.active = true;
await pg.time.delay(1);
this.playCard(this.touchData);
pg.event.emit("layer_record_open", { letter: eggData.txt, targetTime: eggData.time });
pg.event.emit("layer_record_open", { letter: eggData.txt, targetTime: eggData.time, reset: true });
})
});
this.eggArrowAction(egg);
......
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