Commit 769b4651 authored by linzhiguo's avatar linzhiguo

# layout 增加子项超宽引起外层node.size异常

# 改善选项命中
parent c7976f06
...@@ -227,7 +227,7 @@ cc.Class({ ...@@ -227,7 +227,7 @@ cc.Class({
cc.find('Canvas/show').on('click', ()=>{ cc.find('Canvas/show').on('click', ()=>{
let item = cc.instantiate(this._kind_group.template_node); let item = cc.instantiate(this._kind_group.template_node);
this._kind_group.node.addChild(item); this._kind_group.node.addChild(item);
item.y = 43; item.y = 80;
this._kind_group.updateView(); this._kind_group.updateView();
}); });
...@@ -296,7 +296,8 @@ cc.Class({ ...@@ -296,7 +296,8 @@ cc.Class({
return; return;
let item, len = this._kind_group.node.childrenCount; let item, len = this._kind_group.node.childrenCount;
for(let i = 0; i < len; i++){ let i = 0;
for(i = 0; i < len; i++){
item = this._kind_group.node.children[i]; item = this._kind_group.node.children[i];
if (cc.rect(item.getBoundingBoxToWorld()).intersects(cc.rect(selected.node.getBoundingBoxToWorld()))){ if (cc.rect(item.getBoundingBoxToWorld()).intersects(cc.rect(selected.node.getBoundingBoxToWorld()))){
console.log(i); console.log(i);
...@@ -305,8 +306,9 @@ cc.Class({ ...@@ -305,8 +306,9 @@ cc.Class({
let kind = item.getComponent(cc.js.getClassByName('WordKind')); let kind = item.getComponent(cc.js.getClassByName('WordKind'));
if (kind.kind_id != selected.kind_id){ if (kind.kind_id != selected.kind_id){
this.playAudioByName('incorrect'); //this.playAudioByName('incorrect');
break; //break;
continue;
} }
this.playAudioByName('correct'); this.playAudioByName('correct');
let node = cc.instantiate(cc.find('res/option_item')); let node = cc.instantiate(cc.find('res/option_item'));
...@@ -330,6 +332,9 @@ cc.Class({ ...@@ -330,6 +332,9 @@ cc.Class({
break; break;
} }
} }
if (i == len){
this.playAudioByName('incorrect');
}
this._moved = true; this._moved = true;
this._touched = false; this._touched = false;
if (selected.target){ if (selected.target){
......
...@@ -128,6 +128,12 @@ cc.Class({ ...@@ -128,6 +128,12 @@ cc.Class({
node.width*=sr; node.width*=sr;
node.height*=sr; node.height*=sr;
node.scale *= sr; node.scale *= sr;
if (node.width > this.node.width - 50){
sr = (this.node.width - 50)/node.width;
node.width*=sr;
node.height*=sr;
node.scale *= sr;
}
// node.opacity = 0; // node.opacity = 0;
option.adjustPicSize(); option.adjustPicSize();
cb && cb(); cb && cb();
......
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