Skip to content

Commit

Permalink
#23 修复绘制层级问题
Browse files Browse the repository at this point in the history
  • Loading branch information
esengine committed Aug 8, 2020
1 parent 3492bbd commit a39b98b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion demo/libs/framework/framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -4324,7 +4324,7 @@ var es;
};
RenderableComponentList.prototype.addToRenderLayerList = function (component, renderLayer) {
var list = this.componentsWithRenderLayer(renderLayer);
if (!list.contains(component)) {
if (list.contains(component)) {
console.warn("组件呈现层列表已经包含此组件");
return;
}
Expand Down Expand Up @@ -4353,6 +4353,7 @@ var es;
}
}
this._unsortedRenderLayers.length = 0;
this.updateEgretList();
}
};
RenderableComponentList.prototype.updateEgretList = function () {
Expand Down
2 changes: 1 addition & 1 deletion demo/libs/framework/framework.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/src/game/MainScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module scene {

for (let i = 0; i < 20; i++) {
let sprite = new es.Sprite(RES.getRes("checkbox_select_disabled_png"));
let player2 = this.createEntity("player2");
let player2 = this.createEntity("bg");
player2.addComponent(new es.SpriteRenderer()).setSprite(sprite).setRenderLayer(i);
player2.position = new es.Vector2(30 * i, 30 * i);
// player2.addComponent(new es.BoxCollider());
Expand Down
3 changes: 2 additions & 1 deletion source/bin/framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -4324,7 +4324,7 @@ var es;
};
RenderableComponentList.prototype.addToRenderLayerList = function (component, renderLayer) {
var list = this.componentsWithRenderLayer(renderLayer);
if (!list.contains(component)) {
if (list.contains(component)) {
console.warn("组件呈现层列表已经包含此组件");
return;
}
Expand Down Expand Up @@ -4353,6 +4353,7 @@ var es;
}
}
this._unsortedRenderLayers.length = 0;
this.updateEgretList();
}
};
RenderableComponentList.prototype.updateEgretList = function () {
Expand Down
2 changes: 1 addition & 1 deletion source/bin/framework.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion source/src/ECS/Utils/RenderableComponentList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module es {

public addToRenderLayerList(component: IRenderable, renderLayer: number) {
let list = this.componentsWithRenderLayer(renderLayer);
if (!list.contains(component)) {
if (list.contains(component)) {
console.warn("组件呈现层列表已经包含此组件");
return;
}
Expand Down Expand Up @@ -96,6 +96,7 @@ module es {
}

this._unsortedRenderLayers.length = 0;
this.updateEgretList();
}
}

Expand Down

0 comments on commit a39b98b

Please sign in to comment.