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
......@@ -90,19 +90,19 @@
"__id__": 131
},
{
"__id__": 140
"__id__": 147
}
],
"_active": true,
"_components": [
{
"__id__": 152
"__id__": 159
},
{
"__id__": 153
"__id__": 160
},
{
"__id__": 154
"__id__": 161
}
],
"_prefab": null,
......@@ -5026,7 +5026,7 @@
"_N$string": "Label",
"_fontSize": 130,
"_lineHeight": 130,
"_enableWrapText": true,
"_enableWrapText": false,
"_N$file": {
"__uuid__": "0d5713b4-8dc6-4b91-ba66-b59f288caf57"
},
......@@ -5805,7 +5805,7 @@
"__id__": 129
}
],
"_active": true,
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
......@@ -6452,7 +6452,10 @@
"__id__": 134
},
{
"__id__": 137
"__id__": 141
},
{
"__id__": 144
}
],
"_active": false,
......@@ -6607,6 +6610,322 @@
"_N$enableBatch": false,
"_id": "bbP5sFt6hIfKlAWuzThBNz"
},
{
"__type__": "cc.Node",
"_name": "bg_countdown",
"_objFlags": 0,
"_parent": {
"__id__": 131
},
"_children": [
{
"__id__": 135
},
{
"__id__": 137
}
],
"_active": false,
"_components": [
{
"__id__": 140
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 106,
"height": 88
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
501.016,
-309.673,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "4b4uge+flM77RJTZNQsIzG"
},
{
"__type__": "cc.Node",
"_name": "time",
"_objFlags": 0,
"_parent": {
"__id__": 134
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 136
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 213,
"b": 150,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 45.9,
"height": 63
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
17.401,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "d4Td1GUVRNFpCE/T29XTVY"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 135
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "20",
"_N$string": "20",
"_fontSize": 50,
"_lineHeight": 50,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "e8b4fbb1-1dc1-427b-b27a-9cf2ccfefe93"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "3cuxCa1B1DY6iEOdExq+CD"
},
{
"__type__": "cc.Node",
"_name": "time2",
"_objFlags": 0,
"_parent": {
"__id__": 134
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 138
},
{
"__id__": 139
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 131,
"b": 103,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 33.379999999999995,
"height": 84.64
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
17.401,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "03iQkZsodC/69znFL9hqj3"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "5",
"_N$string": "5",
"_fontSize": 64,
"_lineHeight": 64,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "e8b4fbb1-1dc1-427b-b27a-9cf2ccfefe93"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "73+Pw4kUdLdI/jA7OxP5jG"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
},
"_enabled": true,
"_color": {
"__type__": "cc.Color",
"r": 144,
"g": 20,
"b": 20,
"a": 255
},
"_width": 2,
"_id": "80TlMShBNEfLIBMd1fMjCn"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 134
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a3f08beb-caa8-41fc-b029-3834d5436616"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "cdrUL71eNAZLuCjGftYqlc"
},
{
"__type__": "cc.Node",
"_name": "btn_start",
......@@ -6618,10 +6937,10 @@
"_active": true,
"_components": [
{
"__id__": 135
"__id__": 142
},
{
"__id__": 136
"__id__": 143
}
],
"_prefab": null,
......@@ -6677,7 +6996,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 134
"__id__": 141
},
"_enabled": true,
"_materials": [
......@@ -6709,7 +7028,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 134
"__id__": 141
},
"_enabled": true,
"_normalMaterial": null,
......@@ -6783,10 +7102,10 @@
"_active": true,
"_components": [
{
"__id__": 138
"__id__": 145
},
{
"__id__": 139
"__id__": 146
}
],
"_prefab": null,
......@@ -6842,7 +7161,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
"__id__": 144
},
"_enabled": true,
"_materials": [
......@@ -6874,7 +7193,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
"__id__": 144
},
"_enabled": true,
"_normalMaterial": null,
......@@ -6946,19 +7265,19 @@
},
"_children": [
{
"__id__": 141
"__id__": 148
},
{
"__id__": 144
"__id__": 151
},
{
"__id__": 146
"__id__": 153
},
{
"__id__": 148
"__id__": 155
},
{
"__id__": 150
"__id__": 157
}
],
"_active": false,
......@@ -7016,16 +7335,16 @@
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 140
"__id__": 147
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 142
"__id__": 149
},
{
"__id__": 143
"__id__": 150
}
],
"_prefab": null,
......@@ -7081,7 +7400,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 141
"__id__": 148
},
"_enabled": true,
"_materials": [
......@@ -7113,7 +7432,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 141
"__id__": 148
},
"_enabled": true,
"_id": "216u5RnsFH1riSR6qX58J/"
......@@ -7123,13 +7442,13 @@
"_name": "img_light",
"_objFlags": 0,
"_parent": {
"__id__": 140
"__id__": 147
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 145
"__id__": 152
}
],
"_prefab": null,
......@@ -7185,7 +7504,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 144
"__id__": 151
},
"_enabled": true,
"_materials": [
......@@ -7217,13 +7536,13 @@
"_name": "img_co",
"_objFlags": 0,
"_parent": {
"__id__": 140
"__id__": 147
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 147
"__id__": 154
}
],
"_prefab": null,
......@@ -7279,7 +7598,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 146
"__id__": 153
},
"_enabled": true,
"_materials": [
......@@ -7311,13 +7630,13 @@
"_name": "img_gj",
"_objFlags": 0,
"_parent": {
"__id__": 140
"__id__": 147
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 149
"__id__": 156
}
],
"_prefab": null,
......@@ -7373,7 +7692,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 148
"__id__": 155
},
"_enabled": true,
"_materials": [
......@@ -7405,13 +7724,13 @@
"_name": "img_ta",
"_objFlags": 0,
"_parent": {
"__id__": 140
"__id__": 147
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 151
"__id__": 158
}
],
"_prefab": null,
......@@ -7467,7 +7786,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 150
"__id__": 157
},
"_enabled": true,
"_materials": [
......@@ -7560,11 +7879,12 @@
"__id__": 131
},
"layout_tip": {
"__id__": 140
"__id__": 147
},
"item_gun": {
"__id__": 42
},
"bg_countdown": null,
"item_left": {
"__id__": 70
},
......
......@@ -81,6 +81,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
layout_tip: cc.Node = null;
@property(cc.Node)
item_gun: cc.Node = null;
@property(cc.Node)
bg_countdown: cc.Node = null;
@property(cc.Node)
item_left: cc.Node = null;
......@@ -96,9 +98,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private layout_start: cc.Node;
private audioId: any;
private countDown: number = 999999;
private timeCount: number;
private startCount = 20;
async initView() {
cc.audioEngine.stopAllEffects();
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");
this.layout_start.active = true;
......@@ -447,11 +454,43 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
update(dt) {
if (Game.getIns().state != GAME_STATE.RUNNING) return;
this.updateTime(dt);
if (this.touching) return;
if (this.fishLen < 5) this.count++;
let fish = this.getFishByCount(this.count);
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) {
if (!state) {
this.layout_tip.active = false;
......@@ -514,6 +553,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
btn_stop.active = true;
ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 1;
cc.audioEngine.stopAllEffects();
this.bg_countdown.active = true;
this.countDown = this.startCount;
let end = pg.view.find(this, "end");
let bg_tryagain = pg.view.find(end, "bg_tryagain")
......@@ -531,6 +572,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
ske.getComponent(dragonBones.ArmatureDisplay).timeScale = 10000;
btn_stop.active = false;
btn_start.active = false;
this.bg_countdown.active = false;
this.countDown = 999999;
let testData = {
"dtLastResponse": "2021-09-17 13:36:26:109",
"refText": "I haven't found anything out about him yet.",
......@@ -547,6 +591,103 @@ export default class SceneComponent extends MyCocosSceneComponent {
"duration": "6.779",
"rear_tone": "fall",
"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",
"applicationId": "154838659000009e"
......@@ -563,12 +704,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
async recrodEnd(data) {
Game.getIns().player.addVoice(data);
let score = data.result.overall;
if (score >= 70) {
let isSuccess = this.checkWords(data);
if (score >= 70 && isSuccess) {
//提示成功
this.updateTips(TIPS_STATE.GOOD);
Game.getIns().player.addRight();
this.touchFishs.push(this.touchData);
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 {
//提示失败
if (this.tryData.some(td => td.id == this.touchData.id)) {
......@@ -611,6 +760,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
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