Commit 558892ae authored by yu's avatar yu

倒计时,测评分数

parent 1669d13f
{
"ver": "1.1.0",
"uuid": "e8b4fbb1-1dc1-427b-b27a-9cf2ccfefe93",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
...@@ -81,6 +81,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -81,6 +81,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
layout_tip: cc.Node = null; layout_tip: cc.Node = null;
@property(cc.Node) @property(cc.Node)
item_gun: cc.Node = null; item_gun: cc.Node = null;
@property(cc.Node)
bg_countdown: cc.Node = null;
@property(cc.Node) @property(cc.Node)
item_left: cc.Node = null; item_left: cc.Node = null;
...@@ -96,9 +98,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -96,9 +98,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
private layout_start: cc.Node; private layout_start: cc.Node;
private audioId: any; private audioId: any;
private countDown: number = 999999;
private timeCount: number;
private startCount = 20;
async initView() { async initView() {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
this.layout_start = pg.view.find(this, "layout_start"); this.layout_start = pg.view.find(this, "layout_start");
this.bg_countdown = pg.view.find(this.layout_speak, "bg_countdown");
let touch = pg.view.find(this, "layout_start/touch"); let touch = pg.view.find(this, "layout_start/touch");
this.layout_start.active = true; this.layout_start.active = true;
...@@ -447,11 +454,43 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -447,11 +454,43 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
update(dt) { update(dt) {
if (Game.getIns().state != GAME_STATE.RUNNING) return; if (Game.getIns().state != GAME_STATE.RUNNING) return;
this.updateTime(dt);
if (this.touching) return; if (this.touching) return;
if (this.fishLen < 5) this.count++; if (this.fishLen < 5) this.count++;
let fish = this.getFishByCount(this.count); let fish = this.getFishByCount(this.count);
if (fish) this.fishs.push(fish); if (fish) this.fishs.push(fish);
} }
updateTime(dt) {
let time = cc.find("time", this.bg_countdown);
let time2 = cc.find("time2", this.bg_countdown);
if (this.countDown <= 0) {
this.onTouchRecordEnd();
this.bg_countdown.active = false;
cc.Tween.stopAllByTarget(time2)
return;
}
this.countDown = this.countDown - dt;
if (this.countDown < 6) {
let count = Math.floor(this.countDown);
time.active = false;
time2.active = true;
time2.getComponent(cc.Label).string = "" + parseInt("" + this.countDown);
if (count != this.timeCount) {
this.timeCount = count;
cc.tween(time2)
.to(0.3, { scale: 1.1 })
.to(0.3, { scale: 1 })
.to(0.3, { scale: 0.9 })
.start()
}
} else {
time2.active = false;
time.active = true;
time.getComponent(cc.Label).string = "" + parseInt("" + this.countDown);
}
}
updateTips(state?: TIPS_STATE) { updateTips(state?: TIPS_STATE) {
if (!state) { if (!state) {
this.layout_tip.active = false; this.layout_tip.active = false;
...@@ -514,6 +553,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -514,6 +553,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
btn_stop.active = true; btn_stop.active = true;
ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 1; ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 1;
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
this.bg_countdown.active = true;
this.countDown = this.startCount;
let end = pg.view.find(this, "end"); let end = pg.view.find(this, "end");
let bg_tryagain = pg.view.find(end, "bg_tryagain") let bg_tryagain = pg.view.find(end, "bg_tryagain")
...@@ -531,6 +572,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -531,6 +572,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 10000; ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 10000;
btn_stop.active = false; btn_stop.active = false;
btn_start.active = false; btn_start.active = false;
this.bg_countdown.active = false;
this.countDown = 999999;
let testData = { let testData = {
"dtLastResponse": "2021-09-17 13:36:26:109", "dtLastResponse": "2021-09-17 13:36:26:109",
"refText": "I haven't found anything out about him yet.", "refText": "I haven't found anything out about him yet.",
...@@ -547,6 +591,103 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -547,6 +591,103 @@ export default class SceneComponent extends MyCocosSceneComponent {
"duration": "6.779", "duration": "6.779",
"rear_tone": "fall", "rear_tone": "fall",
"speed": 96, "speed": 96,
"words": [
{
"phonemes": [
{
"phoneme": "w",
"pronunciation": 55,
"span": {
"end": 95,
"start": 88
}
},
{
"phoneme": "ɛ",
"pronunciation": 100,
"span": {
"end": 107,
"start": 95
}
},
{
"phoneme": "r",
"pronunciation": 99,
"span": {
"end": 123,
"start": 107
}
}
],
"phonics": [
{
"overall": 85,
"phoneme": [
"w",
"ɛ",
"r"
],
"spell": "Where"
}
],
"scores": {
"overall": 80,
"pronunciation": 92
},
"span": {
"end": 123,
"start": 88
},
"word": "Where"
}, {
"phonemes": [
{
"phoneme": "w",
"pronunciation": 55,
"span": {
"end": 95,
"start": 88
}
},
{
"phoneme": "ɛ",
"pronunciation": 100,
"span": {
"end": 107,
"start": 95
}
},
{
"phoneme": "r",
"pronunciation": 99,
"span": {
"end": 123,
"start": 107
}
}
],
"phonics": [
{
"overall": 85,
"phoneme": [
"w",
"ɛ",
"r"
],
"spell": "Where"
}
],
"scores": {
"overall": 10,
"pronunciation": 92
},
"span": {
"end": 123,
"start": 88
},
"word": "Where"
}
]
}, },
"tokenId": "6144295408558b08dd000001", "tokenId": "6144295408558b08dd000001",
"applicationId": "154838659000009e" "applicationId": "154838659000009e"
...@@ -563,12 +704,20 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -563,12 +704,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
async recrodEnd(data) { async recrodEnd(data) {
Game.getIns().player.addVoice(data); Game.getIns().player.addVoice(data);
let score = data.result.overall; let score = data.result.overall;
if (score >= 70) { let isSuccess = this.checkWords(data);
if (score >= 70 && isSuccess) {
//提示成功 //提示成功
this.updateTips(TIPS_STATE.GOOD); this.updateTips(TIPS_STATE.GOOD);
Game.getIns().player.addRight(); Game.getIns().player.addRight();
this.touchFishs.push(this.touchData); this.touchFishs.push(this.touchData);
this.tryAgain = false; this.tryAgain = false;
await pg.time.delay(3);
this.playCard(null);
this.updateLayoutSpeak(true);
this.updateTips(null);
this.touching = false;
Game.getIns().state = GAME_STATE.OVER
return pg.event.emit("game_time_over");
} else { } else {
//提示失败 //提示失败
if (this.tryData.some(td => td.id == this.touchData.id)) { if (this.tryData.some(td => td.id == this.touchData.id)) {
...@@ -611,6 +760,17 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -611,6 +760,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.audioEngine.setFinishCallback(id, () => { resolve(id); }); cc.audioEngine.setFinishCallback(id, () => { resolve(id); });
}) })
} }
private checkWords(data) {
let words = data.result.words;
let isSuccess = true;
for (const key in words) {
if (Object.prototype.hasOwnProperty.call(words, key)) {
const element = words[key];
if (element.scores.overall <= 40) return isSuccess = false;
}
}
return isSuccess;
}
} }
{
"ver": "2.3.5",
"uuid": "67361827-5c47-490e-a223-95d13d0d6a31",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 88,
"platformSettings": {},
"subMetas": {
"bg_countdown": {
"ver": "1.0.4",
"uuid": "a3f08beb-caa8-41fc-b029-3834d5436616",
"rawTextureUuid": "67361827-5c47-490e-a223-95d13d0d6a31",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 106,
"height": 88,
"rawWidth": 106,
"rawHeight": 88,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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