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