(f36b3a111) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-04-08 19:17:50 +03:00
parent 5a9b681c13
commit 71d546ff7f
7 changed files with 115 additions and 69 deletions
@@ -8,7 +8,7 @@ using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
partial class Repairable : ItemComponent
partial class Repairable : ItemComponent, IDrawableComponent
{
private GUIButton repairButton;
private GUIProgressBar progressBar;
@@ -25,7 +25,13 @@ namespace Barotrauma.Items.Components
get;
set;
}
public Vector2 DrawSize
{
//use the extents of the item as the draw size
get { return Vector2.Zero; }
}
public override bool ShouldDrawHUD(Character character)
{
if (!HasRequiredItems(character, false) || character.SelectedConstruction != item) return false;
@@ -98,7 +104,7 @@ namespace Barotrauma.Items.Components
}
}
}
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
IsActive = true;
@@ -137,5 +143,28 @@ namespace Barotrauma.Items.Components
{
//no need to write anything, just letting the server know we started repairing
}
public void Draw(SpriteBatch spriteBatch, bool editing)
{
if (GameMain.DebugDraw && Character.Controlled?.FocusedItem == item)
{
bool paused = !ShouldDeteriorate();
if (deteriorationTimer > 0.0f)
{
GUI.DrawString(spriteBatch,
new Vector2(item.WorldPosition.X, -item.WorldPosition.Y), "Deterioration delay " + ((int)deteriorationTimer) + (paused ? " [PAUSED]" : ""),
paused ? Color.Cyan : Color.Lime, Color.Black * 0.5f);
}
else
{
GUI.DrawString(spriteBatch,
new Vector2(item.WorldPosition.X, -item.WorldPosition.Y), "Deteriorating at " + (int)(DeteriorationSpeed * 60.0f) + " units/min" + (paused ? " [PAUSED]" : ""),
paused ? Color.Cyan : Color.Red, Color.Black * 0.5f);
}
GUI.DrawString(spriteBatch,
new Vector2(item.WorldPosition.X, -item.WorldPosition.Y + 20), "Condition: " + (int)item.Condition + "/" + (int)item.MaxCondition,
Color.Orange);
}
}
}
}