Commit e4471bfd authored by Tt's avatar Tt

修改

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