Commit e4471bfd authored by Tt's avatar Tt

修改

parent eb692f80
This diff is collapsed.
......@@ -58,7 +58,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
public layer_item_little: cc.Node = null;
_cantouch = null;
private list: Array<{ type, text, right, imgage, duration, content, audio, npcAudio }>;
private list: Array<{ type, text, right, imgage, duration, content, audio, npcAudio, npcPlay }>;
private recordFlag: number;//录音模式
private score: number;
private scoreList: Array<number>;
......@@ -81,6 +81,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private layers: Array<cc.Node>;
initView() {
pg.view.visible(pg.view.find(this, 'tip_record'), false);
pg.view.visible(pg.view.find(this, 'tip_again'), false);
pg.view.visible(pg.view.find(this, 'tip_nopic'), false);
}
......@@ -90,7 +91,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initListener() {
pg.view.touchOn(this.btn_last, this.preLayer, this);
pg.view.touchOn(this.btn_next, this.nextLayer, this);
pg.view.touchOn(this.btn_record, this.onTouchRecord, this);
pg.view.touchOn(pg.view.find(this.btn_record, 'bg'), this.onTouchRecord, this);
pg.view.touchOn(this.ani_npc, this.onPlayNpc, this);
let layout_btns = pg.view.find(this.btn_record, "mask/layout_btns");
......@@ -252,6 +253,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private recordAudioId: any;
async showRecorAudioPlay() {
if (!this.recordAudio) return;
this.touchForbid = false
let layout_btns = pg.view.find(this.btn_record, "mask/layout_btns");
let btn_right = pg.view.find(layout_btns, 'btn_right')
......@@ -263,8 +265,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.audio.playAudioByUrl(this.recordAudio, () => {
this.recordAudioId = null;
this.showRecorAudioPlayEnd().then(() => {
this.showRecorAudioPlayEnd(false).then(() => {
if (this.recording) return;
this.showNpcAudioPlay().then(() => {
if (this.recording) return;
this.showNpcAudioPlayEnd();
this.nextLayer();
})
......@@ -273,10 +277,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.recordAudioId = audioId;
})
}
showRecorAudioPlayEnd() {
showRecorAudioPlayEnd(clear) {
return new Promise((resolve, reject) => {
if (!this.recordAudio) return;
if (this.recordAudioId) {
cc.audioEngine.stopEffect(this.recordAudioId)
this.recordAudioId = null;
}
if (clear) {
this.showRecordHide();
return;
}
let layout_btns = pg.view.find(this.btn_record, "mask/layout_btns");
let btn_right = pg.view.find(layout_btns, 'btn_right')
let btn_play = pg.view.find(layout_btns, 'btn_play')
......@@ -285,16 +299,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
btn_play.active = true;
btn_stop.active = false;
if (this.recordAudioId) {
cc.audioEngine.stopEffect(this.recordAudioId)
this.recordAudioId = null;
}
// 播放文字内容
this.label_word.active = true;
pg.view.setString(this.label_word, this.recordAudioWord);
// 播放鼓励
this.ani_good.active = true;
pg.hw.playLocalAudio("right")
pg.view.playDBAnimation(this.ani_good, 'newAnimation', 1);
this._cantouch = false;
this.scheduleOnce(() => {
......@@ -315,6 +325,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
private npcAudioId: any;
showNpcAudioPlay() {
return new Promise((resolve, reject) => {
if (this.CurrentData.npcPlay) {
return resolve('');
}
this.CurrentData.npcPlay = true;
pg.view.playDBAnimation(this.ani_npc, 'newAnimation', 0);
pg.audio.playAudioByUrl(this.CurrentData.npcAudio, () => {
pg.view.playDBAnimation(this.ani_npc, 'newAnimation', 1);
......@@ -339,8 +353,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 停止播放录音
onTouchRecordStop() {
this.showRecorAudioPlayEnd().then(() => {
this.showRecorAudioPlayEnd(false).then(() => {
if (this.recording) return;
this.showNpcAudioPlay().then(() => {
if (this.recording) return;
this.showNpcAudioPlayEnd();
this.nextLayer();
})
......@@ -362,7 +378,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
async onTouchRecord() {
if (this.touchForbid) return;
if (this.recording) return;
if (this.recordAudio) return;
if (this.recordAudio) {
this.showRecorAudioPlayEnd(true);
}
this.recording = true;
this.recordAudio = '';
this.voiceTouchForbid = true;
......@@ -392,6 +410,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.recordAudio = data.audio;
this.recordAudioWord = data.text;
this.recording = false;
if (!this.recordAudioWord) {
pg.hw.playLocalAudio("tip")
let tip = pg.view.find(this, 'tip_again');
pg.view.visible(tip, true);
tip.opacity = 255;
cc.Tween.stopAllByTarget(tip)
cc.tween(tip).delay(0.8).to(0.5, { opacity: 0 }).start();
return;
}
this.showRecorAudioPlay();
}
private recordAudioWord: string;
......
......@@ -125,13 +125,13 @@
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="option.imageBig" (ngModelChange)="ngChange(i,j)">
<label nz-radio [nzValue]="1">
<span [style]="{color:option.imageBig== 1 ? '#169BD5':'#000'}">16:9比例</span>
<span [style]="{color:option.imageBig== 1 ? '#169BD5':'#000'}">4:3比例</span>
</label>
<label nz-radio [nzValue]="2">
<span [style]="{color:option.imageBig== 2 ? '#169BD5':'#000'}">2:1比例</span>
</label>
<label nz-radio [nzValue]="3">
<span [style]="{color:option.imageBig== 3 ? '#169BD5':'#000'}">4:3比例</span>
<span [style]="{color:option.imageBig== 3 ? '#169BD5':'#000'}">16:9比例</span>
</label>
</nz-radio-group>
</div>
......
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