mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 06:28:35 +01:00
allow for ui element removal during its update
This commit is contained in:
parent
bffcab3130
commit
0c74dfc38e
2 changed files with 5 additions and 3 deletions
|
@ -442,7 +442,8 @@ namespace MLEM.Ui.Elements {
|
||||||
this.System.OnElementUpdated?.Invoke(this, time);
|
this.System.OnElementUpdated?.Invoke(this, time);
|
||||||
|
|
||||||
foreach (var child in this.GetRelevantChildren())
|
foreach (var child in this.GetRelevantChildren())
|
||||||
child.Update(time);
|
if (child.System != null)
|
||||||
|
child.Update(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) {
|
public virtual void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) {
|
||||||
|
|
|
@ -98,8 +98,9 @@ namespace MLEM.Ui {
|
||||||
public void Update(GameTime time) {
|
public void Update(GameTime time) {
|
||||||
this.Controls.Update();
|
this.Controls.Update();
|
||||||
|
|
||||||
foreach (var root in this.rootElements)
|
for (var i = this.rootElements.Count - 1; i >= 0; i--) {
|
||||||
root.Element.Update(time);
|
this.rootElements[i].Element.Update(time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawEarly(GameTime time, SpriteBatch batch) {
|
public void DrawEarly(GameTime time, SpriteBatch batch) {
|
||||||
|
|
Loading…
Reference in a new issue