Commit 3232baae authored by Tt's avatar Tt

修改完成

parent e18de122
This diff is collapsed.
......@@ -133,6 +133,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playLocalAudio("btn");
this.layout_final.active = false;
this.label_time.getComponent(cc.Label).string = "00:00";
let layout_play = this.layout_game.getChildByName('layout_play')
layout_play.removeAllChildren();
this.onLoadEnd();
}
private onCloseFinal() {
......@@ -229,6 +231,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let btn_poper_break = pg.view.find(item, "btn_poper_break")
let title = pg.view.find(item, "title")
let img = pg.view.find(item, "img")
let img_single = pg.view.find(item, "img_single")
let desc = pg.view.find(item, "desc")
switch (data.type) {
......@@ -236,18 +239,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.setString(title, data.text)
pg.view.visible(title, true)
pg.view.visible(img, false)
pg.view.visible(img_single, false)
pg.view.visible(desc, false)
break;
case "img":
pg.view.setNetImg(img, data.image, { w: 280, h: 200 })
pg.view.setNetImg(img_single, data.image, { w: 280, h: 280 })
pg.view.visible(title, false)
pg.view.visible(img, true)
pg.view.visible(img, false)
pg.view.visible(img_single, true)
pg.view.visible(desc, false)
break;
case "img_text":
pg.view.setNetImg(img, data.image, { w: 280, h: 200 })
pg.view.setString(desc, data.text)
pg.view.visible(title, false)
pg.view.visible(img_single, false)
pg.view.visible(img, true)
pg.view.visible(desc, true)
break;
......@@ -258,9 +264,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.visible(btn_poper_break, false);
pg.view.touchOn(item, this.onTouchItem, this);
}
private touching: boolean;
onTouchItem(e) {
if (this.touching) return;
this.touching = true;
let item = e.target;
let data = item.data;
if (this.starData.inRight(data)) {
this.touching = false;
return;
}
setTimeout(() => {
this.touching = false;
}, 600);
this.assessCount++;
this.stopLaba();
if (data.right) {
......@@ -273,7 +289,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this.starData.checkRight()) {
setTimeout(() => {
this.nextstar();
}, 1000);
}, 800);
}
} else {
this.playLocalAudio('fish_error')
......
export class Option {
private static ID: number = 100001;
public id: number;
public type: string;
public image: string;
public audio: string;
public text: string;
public right: boolean;
constructor(data) {
this.id = Option.ID++;
this.type = data.type;
this.image = data.image;
this.audio = data.audio;
......@@ -37,6 +40,9 @@ export class Question {
addRight(option) {
this.rights.push(option)
}
inRight(option) {
return this.rights.some(ri => ri.id == option.id)
}
checkRight() {
let rights = this.options.filter(op => op.right);
return this.rights.length >= rights.length
......
export const defaultData = { "title": "听音选择", "questions": [{ "audio": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3", "time": null, "duration": "", "audioName": "进入下一题.mp3", "options": [{ "type": "text", "audio": "", "image": "", "word": "", "text": "apple", "isRight": "1" }, { "type": "text", "audio": "", "image": "", "word": "", "text": "banner", "isRight": "0" }, { "type": "text", "audio": "", "image": "", "word": "", "text": "pie", "isRight": "0" }, { "type": "text", "audio": "", "image": "", "word": "", "text": "test", "isRight": "1" }] }, { "audio": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3", "time": null, "duration": "", "audioName": "进入下一题.mp3", "options": [{ "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/07c89b4a6a1a18b0c0a3029720fdfdbc.png", "word": "", "isRight": "0" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/d20b34eac11f5687d3386389aea170a2.png", "word": "", "isRight": "0" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/639ada88f3e52966103caca156f720d6.png", "word": "", "isRight": "1" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/38408b9ce048508830086c5e5cd2f384.png", "word": "", "isRight": "1" }] }, { "audio": "", "time": null, "duration": "", "audioName": "", "options": [{ "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/3f36264d6aaa65e578a6d7e261ea8a2e.png", "isRight": "1", "text": "fish" }, { "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/713e3312f1ed1876baf169026654d0c2.png", "isRight": "0", "text": "gray" }, { "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/23290ec65a6700c931105c52aaf4e24c.jpg", "isRight": "0", "text": "international" }, { "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/912b16d5a85e46fa5b0e2b75fb9d6bdf.png", "isRight": "0", "text": "break" }] }] }
\ No newline at end of file
export const defaultData = { "title": "听音选择", "questions": [{ "audio": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3", "time": null, "duration": "", "audioName": "进入下一题.mp3", "options": [{ "type": "text", "audio": "", "image": "", "word": "", "text": "appleappleap", "isRight": "1" }, { "type": "text", "audio": "", "image": "", "word": "", "text": "banner", "isRight": "0" }, { "type": "text", "audio": "", "image": "", "word": "", "text": "pie", "isRight": "0" }, { "type": "text", "audio": "", "image": "", "word": "", "text": "test", "isRight": "1" }] }, { "audio": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3", "time": null, "duration": "", "audioName": "进入下一题.mp3", "options": [{ "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/07c89b4a6a1a18b0c0a3029720fdfdbc.png", "word": "", "isRight": "0" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/d20b34eac11f5687d3386389aea170a2.png", "word": "", "isRight": "0" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/639ada88f3e52966103caca156f720d6.png", "word": "", "isRight": "1" }, { "type": "img", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/38408b9ce048508830086c5e5cd2f384.png", "word": "", "isRight": "1" }] }, { "audio": "", "time": null, "duration": "", "audioName": "", "options": [{ "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/3f36264d6aaa65e578a6d7e261ea8a2e.png", "isRight": "1", "text": "fish" }, { "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/713e3312f1ed1876baf169026654d0c2.png", "isRight": "0", "text": "gray" }, { "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/23290ec65a6700c931105c52aaf4e24c.jpg", "isRight": "0", "text": "international" }, { "type": "img_text", "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/912b16d5a85e46fa5b0e2b75fb9d6bdf.png", "isRight": "0", "text": "break" }] }] }
\ 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