Fixed bug with GUIComponent children changing order in parent's list
This commit is contained in:
@@ -467,7 +467,6 @@ namespace Barotrauma
|
||||
|
||||
public static void Update(float deltaTime)
|
||||
{
|
||||
|
||||
if (pauseMenuOpen)
|
||||
{
|
||||
pauseMenu.Update(0.016f);
|
||||
|
||||
@@ -311,10 +311,13 @@ namespace Barotrauma
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < children.Count; i++)
|
||||
//use a fixed list since children can change their order in the main children list
|
||||
//TODO: maybe find a more efficient way of handling changes in list order
|
||||
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
|
||||
foreach (GUIComponent c in fixedChildren)
|
||||
{
|
||||
if (!children[i].Visible) continue;
|
||||
children[i].Update(deltaTime);
|
||||
if (!c.Visible) continue;
|
||||
c.Update(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Barotrauma
|
||||
private bool OnClicked(GUIComponent component, object obj)
|
||||
{
|
||||
if (wasOpened) return false;
|
||||
|
||||
|
||||
wasOpened = true;
|
||||
Dropped = !Dropped;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user