Commit 17130b4c authored by Tt's avatar Tt

bug修复

parent 76eef046
...@@ -315,12 +315,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -315,12 +315,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 更新当前面板颜色 // 更新当前面板颜色
private answerArr: Array<cc.Node>; private answerArr: Array<{ nd, bg }>;
private isRight() { private isRight() {
let answer = GameNGT14.getIns().getCurrent().answer; let answer = GameNGT14.getIns().getCurrent().answer;
let str = ""; let str = "";
this.answerArr.sort((A, B) => A.x - B.x); this.answerArr.sort((A, B) => A.nd.x - B.nd.x);
this.answerArr.forEach(node => str += node.data.word) this.answerArr.forEach(node => str += node.nd.data.word)
return answer == str; return answer == str;
} }
private answerNodes: Array<cc.Node>; private answerNodes: Array<cc.Node>;
...@@ -415,6 +415,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -415,6 +415,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
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; target.scale = 1;
this.answerArr = this.answerArr.filter(ans => {
return ans.nd != target;
})
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);
...@@ -437,32 +440,34 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -437,32 +440,34 @@ export default class SceneComponent extends MyCocosSceneComponent {
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; target.scale = 1;
this.answerArr = this.answerArr.filter(ans => {
return ans.nd != target;
})
return; return;
} }
//是否正确 //是否正确
this.playLocalAudio('move').then(() => { }) this.playLocalAudio('move').then(() => { })
let item = target;
let pos = target.parent.convertToNodeSpaceAR(collNode.convertToWorldSpaceAR(cc.v2(0, 0))); let pos = target.parent.convertToNodeSpaceAR(collNode.convertToWorldSpaceAR(cc.v2(0, 0)));
let scale = collNode.width / target.width; let scale = collNode.width / target.width;
cc.tween(target).to(0.15, { scale: scale, rotation: 0, x: pos.x, y: pos.y }).call(() => { cc.tween(target).to(0.15, { scale: scale, rotation: 0, x: pos.x, y: pos.y }).call(() => {
// block需要显示内容 // block需要显示内容
this.updateCurrentNodeColor(collNode, data);
// target.active = false; // target.active = false;
this.touching = null; this.touching = null;
this.answerArr.push(target); this.answerArr.push({ bg: collNode, nd: target });
target.data.chosed = true; target.data.chosed = true;
// 判断此行是否完成 // 判断此行是否完成
let lineFull = this.answerArr.length == GameNGT14.getIns().getCurrent().answer.length; let lineFull = this.answerArr.length == GameNGT14.getIns().getCurrent().answer.length;
if (lineFull) { if (lineFull) {
this.answerArr.forEach(nd => { this.answerArr.forEach(ans => {
nd.off(cc.Node.EventType.TOUCH_START, this.onItemTouchStart, this); ans.nd.off(cc.Node.EventType.TOUCH_START, this.onItemTouchStart, this);
nd.off(cc.Node.EventType.TOUCH_MOVE, this.onItemTouchMove, this); ans.nd.off(cc.Node.EventType.TOUCH_MOVE, this.onItemTouchMove, this);
nd.off(cc.Node.EventType.TOUCH_END, this.onItemTouchEnd, this); ans.nd.off(cc.Node.EventType.TOUCH_END, this.onItemTouchEnd, this);
nd.off(cc.Node.EventType.TOUCH_CANCEL, this.onItemTouchCancel, this); ans.nd.off(cc.Node.EventType.TOUCH_CANCEL, this.onItemTouchCancel, this);
nd.active = false; ans.nd.active = false;
this.updateCurrentNodeColor(ans.bg, ans.nd.data);
}) })
let nodes = this.getHightLightNodes(); let nodes = this.getHightLightNodes();
......
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