Option to choose which submarine to use as the respawn shuttle, submarines can be given "tags" (atm just shuttle and HideInMenu), separate saving window in sub editor

This commit is contained in:
Regalis
2016-08-05 14:06:05 +03:00
parent 581a7d5d9f
commit d55926a352
8 changed files with 363 additions and 75 deletions

View File

@@ -26,6 +26,53 @@ namespace Barotrauma
return listBox.Selected.UserData;
}
}
public bool Enabled
{
get { return listBox.Enabled; }
set { listBox.Enabled = value; }
}
public GUIComponent Selected
{
get { return listBox.Selected; }
}
public GUIListBox ListBox
{
get { return listBox; }
}
public object SelectedData
{
get
{
return (listBox.Selected == null) ? null : listBox.Selected.UserData;
}
}
public int SelectedIndex
{
get
{
if (listBox.Selected == null) return -1;
return listBox.children.FindIndex(x => x == listBox.Selected);
}
}
public override string ToolTip
{
get
{
return base.ToolTip;
}
set
{
base.ToolTip = value;
button.ToolTip = value;
listBox.ToolTip = value;
}
}
public GUIDropDown(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null)
: base(style)
@@ -34,7 +81,7 @@ namespace Barotrauma
if (parent != null) parent.AddChild(this);
button = new GUIButton(Rectangle.Empty, text, Color.White, Alignment.TopLeft, Alignment.TopLeft, null, this);
button = new GUIButton(this.rect, text, Color.White, Alignment.TopLeft, Alignment.TopLeft, null, null);
button.TextColor = Color.White;
button.Color = Color.Black * 0.8f;
@@ -47,6 +94,11 @@ namespace Barotrauma
//listBox.ScrollBarEnabled = false;
}
public override void AddChild(GUIComponent child)
{
listBox.AddChild(child);
}
public void AddItem(string text, object userData = null)
{
GUITextBlock textBlock = new GUITextBlock(new Rectangle(0,0,0,20), text, GUI.Style, listBox);
@@ -61,6 +113,11 @@ namespace Barotrauma
//listBox.Rect = new Rectangle(listBox.Rect.X,listBox.Rect.Y,listBox.Rect.Width,totalHeight);
}
public List<GUIComponent> GetChildren()
{
return listBox.children;
}
private bool SelectItem(GUIComponent component, object obj)
{
GUITextBlock textBlock = component as GUITextBlock;
@@ -84,6 +141,11 @@ namespace Barotrauma
//SelectItem(child, userData);
}
public void Select(int index)
{
listBox.Select(index);
}
private bool wasOpened;
@@ -116,13 +178,12 @@ namespace Barotrauma
{
Rectangle listBoxRect = listBox.Rect;
listBoxRect.Width += 20;
if (!listBoxRect.Contains(PlayerInput.MousePosition))
if (!listBoxRect.Contains(PlayerInput.MousePosition) && !button.Rect.Contains(PlayerInput.MousePosition))
{
Dropped = false;
}
}
button.Update(deltaTime);
if (Dropped) listBox.Update(deltaTime);