在收藏夹中新增一个网页,将网址设为下面的其中一个源码。然后打开任一 Creator 页面,接着直接在收藏夹点击刚刚收藏的网址即可。
javascript:(function () {
function visitNode (node, visitor) {
visitor(node);
var children = node._children;
for (var i = 0; i < children.length; ++i) {
visitNode(children[i], visitor);
}
}
cc.Node.prototype.printPath = function () {
var path = this.name;
for (var parent = this.parent; parent instanceof cc.Node; parent = parent.parent) {
path = parent.name + '/' + path;
}
var emoji;
if (!this.active) {
emoji = '\u2716\uFE0F';
}
else if (this.activeInHierarchy) {
emoji = '\u2705';
}
else {
emoji = '\u2611\uFE0F';
}
console.log(emoji + ' ' + path);
};
var roots = cc.director.getScene().children;
for (var i = 0; i < roots.length; i++) {
var root = roots[i];
visitNode(root, function (node) {
node.printPath();
});
}
})();
function DebugArray () {
this.buffer = [];
};
DebugArray.prototype.push = function (item) {
this.buffer.push(item);
};
for (let i = 0; i < 1000; ++i) {
cc.js.getset(DebugArray.prototype, '' + i,
function () {
return this.buffer[i];
},
function (value) {
this.buffer[i] = value;
}
);
}
cc.js.getset(DebugArray.prototype, 'length',
function () {
return this.buffer.length;
},
function (value) {
debugger;
this.buffer.length = value;
}
);