新增ninja adventure例子

This commit is contained in:
YHH
2020-08-23 22:09:22 +08:00
parent 6c1cfec928
commit 7345a17d24
26 changed files with 400 additions and 27 deletions

View File

@@ -157,7 +157,8 @@ module es {
public handleRemove(component: Component) {
// 处理渲染层列表
if (component instanceof RenderableComponent) {
this._entity.scene.removeChild(component.displayObject);
if (component.displayObject.parent)
component.displayObject.parent.removeChild(component.displayObject);
this._entity.scene.renderableComponents.remove(component);
}

View File

@@ -109,7 +109,7 @@ module es {
let component = this._components[i] as RenderableComponent;
let egretDisplayObject = scene.$children.find(a => {return a.hashCode == component.displayObject.hashCode});
let displayIndex = scene.getChildIndex(egretDisplayObject);
if (displayIndex != i) scene.swapChildrenAt(displayIndex, i);
if (displayIndex != -1 && displayIndex != i) scene.swapChildrenAt(displayIndex, i);
}
}
}