Commit 2c21417e authored by Tt's avatar Tt

录音重置

parent 66a10e81
// pg.event.emit('layer_record_open', {
// letter: 'test',
// targetTime: 10
// })
import pg from "../../scene/pg_hy01_danci"; import pg from "../../scene/pg_hy01_danci";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
let win: any = window; let win: any = window;
...@@ -15,16 +21,13 @@ export default class LayerRecord extends cc.Component { ...@@ -15,16 +21,13 @@ export default class LayerRecord extends cc.Component {
btn_play.active = false; btn_play.active = false;
this.initEvent(); this.initEvent();
this.showVoiceWhite(); this.showVoiceWhite();
pg.event.emit('layer_record_setting', {
letter: 'test',
targetTime: 10
})
} }
private letter: string; private letter: string;
private targetTime: number; private targetTime: number;
private recordAudio: string; private recordAudio: string;
initEvent() { initEvent() {
pg.event.on('layer_record_setting', (data) => { pg.event.on('layer_record_open', (data) => {
this.layout_record.active = true;
this.letter = data.letter this.letter = data.letter
this.targetTime = data.targetTime this.targetTime = data.targetTime
}) })
...@@ -177,6 +180,7 @@ export default class LayerRecord extends cc.Component { ...@@ -177,6 +180,7 @@ export default class LayerRecord extends cc.Component {
this.recordAudio = data.audioUrl; this.recordAudio = data.audioUrl;
this.showPlay(); this.showPlay();
let score = data.result.overall; let score = data.result.overall;
this.layout_record.active = false;
pg.event.emit('layer_record_score', score); pg.event.emit('layer_record_score', score);
} }
} }
......
...@@ -6305,7 +6305,7 @@ ...@@ -6305,7 +6305,7 @@
"__id__": 158 "__id__": 158
} }
], ],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 194 "__id__": 194
...@@ -6394,7 +6394,7 @@ ...@@ -6394,7 +6394,7 @@
"__id__": 177 "__id__": 177
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 192 "__id__": 192
......
...@@ -109,7 +109,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -109,7 +109,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
startPlay() { startPlay() {
if (this.recordFlag) { if (this.recordFlag) {
this.layer_record.active = true; pg.event.emit('layer_record_open', {
letter: this.CurrentData.content,
targetTime: this.CurrentData.duration
})
} else { } else {
if (this.CurrentData.type.indexOf('audio') > -1) { if (this.CurrentData.type.indexOf('audio') > -1) {
pg.event.emit('img_voice_play_voice_start') pg.event.emit('img_voice_play_voice_start')
...@@ -125,7 +128,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -125,7 +128,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
} }
onRecorScore(score) { onRecorScore(score) {
this.layer_record.active = false;
if (score < 10) { if (score < 10) {
pg.event.once('layer_right_show_tryagain_end', () => { pg.event.once('layer_right_show_tryagain_end', () => {
this.tempScore += 1; this.tempScore += 1;
...@@ -138,7 +140,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -138,7 +140,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.event.emit('layer_coin_show_coin', 1) //1 2 3硬币数量 pg.event.emit('layer_coin_show_coin', 1) //1 2 3硬币数量
} else { } else {
if (this.recordFlag) { if (this.recordFlag) {
this.layer_record.active = true; pg.event.emit('layer_record_open', {
letter: this.CurrentData.content,
targetTime: this.CurrentData.duration
})
} }
} }
}) })
......
export const defaultData = export const defaultData =
{ {
"recordFlag": true, "recordFlag": true,
"title": "test", "title": "",
"audio_url": '',
npcTitle: "I show info",
npcAudio: "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3",
"questionText": "", "questionText": "",
"questionTextAudio": "", "questionTextAudio": "",
"questions": [ "questions": [
{ {
"questionAudio": "", "questionAudio": "", "duration": 120,
"duration": 120, "options": [{
"options": [ "type": "img",
{ "image": "http://staging-teach.cdn.ireadabc.com/09670073e1cbb685cf03e29958133c99.png", "audio": "", "text": "",
"type": "img_audio", "duration": 100, "content": "ceshi", "right": false
"image": "http://staging-teach.cdn.ireadabc.com/875862129c75a075b3d710f541258a00.png", }, { "type": "img_txt", "image": "http://staging-teach.cdn.ireadabc.com/b0b3c59954a6b8610182ef1fc5ba90c5.png", "audio": "", "text": "test", "duration": 10, "content": "test", "right": false }]
"audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", }], "bgAudio": "", "bgAudioName": "", "audioName": "", "npcTitle": "123", "npcAudio": "http://staging-teach.cdn.ireadabc.com/f96fcb73dc6b3dcf2ce71fe2ba76e4c3_l.mp3", "npcAudioName": "选项正确.mp3"
"text": "", "duration": 10, "content": "egg", "right": false
},
{
"type": "img_txt_audio", "image": "http://staging-teach.cdn.ireadabc.com/011cf423d6fd8760e810644ca6070e34.png", "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", "text": "hammer", "duration": 10, "content": "hammer", "right": false
},
{
"type": "img_txt_audio", "image": "http://staging-teach.cdn.ireadabc.com/befdc1801d93fd95b3a8ee7c7a2d2d05.png", "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", "text": "clound", "duration": 10, "content": "clound", "right": false, "audioName": "敲碎蛋的声音.mp3"
}]
}],
"bgAudio": "",
"bgAudioName": "",
"audioName": ""
} }
// {
// "recordFlag": true,
// "title": "test",
// "audio_url": '',
// npcTitle: "I show info",
// npcAudio: "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3",
// "questionText": "",
// "questionTextAudio": "",
// "questions": [
// {
// "questionAudio": "",
// "duration": 120,
// "options": [
// {
// "type": "img_audio",
// "image": "http://staging-teach.cdn.ireadabc.com/875862129c75a075b3d710f541258a00.png",
// "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3",
// "text": "", "duration": 10, "content": "egg", "right": false
// },
// {
// "type": "img_txt_audio", "image": "http://staging-teach.cdn.ireadabc.com/011cf423d6fd8760e810644ca6070e34.png", "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", "text": "hammer", "duration": 10, "content": "hammer", "right": false
// },
// {
// "type": "img_txt_audio", "image": "http://staging-teach.cdn.ireadabc.com/befdc1801d93fd95b3a8ee7c7a2d2d05.png", "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", "text": "clound", "duration": 10, "content": "clound", "right": false, "audioName": "敲碎蛋的声音.mp3"
// }]
// }],
// "bgAudio": "",
// "bgAudioName": "",
// "audioName": ""
// }
// { // {
// "recordFlag": true, // "recordFlag": true,
// "title": "test", // "title": "test",
......
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