Commit c7c8bfe2 authored by 范雪寒's avatar 范雪寒

refrector: 反转if

parent bb4c13a8
......@@ -199,15 +199,17 @@ export class Game {
}
seekChildByName(name) {
let result = this.getChildByName(name);
if (result == null) {
for (var i = 1; i < this.children.length; ++i) {
let node = this.children[i];
if (typeof (node.seekChildByName) == 'function') {
result = node.seekChildByName(name);
if (result != null) {
return result;
}
}
if (result) {
return result;
}
for (let i = 1; i < this.children.length; ++i) {
const node = this.children[i];
if (typeof (node.seekChildByName) != 'function') {
continue;
}
result = node.seekChildByName(name);
if (result != null) {
return result;
}
}
return result;
......
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