Lobbyscreen store fixes, sub name textbox & save button in sub editor, transitioncinematic on crew death, saving reactor state, radar marker position fix, minimap fix, button sounds, artifact positioning fix, better LegUp prevention method, some music clips when round ends
This commit is contained in:
@@ -16,8 +16,15 @@ namespace Barotrauma
|
||||
BottomRight = (Bottom | Right), BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom)
|
||||
}
|
||||
|
||||
public enum GUISoundType
|
||||
{
|
||||
Message = 0,
|
||||
Click = 1
|
||||
}
|
||||
|
||||
public class GUI
|
||||
{
|
||||
|
||||
public static GUIStyle Style;
|
||||
|
||||
private static Texture2D t;
|
||||
@@ -57,7 +64,8 @@ namespace Barotrauma
|
||||
if (loadSounds)
|
||||
{
|
||||
sounds = new Sound[2];
|
||||
sounds[0] = Sound.Load("Content/Sounds/UI/UImsg.ogg", false);
|
||||
sounds[(int)GUISoundType.Message] = Sound.Load("Content/Sounds/UI/UImsg.ogg", false);
|
||||
sounds[(int)GUISoundType.Click] = Sound.Load("Content/Sounds/UI/beep-shinymetal.ogg", false);
|
||||
}
|
||||
|
||||
// create 1x1 texture for line drawing
|
||||
@@ -391,12 +399,12 @@ namespace Barotrauma
|
||||
currPos.Y += messages.Count * 30;
|
||||
|
||||
messages.Add(new GUIMessage(message, color, currPos, lifeTime));
|
||||
if (playSound) PlayMessageSound();
|
||||
if (playSound) PlayUISound(GUISoundType.Message);
|
||||
}
|
||||
|
||||
public static void PlayMessageSound()
|
||||
public static void PlayUISound(GUISoundType soundType)
|
||||
{
|
||||
sounds[0].Play();
|
||||
sounds[(int)soundType].Play();
|
||||
}
|
||||
|
||||
private static void DrawMessages(SpriteBatch spriteBatch, float deltaTime)
|
||||
|
||||
@@ -161,6 +161,8 @@ namespace Barotrauma
|
||||
}
|
||||
else if (PlayerInput.LeftButtonClicked())
|
||||
{
|
||||
GUI.PlayUISound(GUISoundType.Click);
|
||||
|
||||
if (OnClicked != null)
|
||||
{
|
||||
if (OnClicked(this, UserData) && CanBeSelected) state = ComponentState.Selected;
|
||||
|
||||
@@ -208,10 +208,10 @@ namespace Barotrauma
|
||||
flashTimer = FlashDuration;
|
||||
flashColor = (color == null) ? Color.Red * 0.8f : (Color)color;
|
||||
|
||||
foreach (GUIComponent child in children)
|
||||
{
|
||||
child.Flash();
|
||||
}
|
||||
//foreach (GUIComponent child in children)
|
||||
//{
|
||||
// child.Flash();
|
||||
//}
|
||||
}
|
||||
|
||||
public virtual void Draw(SpriteBatch spriteBatch)
|
||||
@@ -315,6 +315,7 @@ namespace Barotrauma
|
||||
|
||||
for (int i = 0; i < children.Count; i++)
|
||||
{
|
||||
if (!children[i].Visible) continue;
|
||||
children[i].Update(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ namespace Barotrauma
|
||||
{
|
||||
get { return selected; }
|
||||
}
|
||||
|
||||
|
||||
public object SelectedData
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
return (Selected == null) ? null : Selected.UserData;
|
||||
return (Selected == null) ? null : Selected.UserData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,18 +87,18 @@ namespace Barotrauma
|
||||
public bool ScrollBarEnabled
|
||||
{
|
||||
get { return scrollBarEnabled; }
|
||||
set
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
if (!scrollBarEnabled && scrollBarHidden) ShowScrollBar();
|
||||
if (!scrollBarEnabled && scrollBarHidden) ShowScrollBar();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scrollBarEnabled && !scrollBarHidden) HideScrollBar();
|
||||
if (scrollBarEnabled && !scrollBarHidden) HideScrollBar();
|
||||
}
|
||||
|
||||
scrollBarEnabled = value;
|
||||
scrollBarEnabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Barotrauma
|
||||
|
||||
public GUIListBox(Rectangle rect, Color? color, GUIStyle style = null, GUIComponent parent = null)
|
||||
: this(rect, color, (Alignment.Left | Alignment.Top), style, parent)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
public GUIListBox(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null, bool isHorizontal = false)
|
||||
@@ -125,7 +125,7 @@ namespace Barotrauma
|
||||
|
||||
selected = new List<GUIComponent>();
|
||||
|
||||
if (color!=null) this.color = (Color)color;
|
||||
if (color != null) this.color = (Color)color;
|
||||
|
||||
if (parent != null)
|
||||
parent.AddChild(this);
|
||||
@@ -135,7 +135,7 @@ namespace Barotrauma
|
||||
if (isHorizontal)
|
||||
{
|
||||
scrollBar = new GUIScrollBar(
|
||||
new Rectangle(this.rect.X, this.rect.Bottom-20, this.rect.Width, 20), color, 1.0f, GUI.Style);
|
||||
new Rectangle(this.rect.X, this.rect.Bottom - 20, this.rect.Width, 20), color, 1.0f, GUI.Style);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -160,37 +160,39 @@ namespace Barotrauma
|
||||
|
||||
public void Select(object selection)
|
||||
{
|
||||
for (int i = 0; i < children.Count; i++ )
|
||||
for (int i = 0; i < children.Count; i++)
|
||||
{
|
||||
if (children[i].UserData != selection) continue;
|
||||
|
||||
Select(i);
|
||||
|
||||
if (OnSelected != null) OnSelected(Selected, Selected.UserData);
|
||||
//if (OnSelected != null) OnSelected(Selected, Selected.UserData);
|
||||
if (!SelectMultiple) return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (!Visible) return;
|
||||
|
||||
base.Update(deltaTime);
|
||||
|
||||
|
||||
scrollBar.Update(deltaTime);
|
||||
|
||||
if ((MouseOn==this || MouseOn==scrollBar || IsParentOf(MouseOn) )&& PlayerInput.ScrollWheelSpeed!=0)
|
||||
|
||||
if ((MouseOn == this || MouseOn == scrollBar || IsParentOf(MouseOn)) && PlayerInput.ScrollWheelSpeed != 0)
|
||||
{
|
||||
scrollBar.BarScroll -= (PlayerInput.ScrollWheelSpeed/500.0f) * BarSize;
|
||||
scrollBar.BarScroll -= (PlayerInput.ScrollWheelSpeed / 500.0f) * BarSize;
|
||||
}
|
||||
}
|
||||
|
||||
public void Select(int childIndex)
|
||||
{
|
||||
//children[0] is the GUIFrame, ignore it
|
||||
//childIndex += 1;
|
||||
if (childIndex >= children.Count || childIndex < 0) return;
|
||||
|
||||
if (childIndex >= children.Count || childIndex<0) return;
|
||||
bool wasSelected = true;
|
||||
if (OnSelected != null) wasSelected = OnSelected(children[childIndex], children[childIndex].UserData);
|
||||
|
||||
if (!wasSelected) return;
|
||||
|
||||
if (SelectMultiple)
|
||||
{
|
||||
@@ -209,8 +211,6 @@ namespace Barotrauma
|
||||
selected.Add(children[childIndex]);
|
||||
}
|
||||
|
||||
if (OnSelected != null) OnSelected(Selected, Selected.UserData);
|
||||
|
||||
}
|
||||
|
||||
public void Deselect()
|
||||
@@ -228,8 +228,8 @@ namespace Barotrauma
|
||||
totalSize += spacing;
|
||||
}
|
||||
|
||||
scrollBar.BarSize = scrollBar.IsHorizontal ?
|
||||
Math.Min((float)rect.Width / (float)totalSize, 1.0f) :
|
||||
scrollBar.BarSize = scrollBar.IsHorizontal ?
|
||||
Math.Min((float)rect.Width / (float)totalSize, 1.0f) :
|
||||
Math.Min((float)rect.Height / (float)totalSize, 1.0f);
|
||||
|
||||
if (scrollBar.BarSize < 1.0f && scrollBarHidden) ShowScrollBar();
|
||||
@@ -250,7 +250,7 @@ namespace Barotrauma
|
||||
//{
|
||||
// scrollBar.BarScroll = 1.0f;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void ClearChildren()
|
||||
@@ -265,14 +265,14 @@ namespace Barotrauma
|
||||
|
||||
if (selected.Contains(child)) selected.Remove(child);
|
||||
|
||||
UpdateScrollBarSize();
|
||||
UpdateScrollBarSize();
|
||||
}
|
||||
|
||||
private void ShowScrollBar()
|
||||
{
|
||||
if (scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width - scrollBar.Rect.Width, rect.Height);
|
||||
scrollBarHidden = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void HideScrollBar()
|
||||
@@ -280,7 +280,7 @@ namespace Barotrauma
|
||||
if (!scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width + scrollBar.Rect.Width, rect.Height);
|
||||
scrollBarHidden = true;
|
||||
}
|
||||
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!Visible) return;
|
||||
@@ -305,7 +305,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < children.Count; i++ )
|
||||
for (int i = 0; i < children.Count; i++)
|
||||
{
|
||||
GUIComponent child = children[i];
|
||||
if (child == frame) continue;
|
||||
@@ -320,6 +320,7 @@ namespace Barotrauma
|
||||
y += child.Rect.Height + spacing;
|
||||
}
|
||||
|
||||
child.Visible = false;
|
||||
|
||||
if (child.Rect.Y + child.Rect.Height < rect.Y) continue;
|
||||
if (child.Rect.Y + child.Rect.Height > rect.Y + rect.Height) break;
|
||||
@@ -330,7 +331,9 @@ namespace Barotrauma
|
||||
continue;
|
||||
}
|
||||
|
||||
if (enabled && child.CanBeFocused &&
|
||||
child.Visible = true;
|
||||
|
||||
if (enabled && child.CanBeFocused &&
|
||||
(MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition))
|
||||
{
|
||||
child.State = ComponentState.Hover;
|
||||
@@ -346,7 +349,7 @@ namespace Barotrauma
|
||||
|
||||
}
|
||||
}
|
||||
else if(selected.Contains(child))
|
||||
else if (selected.Contains(child))
|
||||
{
|
||||
child.State = ComponentState.Selected;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user