Commit 76eef046 authored by Tt's avatar Tt

修改完成

parent 3091b000
...@@ -2719,14 +2719,14 @@ ...@@ -2719,14 +2719,14 @@
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-344.947, 0,
0, 0,
0, 0,
0, 0,
...@@ -3041,7 +3041,7 @@ ...@@ -3041,7 +3041,7 @@
"node": { "node": {
"__id__": 63 "__id__": 63
}, },
"_enabled": true, "_enabled": false,
"_layoutSize": { "_layoutSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 300, "width": 300,
...@@ -3135,7 +3135,7 @@ ...@@ -3135,7 +3135,7 @@
"node": { "node": {
"__id__": 65 "__id__": 65
}, },
"_enabled": true, "_enabled": false,
"_layoutSize": { "_layoutSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 710, "width": 710,
......
...@@ -61,7 +61,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -61,7 +61,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
gameStart() { gameStart() {
this.answerStr = ""; this.answerArr = [];
this.answerNodes = []; this.answerNodes = [];
this.updateQuestion(); this.updateQuestion();
this.updateHightLight(); this.updateHightLight();
...@@ -135,6 +135,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -135,6 +135,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
this.playLocalAudio("again"); this.playLocalAudio("again");
this.initData(); this.initData();
this.initView();
this.gameStart(); this.gameStart();
} }
private onAgain() { private onAgain() {
...@@ -314,7 +315,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -314,7 +315,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 更新当前面板颜色 // 更新当前面板颜色
private answerStr: string; private answerArr: Array<cc.Node>;
private isRight() {
let answer = GameNGT14.getIns().getCurrent().answer;
let str = "";
this.answerArr.sort((A, B) => A.x - B.x);
this.answerArr.forEach(node => str += node.data.word)
return answer == str;
}
private answerNodes: Array<cc.Node>; private answerNodes: Array<cc.Node>;
updateCurrentNodeColor(node, data) { updateCurrentNodeColor(node, data) {
let label = node.getChildByName('label') let label = node.getChildByName('label')
...@@ -325,7 +333,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -325,7 +333,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
let block = node.data; let block = node.data;
block.val = data.word; block.val = data.word;
this.answerStr += data.word;
this.answerNodes.push(node); this.answerNodes.push(node);
} }
...@@ -407,12 +414,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -407,12 +414,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.touching = null; this.touching = null;
target.x = target.data.pos.x; target.x = target.data.pos.x;
target.y = target.data.pos.y; target.y = target.data.pos.y;
target.scale = 1;
return; return;
} }
// let rect = cc.rect(target.x, target.y, target.width, target.height); // let rect = cc.rect(target.x, target.y, target.width, target.height);
let rect = cc.rect(target.x, target.y, 1, 1); let rect = cc.rect(target.x, target.y, 1, 1);
//坐标转换 //坐标转换
console.log("1123123123")
let collNode = null; let collNode = null;
this.layout_blocks.children.forEach(node => { this.layout_blocks.children.forEach(node => {
// 开始做碰撞 // 开始做碰撞
...@@ -429,6 +436,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -429,6 +436,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.touching = null; this.touching = null;
target.x = target.data.pos.x; target.x = target.data.pos.x;
target.y = target.data.pos.y; target.y = target.data.pos.y;
target.scale = 1;
return; return;
} }
...@@ -436,22 +444,29 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -436,22 +444,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
//是否正确 //是否正确
this.playLocalAudio('move').then(() => { }) this.playLocalAudio('move').then(() => { })
let item = target; let item = target;
cc.tween(target).to(0.15, { scale: 0.9, rotation: 0 }).call(() => { let pos = target.parent.convertToNodeSpaceAR(collNode.convertToWorldSpaceAR(cc.v2(0, 0)));
let scale = collNode.width / target.width;
cc.tween(target).to(0.15, { scale: scale, rotation: 0, x: pos.x, y: pos.y }).call(() => {
// block需要显示内容 // block需要显示内容
this.updateCurrentNodeColor(collNode, data); this.updateCurrentNodeColor(collNode, data);
target.active = false; // target.active = false;
this.touching = null;
item.off(cc.Node.EventType.TOUCH_START, this.onItemTouchStart, this);
item.off(cc.Node.EventType.TOUCH_MOVE, this.onItemTouchMove, this);
item.off(cc.Node.EventType.TOUCH_END, this.onItemTouchEnd, this);
item.off(cc.Node.EventType.TOUCH_CANCEL, this.onItemTouchCancel, this);
this.touching = null;
this.answerArr.push(target);
target.data.chosed = true;
// 判断此行是否完成 // 判断此行是否完成
let lineFull = this.answerStr.length == GameNGT14.getIns().getCurrent().answer.length; let lineFull = this.answerArr.length == GameNGT14.getIns().getCurrent().answer.length;
let isRight = this.answerStr == GameNGT14.getIns().getCurrent().answer
if (lineFull) { if (lineFull) {
this.answerArr.forEach(nd => {
nd.off(cc.Node.EventType.TOUCH_START, this.onItemTouchStart, this);
nd.off(cc.Node.EventType.TOUCH_MOVE, this.onItemTouchMove, this);
nd.off(cc.Node.EventType.TOUCH_END, this.onItemTouchEnd, this);
nd.off(cc.Node.EventType.TOUCH_CANCEL, this.onItemTouchCancel, this);
nd.active = false;
})
let nodes = this.getHightLightNodes(); let nodes = this.getHightLightNodes();
if (isRight) {
if (this.isRight()) {
//执行放大10% //执行放大10%
nodes.forEach((node, index) => { nodes.forEach((node, index) => {
//执行星星动画 //执行星星动画
...@@ -467,12 +482,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -467,12 +482,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playLocalAudio('right').then(() => { this.playLocalAudio('right').then(() => {
pg.event.emit('mouse_05_add') pg.event.emit('mouse_05_add')
//其他字母向下掉出 //其他字母向下掉出
let once = false;
this.layout_words.children.forEach((node, index) => { this.layout_words.children.forEach((node, index) => {
cc.tween(node) cc.tween(node)
.delay(0.05 * (this.layout_words.children.length - index)) .delay(0.05 * (this.layout_words.children.length - index))
.by(0.3, { y: -1000 }) .by(0.3, { y: -1000 })
.delay(0.8) .delay(0.8)
.call(() => { .call(() => {
if (once) return;
once = true;
this.nextQuestion(); this.nextQuestion();
}) })
.start(); .start();
...@@ -510,12 +528,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -510,12 +528,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
//播放灰色徽章 //播放灰色徽章
pg.event.emit("mouse_14_add_error"); pg.event.emit("mouse_14_add_error");
//其他字母向下掉出 //其他字母向下掉出
let once = false;
this.layout_words.children.forEach((node, index) => { this.layout_words.children.forEach((node, index) => {
cc.tween(node) cc.tween(node)
.delay(0.05 * (this.layout_words.children.length - index)) .delay(0.05 * (this.layout_words.children.length - index))
.by(0.3, { y: -1000 }) .by(0.3, { y: -1000 })
.delay(0.8) .delay(0.8)
.call(() => { .call(() => {
if (once) return;
once = true;
this.nextQuestion(); this.nextQuestion();
}) })
.start(); .start();
...@@ -528,48 +549,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -528,48 +549,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.updateHightLight(); this.updateHightLight();
} }
}).start(); }).start();
return;
// if (isRight) {
// let item = target;
// let lastArea = 100;
// // this.playLocalAudio('right').then(() => {
// // if (data.audioUrl) {
// // pg.audio.playAudioByUrlThen(data.audioUrl).then(() => {
// // this.touching = null;
// // })
// // } else {
// // this.touching = null;
// // }
// // })
// if (item.scaleX == -1) {
// // 计算当前坐标距离最左侧的距离
// let space = currentRect.width - ((rect.x + rect.width) - currentRect.x) - lastArea / 5;
// let time = space / 10;
// cc.tween(item).by(time, { x: space }).start();
// } else {
// // 计算当前坐标距离最左侧的距离
// let space = rect.x - currentRect.x - lastArea;
// let time = space / 10;
// cc.tween(item).by(time, { x: -space }).start();
// }
// item.off(cc.Node.EventType.TOUCH_START, this.onItemTouchStart, this);
// item.off(cc.Node.EventType.TOUCH_MOVE, this.onItemTouchMove, this);
// item.off(cc.Node.EventType.TOUCH_END, this.onItemTouchEnd, this);
// item.off(cc.Node.EventType.TOUCH_CANCEL, this.onItemTouchCancel, this);
// pg.event.emit('mouse_05_add')
// } else {
// this.playLocalAudio('error').then(() => {
// this.touching = null;
// // this.updateItem(target, data);
// })
// }
//判断是否结束了
// if (Game.getIns().boatLeft.isAllRight() && Game.getIns().boatRight.isAllRight()) {
// this.showGameOver();
// }
} }
onItemTouchCancel() { onItemTouchCancel() {
......
...@@ -362,6 +362,8 @@ let pg = { ...@@ -362,6 +362,8 @@ let pg = {
}, 60); }, 60);
return true; return true;
}, },
//changePos
//更变颜色 //更变颜色
setColor(item, color, outlineWidth = -1) { setColor(item, color, outlineWidth = -1) {
if (!item) return pg.logger.w("setColor warn->传入了错误的item"); if (!item) return pg.logger.w("setColor warn->传入了错误的item");
......
export const defaultData = { export const defaultData = {
"questions": [{ "questions": [{
"parts": [ "parts": [
{
"id": "166668702213640281", "answer": "freedom", "options": [{
"blocks": [
{
"type": "img", "txt": "", "line": "", "img": "", "tag": "", "image": "http://staging-teach.cdn.ireadabc.com/19ac75d2de5455d268eaef8184bf805b.png"
}]
}, { "blocks": [{ "type": "txt", "txt": "", "line": "", "img": "", "tag": "", "text": "_____ do you go to the park?" }] }, { "blocks": [{ "type": "txt", "txt": "", "line": "", "img": "", "tag": "", "text": "On saturdays freedow" }] }]
},
{ {
"id": "1666687632465177361", "answer": "want", "options": [{ "blocks": [{ "type": "txt", "txt": "", "line": "", "img": "", "tag": "", "text": "Dave _____ want?" }] }] "id": "1666687632465177361", "answer": "want", "options": [{ "blocks": [{ "type": "txt", "txt": "", "line": "", "img": "", "tag": "", "text": "Dave _____ want?" }] }]
},
{
"id": "1666687612725869271", "answer": "fish", "options": [{ "blocks": [{ "type": "img", "txt": "", "line": "", "img": "", "tag": "", "image": "http://staging-teach.cdn.ireadabc.com/3f0f2572da257eedbec51f8d05e2a7d8.png" }] }]
},
{
"id": "1666687646496548891", "answer": "red", "options": [{ "blocks": [{ "type": "txt", "txt": "", "line": "", "img": "", "tag": "", "text": "The fish color is _____ answer red." }] }]
}] }]
}], }],
"title": "单词填空", "imgAni": { "ske": { "url": "http://staging-teach.cdn.ireadabc.com/4ec3da85d888ad3c5c57e10fca728499.json", "name": "鱼1_ske.json" }, "tex": { "url": "http://staging-teach.cdn.ireadabc.com/2c52380a3f3cdd3f5d38870bee2c9ffd.json", "name": "鱼1_tex.json" }, "png": { "url": "http://staging-teach.cdn.ireadabc.com/3ca112e3bb312d5e9b7182bbb97c616d.png", "name": "鱼1_tex.png" } }, "startAudio": "http://staging-teach.cdn.ireadabc.com/e587cf79c91d1cc4339540bb04b2aad0_l.mp3", "blockStruct": [{ "pId": "1666687632465177361", "point": { "x": 2, "y": 2 }, "answer": "want" }, { "pId": "1666687646496548891", "point": { "x": 3, "y": 4 }, "answer": "red" }, { "pId": "1666687612725869271", "point": { "x": 1, "y": 1 }, "answer": "fish" }, { "pId": "166668702213640281", "point": { "x": 0, "y": 0 }, "answer": "freedom" }], "blocks": [[{ "val": "f" }, { "val": "r" }, { "val": "e" }, { "val": "e" }, { "val": "d" }, { "val": "o" }, { "val": "m" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "f" }, { "val": "i" }, { "val": "s" }, { "val": "h" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "w" }, { "val": "a" }, { "val": "n" }, { "val": "t" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "r" }, { "val": "e" }, { "val": "d" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }]], "audioName": "" "title": "单词填空", "imgAni": { "ske": { "url": "http://staging-teach.cdn.ireadabc.com/4ec3da85d888ad3c5c57e10fca728499.json", "name": "鱼1_ske.json" }, "tex": { "url": "http://staging-teach.cdn.ireadabc.com/2c52380a3f3cdd3f5d38870bee2c9ffd.json", "name": "鱼1_tex.json" }, "png": { "url": "http://staging-teach.cdn.ireadabc.com/3ca112e3bb312d5e9b7182bbb97c616d.png", "name": "鱼1_tex.png" } }, "startAudio": "http://staging-teach.cdn.ireadabc.com/e587cf79c91d1cc4339540bb04b2aad0_l.mp3", "blockStruct": [{ "pId": "1666687632465177361", "point": { "x": 2, "y": 2 }, "answer": "want" }, { "pId": "1666687646496548891", "point": { "x": 3, "y": 4 }, "answer": "red" }, { "pId": "1666687612725869271", "point": { "x": 1, "y": 1 }, "answer": "fish" }, { "pId": "166668702213640281", "point": { "x": 0, "y": 0 }, "answer": "freedom" }], "blocks": [[{ "val": "f" }, { "val": "r" }, { "val": "e" }, { "val": "e" }, { "val": "d" }, { "val": "o" }, { "val": "m" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "f" }, { "val": "i" }, { "val": "s" }, { "val": "h" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "w" }, { "val": "a" }, { "val": "n" }, { "val": "t" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "r" }, { "val": "e" }, { "val": "d" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }], [{ "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }, { "val": "" }]], "audioName": ""
......
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