Commit bf10a216 authored by yu's avatar yu

5.20调整

parent e7871900
{
"ver": "2.0.1",
"uuid": "c560f528-e166-4884-a854-a9b03f53c904",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
...@@ -100,6 +100,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -100,6 +100,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.layout_start = pg.view.find(this, "layout_start"); this.layout_start = pg.view.find(this, "layout_start");
this.layout_start.active = true; this.layout_start.active = true;
let desc = this.layout_start.getChildByName("desc");
desc.getComponent(cc.Label).string = Game.getIns().questionText;
this.audioId = await pg.audio.playAudioByUrl(Game.getIns().question.audio); this.audioId = await pg.audio.playAudioByUrl(Game.getIns().question.audio);
if (this.audioId > -1 && Game.getIns().state == GAME_STATE.RUNNING) { if (this.audioId > -1 && Game.getIns().state == GAME_STATE.RUNNING) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
...@@ -311,9 +313,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -311,9 +313,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
let layout_txt = pg.view.find(this.layout_card, "layout_txt"); let layout_txt = pg.view.find(this.layout_card, "layout_txt");
let layout_img = pg.view.find(this.layout_card, "layout_img"); let layout_img = pg.view.find(this.layout_card, "layout_img");
let bg_gray = pg.view.find(this.layout_card, 'bg_gray'); let bg_gray = pg.view.find(this.layout_card, 'bg_gray');
let touch = pg.view.find(this.layout_card, 'touch');
layout_txt.active = false; layout_txt.active = false;
layout_img.active = false; layout_img.active = false;
bg_gray.active = true; bg_gray.active = true;
touch.active = true;
let layout = layout_txt; let layout = layout_txt;
if (data.type == "txt") { if (data.type == "txt") {
pg.view.setString(pg.view.find(layout_txt, 'desc'), data.txt) pg.view.setString(pg.view.find(layout_txt, 'desc'), data.txt)
...@@ -325,6 +329,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -325,6 +329,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playLocalAudio("card").then(() => { this.playLocalAudio("card").then(() => {
pg.audio.playAudioByUrl(data.audioUrl); pg.audio.playAudioByUrl(data.audioUrl);
}) })
touch.off(cc.Node.EventType.TOUCH_END);
touch.on(cc.Node.EventType.TOUCH_END, () => {
pg.audio.playAudioByUrl(data.audioUrl);
})
layout.active = true; layout.active = true;
layout.opacity = 255; layout.opacity = 255;
layout.scale = 0.1; layout.scale = 0.1;
...@@ -489,6 +497,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -489,6 +497,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
//按钮触发,使用的方法 //按钮触发,使用的方法
async onTouchRecord() { async onTouchRecord() {
this.playLocalAudio("record")
let ske = pg.view.find(this.layout_speak, 'speak_ske'); let ske = pg.view.find(this.layout_speak, 'speak_ske');
let btn_start = pg.view.find(this.layout_speak, 'btn_start'); let btn_start = pg.view.find(this.layout_speak, 'btn_start');
let btn_stop = pg.view.find(this.layout_speak, 'btn_stop'); let btn_stop = pg.view.find(this.layout_speak, 'btn_stop');
...@@ -505,6 +514,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -505,6 +514,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
courseware && courseware.startTest(this.touchData.txt); //开始录音 courseware && courseware.startTest(this.touchData.txt); //开始录音
} }
async onTouchRecordEnd() { async onTouchRecordEnd() {
this.playLocalAudio("record")
let ske = pg.view.find(this.layout_speak, 'speak_ske'); let ske = pg.view.find(this.layout_speak, 'speak_ske');
let btn_start = pg.view.find(this.layout_speak, 'btn_start'); let btn_start = pg.view.find(this.layout_speak, 'btn_start');
let btn_stop = pg.view.find(this.layout_speak, 'btn_stop'); let btn_stop = pg.view.find(this.layout_speak, 'btn_stop');
...@@ -540,6 +550,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -540,6 +550,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}); //结束录音 }); //结束录音
} }
private tryData: Array<Option>; private tryData: Array<Option>;
private tryAgain: boolean = false;
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;
...@@ -548,22 +559,30 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -548,22 +559,30 @@ export default class SceneComponent extends MyCocosSceneComponent {
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;
} else { } else {
//提示失败 //提示失败
if (this.tryData.some(td => td.id == this.touchData.id)) { if (this.tryData.some(td => td.id == this.touchData.id)) {
this.updateTips(TIPS_STATE.COM); this.updateTips(TIPS_STATE.COM);
this.touchFishs.push(this.touchData); this.touchFishs.push(this.touchData);
this.tryAgain = false;
} else { } else {
this.updateTips(TIPS_STATE.TRY); this.updateTips(TIPS_STATE.TRY);
this.tryData.push(this.touchData); this.tryData.push(this.touchData);
this.viewFishs = this.viewFishs.filter(v => v.id != this.touchData.id); this.viewFishs = this.viewFishs.filter(v => v.id != this.touchData.id);
this.tryAgain = this.tryAgain ? false : true;
} }
} }
await pg.time.delay(3); await pg.time.delay(3);
this.updateTips(null); this.updateTips(null);
this.playCard(null); if (this.tryAgain) {
this.updateLayoutSpeak(true) this.playCard(this.touchData);
this.touching = false; this.updateLayoutSpeak()
} else {
this.playCard(null);
this.updateLayoutSpeak(true)
this.touching = false;
}
} }
......
...@@ -129,10 +129,12 @@ export default class Game { ...@@ -129,10 +129,12 @@ export default class Game {
public singleGame: boolean; public singleGame: boolean;
public question: { text, audio }; public question: { text, audio };
public title: string; public title: string;
public questionText: string;
public init(data) { public init(data) {
this.singleGame = !data.onlineFlg; this.singleGame = !data.onlineFlg;
this.question = { text: data.questionText, audio: data.questionTextAudio }; this.question = { text: data.questionText, audio: data.questionTextAudio };
this.title = data.title; this.title = data.title;
this.questionText = data.questionText;
this.start = false; this.start = false;
this.lists = []; this.lists = [];
this.data = data.questions; this.data = data.questions;
......
export const defaultData = { export const defaultData = {
"onlineFlg": false, "title": "热气球大战",
"title": "标题标题", "questionText": "可恶的小偷将魔法卡牌藏在热气球里,准备偷走!快击落热气球,夺回魔法卡牌。游戏开始,请点击弹弓,发射小球,击落热气球,魔法卡牌就会掉落下来。请仔细观察魔法卡牌,并大声说出魔法咒语。魔法咒语正确,你将获得该张魔法卡牌。游戏结束后,根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!",
"questionText": "题目说明题目说明题目说明题目说明题目说明题目说明题目说明题目说明题目说明题目说明题目说明题目说明", "questionTextAudio": "https://staging-teach.cdn.ireadabc.com/3152e0ea17b07406a002b2c05028b0cc.mp3",
"questionTextAudio": "http://staging-teach.cdn.ireadabc.com/c0e467e1950cb24b1e581737a1344cb4.mp3",
"questions": [ "questions": [
{ {
"options": [ "options": [
{ {
"type": "txt", "type": "img",
"image": "", "image": "https://staging-teach.cdn.ireadabc.com/1832bc553f77f876e0bba64062bd6b38.jpg",
"audio": "http://staging-teach.cdn.ireadabc.com/c08af4f22c71ad8b3d8786a837787ac9.mp3", "audio": "https://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
"text": "hat" "text": "apple"
}, },
{ {
"type": "img", "type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/e64f7c005a09a5602b3d267598206d33.jpg", "image": "https://staging-teach.cdn.ireadabc.com/52e8f2868ab7ea8b584bf6beb6b9672d.png",
"audio": "http://staging-teach.cdn.ireadabc.com/a6a5c388c636bc6d063946e91b4bd21a.mp3", "audio": "https://staging-teach.cdn.ireadabc.com/6b3846cee6afa2ae450234aeec835beb.mp3",
"text": "egg" "text": "Bag"
} },
] {
}, "type": "txt",
{ "image": "https://staging-teach.cdn.ireadabc.com/8c6fef67a0095c2564e8df4b536fc540.png",
"options": [ "audio": "https://staging-teach.cdn.ireadabc.com/b44fa51172b19b555fda30717c773027.mp3",
{ "text": "cat"
"type": "txt", },
"image": "", {
"audio": "http://staging-teach.cdn.ireadabc.com/d99f49fcc1c920a20bfef0b16a17d594.mp3", "type": "txt",
"text": "test" "image": "",
}, "audio": "https://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
{ "text": "Apple"
"type": "txt", },
"image": "", {
"audio": "http://staging-teach.cdn.ireadabc.com/4487049366f11a85f62abb098c31747f.mp3", "type": "img",
"text": "good" "image": "https://staging-teach.cdn.ireadabc.com/953730441ac5313ceafab4c4b29dab46.png",
}, "audio": "https://staging-teach.cdn.ireadabc.com/b62600fd1e72b54d1d1c3bc71b7361af.mp3",
{ "text": "flower"
"type": "img", },
"image": "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg", {
"audio": "http://staging-teach.cdn.ireadabc.com/f214a4b44e9808381d73f6d7f6bf74f4.mp3", "type": "txt",
"text": "cool" "image": "",
} "audio": "https://staging-teach.cdn.ireadabc.com/ce3337620f22232dd15c29c66af57736.mp3",
] "text": "monkey"
} }
]
},
{
"options": [
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/d948ef84a50e6ac36bc31110f9062878.mp3",
"text": "umbrella"
},
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/8d6a8d7764011afb0ef537d5a44d1d10.mp3",
"text": "key"
},
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/6b3846cee6afa2ae450234aeec835beb.mp3",
"text": "bag"
},
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/7b315ba7227294d63933cd659d5372fb.png",
"audio": "https://staging-teach.cdn.ireadabc.com/a6a5c388c636bc6d063946e91b4bd21a.mp3",
"text": "egg"
}
]
}
] ]
} }
\ 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