Progress on multiplayer campaign:
- Moved SaveUtils to the shared project. - Moved the "new game"/"load game" menu logic to a separate class. - Somewhat functional campaign UI in the server lobby (only the map view is usable atm though).
This commit is contained in:
@@ -525,9 +525,19 @@ namespace Barotrauma
|
||||
if (children.Contains(child)) children.Remove(child);
|
||||
}
|
||||
|
||||
public GUIComponent FindChild(object userData)
|
||||
public GUIComponent FindChild(object userData, bool recursive = false)
|
||||
{
|
||||
return children.FirstOrDefault(c => c.userData == userData);
|
||||
var matchingChild = children.FirstOrDefault(c => c.userData == userData);
|
||||
if (recursive && matchingChild == null)
|
||||
{
|
||||
foreach (GUIComponent child in children)
|
||||
{
|
||||
matchingChild = child.FindChild(userData, recursive);
|
||||
if (matchingChild != null) return matchingChild;
|
||||
}
|
||||
}
|
||||
|
||||
return matchingChild;
|
||||
}
|
||||
|
||||
public List<GUIComponent> FindChildren(object userData)
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace Barotrauma
|
||||
get { return MessageBoxes.Count == 0 ? null : MessageBoxes[0]; }
|
||||
}
|
||||
|
||||
public GUIFrame InnerFrame
|
||||
{
|
||||
get { return children[0] as GUIFrame; }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return (children[0].children[1] as GUITextBlock).Text; }
|
||||
@@ -78,12 +83,15 @@ namespace Barotrauma
|
||||
MessageBoxes.Add(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool Close(GUIButton button, object obj)
|
||||
public void Close()
|
||||
{
|
||||
if (parent != null) parent.RemoveChild(this);
|
||||
if (MessageBoxes.Contains(this)) MessageBoxes.Remove(this);
|
||||
}
|
||||
|
||||
public bool Close(GUIButton button, object obj)
|
||||
{
|
||||
Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user