Commit fe4733f9 authored by Tt's avatar Tt
parents e4471bfd 04baffd0
No preview for this file type
...@@ -76,6 +76,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -76,6 +76,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.scoreList = this.list.map(() => 3); this.scoreList = this.list.map(() => 3);
this.maxCurrent = 0; this.maxCurrent = 0;
this.layers = []; this.layers = [];
this.readyNext = false;
this.readyTime = 99999;
} }
private layers: Array<cc.Node>; private layers: Array<cc.Node>;
...@@ -92,6 +94,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -92,6 +94,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.touchOn(this.btn_last, this.preLayer, this); pg.view.touchOn(this.btn_last, this.preLayer, this);
pg.view.touchOn(this.btn_next, this.nextLayer, this); pg.view.touchOn(this.btn_next, this.nextLayer, this);
pg.view.touchOn(pg.view.find(this.btn_record, 'bg'), this.onTouchRecord, this); pg.view.touchOn(pg.view.find(this.btn_record, 'bg'), this.onTouchRecord, this);
pg.view.touchOn(this.btn_record, this.onTouchRecord, this);
pg.view.touchOn(this.img_npc, this.onPlayNpc, this);
pg.view.touchOn(this.ani_npc, this.onPlayNpc, this); pg.view.touchOn(this.ani_npc, this.onPlayNpc, this);
let layout_btns = pg.view.find(this.btn_record, "mask/layout_btns"); let layout_btns = pg.view.find(this.btn_record, "mask/layout_btns");
...@@ -172,9 +176,17 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -172,9 +176,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.btn_last.active = this.showLastNext > 0 && !!this.LastData; this.btn_last.active = this.showLastNext > 0 && !!this.LastData;
this.btn_next.active = this.showLastNext > 0 && !!this.NextData; this.btn_next.active = this.showLastNext > 0 && !!this.NextData;
} }
private readyNext: boolean;
private readyTime: number;
update(dt) { update(dt) {
if (!this.list) return; if (!this.list) return;
this.updateBtns(dt); this.updateBtns(dt);
this.readyTime -= dt;
if (this.readyNext && this.readyTime <= 0) {
this.readyNext = false;
this.readyTime = 999999;
this.nextLayer();
}
} }
//--------------------------------Record----------------------------- //--------------------------------Record-----------------------------
private recordAudio: string; private recordAudio: string;
...@@ -206,6 +218,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -206,6 +218,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
showRecordHide() { showRecordHide() {
this.showRecordWaitEnd(); this.showRecordWaitEnd();
this.img_npc.active = false;
this.showLastNext = 3;// 3秒显示时间 this.showLastNext = 3;// 3秒显示时间
let img_voice = pg.view.find(this.btn_record, "img_voice"); let img_voice = pg.view.find(this.btn_record, "img_voice");
img_voice.active = false; img_voice.active = false;
...@@ -254,6 +267,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -254,6 +267,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
async showRecorAudioPlay() { async showRecorAudioPlay() {
if (!this.recordAudio) return; if (!this.recordAudio) return;
this.touchForbid = false this.touchForbid = false
this.readyNext = false;
this.readyTime = 999999;
let layout_btns = pg.view.find(this.btn_record, "mask/layout_btns"); let layout_btns = pg.view.find(this.btn_record, "mask/layout_btns");
let btn_right = pg.view.find(layout_btns, 'btn_right') let btn_right = pg.view.find(layout_btns, 'btn_right')
...@@ -270,7 +285,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -270,7 +285,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.showNpcAudioPlay().then(() => { this.showNpcAudioPlay().then(() => {
if (this.recording) return; if (this.recording) return;
this.showNpcAudioPlayEnd(); this.showNpcAudioPlayEnd();
this.nextLayer(); this.readyNext = true;
this.readyTime = 3;
}) })
}) })
}, audioId => { }, audioId => {
...@@ -321,6 +337,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -321,6 +337,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
ani_good: cc.Node = null; ani_good: cc.Node = null;
@property(cc.Node) @property(cc.Node)
ani_npc: cc.Node = null; ani_npc: cc.Node = null;
@property(cc.Node)
img_npc: cc.Node = null;
private npcAudioId: any; private npcAudioId: any;
showNpcAudioPlay() { showNpcAudioPlay() {
...@@ -329,9 +347,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -329,9 +347,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
return resolve(''); return resolve('');
} }
this.CurrentData.npcPlay = true; this.CurrentData.npcPlay = true;
this.ani_npc.active = true;
this.img_npc.active = false;
pg.view.playDBAnimation(this.ani_npc, 'newAnimation', 0); pg.view.playDBAnimation(this.ani_npc, 'newAnimation', 0);
pg.audio.playAudioByUrl(this.CurrentData.npcAudio, () => { pg.audio.playAudioByUrl(this.CurrentData.npcAudio, () => {
pg.view.playDBAnimation(this.ani_npc, 'newAnimation', 1); this.ani_npc.active = false;
this.img_npc.active = true;
this.npcAudioId = null; this.npcAudioId = null;
resolve(''); resolve('');
}, audioId => { }, audioId => {
...@@ -355,10 +376,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -355,10 +376,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
onTouchRecordStop() { onTouchRecordStop() {
this.showRecorAudioPlayEnd(false).then(() => { this.showRecorAudioPlayEnd(false).then(() => {
if (this.recording) return; if (this.recording) return;
this.showNpcAudioPlay().then(() => { this.readyNext = false;
if (this.recording) return; this.readyTime = 999999;
this.showNpcAudioPlayEnd(); this.showRecorAudioPlayEnd(false).then(() => {
this.nextLayer(); this.showNpcAudioPlay().then(() => {
if (this.recording) return;
this.showNpcAudioPlayEnd();
this.readyNext = true;
this.readyTime = 3;
})
}) })
}) })
} }
...@@ -368,10 +394,13 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -368,10 +394,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.showRecorAudioPlay(); this.showRecorAudioPlay();
} }
onPlayNpc() { onPlayNpc() {
this.readyNext = false;
this.readyTime = 999999;
this.showNpcAudioPlayEnd(); this.showNpcAudioPlayEnd();
this.showNpcAudioPlay().then(() => { this.showNpcAudioPlay().then(() => {
this.showNpcAudioPlayEnd(); this.showNpcAudioPlayEnd();
this.nextLayer(); this.readyNext = true;
this.readyTime = 3;
}) })
} }
//按钮触发,使用的方法 //按钮触发,使用的方法
...@@ -396,7 +425,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -396,7 +425,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.showRecordEnd(); this.showRecordEnd();
let testData = { let testData = {
"text": "Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.", "text": "Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.",
"audio": "https://staging-teach.cdn.ireadabc.com/6ee3ccaa831a884f02c6a75c6f647cb5.wav" "audioUrl": "https://staging-teach.cdn.ireadabc.com/6ee3ccaa831a884f02c6a75c6f647cb5.wav"
} }
if (!courseware) return this.recrodEnd(testData) if (!courseware) return this.recrodEnd(testData)
courseware && courseware.stopRecord(0, (data) => { courseware && courseware.stopRecord(0, (data) => {
...@@ -407,7 +436,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -407,7 +436,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
async recrodEnd(data) { async recrodEnd(data) {
this.voiceTouchForbid = false; this.voiceTouchForbid = false;
this.recordAudio = data.audio; this.recordAudio = data.audioUrl;
this.recordAudioWord = data.text; this.recordAudioWord = data.text;
this.recording = false; this.recording = false;
if (!this.recordAudioWord) { if (!this.recordAudioWord) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1065, "width": 1065,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1372, "width": 1372,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1270, "width": 1270,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 592, "width": 592,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1920, "width": 1920,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1920, "width": 1920,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 316, "width": 316,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 478, "width": 478,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 443, "width": 443,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 165, "width": 165,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 177, "width": 177,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 103, "width": 103,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 189, "width": 189,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 103, "width": 103,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 110, "width": 110,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 110, "width": 110,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 110, "width": 110,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 132, "width": 132,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 177, "width": 177,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 177, "width": 177,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 177, "width": 177,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 59, "width": 59,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 59, "width": 59,
......
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