Commit eb715451 authored by Tt's avatar Tt

1

parent 526f4bbe
...@@ -193,6 +193,7 @@ export default class LayerRecord extends cc.Component { ...@@ -193,6 +193,7 @@ export default class LayerRecord extends cc.Component {
}); //结束录音 }); //结束录音
} }
async recrodEnd(data) { async recrodEnd(data) {
pg.hw.addRecord(data)
this.recordAudio = data.audioUrl; this.recordAudio = data.audioUrl;
this.showPlay(); this.showPlay();
let score = data.result.overall; let score = data.result.overall;
......
...@@ -83,6 +83,27 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -83,6 +83,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.resetView(); this.resetView();
this.initGame(); this.initGame();
} }
sendData(score) {
return new Promise(res => {
let upData: any = {
word_count: this.data.word_count,
sentence_count: this.data.sentence_count,
zi_count: this.data.zi_count,
score: score,
};
let recordList = pg.hw.getRecord();
if (recordList && recordList.length > 0) {
upData.recordList = recordList
}
const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
console.log('upload->' + JSON.stringify(upData))
middleLayer.onHomeworkFinish(upData, () => {
res('');
})
})
}
gameOver() { gameOver() {
// pg.event.once('layer_ending_touch_replay', () => { // pg.event.once('layer_ending_touch_replay', () => {
// this.replay(); // this.replay();
...@@ -90,6 +111,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -90,6 +111,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// pg.event.emit('layer_ending_show', { coin: this.data.questions.length * 3 }) // pg.event.emit('layer_ending_show', { coin: this.data.questions.length * 3 })
const middleLayer = cc.find('middleLayer').getComponent('middleLayer'); const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
middleLayer.saveGolds(this.data.questions.length * 3); // 保存金币数量;num 是获得金币的数量,数字类型; middleLayer.saveGolds(this.data.questions.length * 3); // 保存金币数量;num 是获得金币的数量,数字类型;
this.sendData(this.data.questions.length * 3);
middleLayer.goNextPage(); // 跳转到下一页 middleLayer.goNextPage(); // 跳转到下一页
} }
private rightList: Array<any>; private rightList: Array<any>;
......
...@@ -655,6 +655,13 @@ let pg = { ...@@ -655,6 +655,13 @@ let pg = {
} }
}, },
hw: { hw: {
records: [],
addRecord(data) {
pg.hw.records.push(data)
},
getRecord() {
return pg.hw.records.concat();
},
playLocalAudio(audioName, loop = false) { playLocalAudio(audioName, loop = false) {
console.log("play audio->" + audioName); console.log("play audio->" + audioName);
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource); const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
......
...@@ -91,6 +91,14 @@ ...@@ -91,6 +91,14 @@
<span>{{ item.npcAudioName}}</span> <span>{{ item.npcAudioName}}</span>
</div> </div>
</div> </div>
<span style="font-size: 20px;">掌握单词数: </span>
<input type="text" nz-input [(ngModel)]="item.word_count" (blur)="save()">
<span style="font-size: 20px;">掌握短语数: </span>
<input type="text" nz-input [(ngModel)]="item.sentence_count" (blur)="save()">
<span style="font-size: 20px;">掌握字数: </span>
<input type="text" nz-input [(ngModel)]="item.zi_count" (blur)="save()">
</div> </div>
<!-- <div class="border-dashed" style="margin: 20px;width: 1000px;"> <!-- <div class="border-dashed" style="margin: 20px;width: 1000px;">
<span style="font-size: 20px;">标题: </span> <span style="font-size: 20px;">标题: </span>
......
...@@ -26,6 +26,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -26,6 +26,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}], }],
bgAudio: "", bgAudio: "",
bgAudioName: "", bgAudioName: "",
word_count: '0',
sentence_count: '0',
zi_count: '0',
audioName: "" audioName: ""
}; };
...@@ -50,6 +53,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -50,6 +53,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
if (!this.item.npcTitle) this.item.npcTitle = ''; if (!this.item.npcTitle) this.item.npcTitle = '';
if (!this.item.npcAudio) this.item.npcAudio = ''; if (!this.item.npcAudio) this.item.npcAudio = '';
if (!this.item.npcAudioName) this.item.npcAudioName = ''; if (!this.item.npcAudioName) this.item.npcAudioName = '';
if (!this.item.word_count) this.item.word_count = '0';
if (!this.item.sentence_count) this.item.sentence_count = '0';
if (!this.item.zi_count) this.item.zi_count = '0';
} }
removeoption(i, j) { removeoption(i, j) {
......
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