加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
RPGMZ 添加子类的方法是 this.addChild
那么编写代码有时需要遍历所有的子类 当查找到某个子类时做一些事情
可以通过for循环进行遍历
for (const child of this.children) {
// 执行操作,如判断类型或调用方法
if (child instanceof Object) {
//如果类型正确 移出去
this.removeChild(child);
}
}
for (const child of this.children) {
// 执行操作,如判断类型或调用方法
if (child instanceof Object) {
//如果类型正确 移出去
this.removeChild(child);
}
}
编写插件时有很大帮助 |