GUI elements now respect render order + some minor distance comparison optimization
This commit is contained in:
@@ -469,6 +469,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public virtual void DrawHUD(SpriteBatch spriteBatch, Character character) { }
|
||||
|
||||
public virtual void AddToGUIUpdateList() { }
|
||||
|
||||
public virtual void UpdateHUD(Character character) { }
|
||||
|
||||
/// <returns>true if the operation was completed</returns>
|
||||
|
||||
@@ -85,6 +85,11 @@ namespace Barotrauma.Items.Components
|
||||
GuiFrame.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update((float)Timing.Step);
|
||||
|
||||
@@ -116,7 +116,11 @@ namespace Barotrauma.Items.Components
|
||||
//GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true);
|
||||
|
||||
spriteBatch.DrawString(GUI.Font, "Force: " + (int)(targetForce) + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White);
|
||||
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
|
||||
@@ -385,6 +385,11 @@ namespace Barotrauma.Items.Components
|
||||
GuiFrame.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
FabricableItem targetItem = itemList.SelectedData as FabricableItem;
|
||||
|
||||
@@ -162,6 +162,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update(1.0f / 60.0f);
|
||||
|
||||
@@ -62,6 +62,7 @@ namespace Barotrauma.Items.Components
|
||||
return true;
|
||||
};
|
||||
|
||||
GuiFrame.CanBeFocused = false;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
@@ -100,6 +101,11 @@ namespace Barotrauma.Items.Components
|
||||
return pingState > 1.0f;
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update((float)Timing.Step);
|
||||
|
||||
@@ -479,6 +479,11 @@ namespace Barotrauma.Items.Components
|
||||
//y = y - 260;
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update(1.0f / 60.0f);
|
||||
|
||||
@@ -214,20 +214,28 @@ namespace Barotrauma.Items.Components
|
||||
if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(velRect.Center.X, velRect.Center.Y)) < 200.0f)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)targetVelPos.X -10, (int)targetVelPos.Y - 10, 20, 20), Color.Red);
|
||||
|
||||
if (PlayerInput.LeftButtonHeld())
|
||||
{
|
||||
TargetVelocity = PlayerInput.MousePosition - new Vector2(velRect.Center.X, velRect.Center.Y);
|
||||
targetVelocity.Y = -targetVelocity.Y;
|
||||
|
||||
valueChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update(1.0f / 60.0f);
|
||||
|
||||
if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f)
|
||||
{
|
||||
if (PlayerInput.LeftButtonHeld())
|
||||
{
|
||||
TargetVelocity = PlayerInput.MousePosition - new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y);
|
||||
targetVelocity.Y = -targetVelocity.Y;
|
||||
|
||||
valueChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAutoPilot(float deltaTime)
|
||||
|
||||
@@ -246,6 +246,11 @@ namespace Barotrauma.Items.Components
|
||||
spriteBatch.DrawString(GUI.Font, "Recharge rate: " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", new Vector2(x + 30, y + 95), Color.White);
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update(1.0f / 60.0f);
|
||||
|
||||
@@ -181,6 +181,11 @@ namespace Barotrauma.Items.Components
|
||||
spriteBatch.DrawString(GUI.Font, "Load: " + (int)powerLoad + " kW", new Vector2(x + 30, y + 100), Color.White);
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update(1.0f / 60.0f);
|
||||
|
||||
Reference in New Issue
Block a user