HUDProgressBars are drawn over the LOS effect, progressbar not displayed when attempting to weld/cut platforms

This commit is contained in:
Regalis
2016-09-20 19:36:58 +03:00
parent 5918e845ac
commit 96a61ab2ea
4 changed files with 23 additions and 22 deletions
+6 -14
View File
@@ -303,6 +303,11 @@ namespace Barotrauma
} }
} }
public Dictionary<object, HUDProgressBar> HUDProgressBars
{
get { return hudProgressBars; }
}
public HuskInfection huskInfection; public HuskInfection huskInfection;
public float HuskInfectionState public float HuskInfectionState
{ {
@@ -1289,10 +1294,6 @@ namespace Barotrauma
if (!Enabled) return; if (!Enabled) return;
AnimController.Draw(spriteBatch); AnimController.Draw(spriteBatch);
//GUI.DrawLine(spriteBatch, ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y),
// ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y) +
// ConvertUnits.ToDisplayUnits(animController.targetMovement.X, animController.targetMovement.Y), Color.Green);
} }
public void DrawHUD(SpriteBatch spriteBatch, Camera cam) public void DrawHUD(SpriteBatch spriteBatch, Camera cam)
@@ -1304,7 +1305,6 @@ namespace Barotrauma
{ {
if (!Enabled) return; if (!Enabled) return;
if (GameMain.DebugDraw) if (GameMain.DebugDraw)
{ {
AnimController.DebugDraw(spriteBatch); AnimController.DebugDraw(spriteBatch);
@@ -1312,15 +1312,7 @@ namespace Barotrauma
if (aiTarget != null) aiTarget.Draw(spriteBatch); if (aiTarget != null) aiTarget.Draw(spriteBatch);
} }
if (this == controlled) if (this == controlled) return;
{
foreach (HUDProgressBar progressBar in hudProgressBars.Values)
{
progressBar.Draw(spriteBatch);
}
return;
}
Vector2 pos = DrawPosition; Vector2 pos = DrawPosition;
pos.Y = -pos.Y; pos.Y = -pos.Y;
@@ -151,6 +151,11 @@ namespace Barotrauma
textPos.Y += 25; textPos.Y += 25;
} }
} }
foreach (HUDProgressBar progressBar in character.HUDProgressBars.Values)
{
progressBar.Draw(spriteBatch, cam);
}
} }
if (Screen.Selected == GameMain.EditMapScreen) return; if (Screen.Selected == GameMain.EditMapScreen) return;
@@ -44,17 +44,20 @@ namespace Barotrauma
FadeTimer -= deltatime; FadeTimer -= deltatime;
} }
public void Draw(SpriteBatch spriteBatch) public void Draw(SpriteBatch spriteBatch, Camera cam)
{ {
float a = Math.Min(FadeTimer,1.0f); float a = Math.Min(FadeTimer, 1.0f);
Vector2 pos = cam.WorldToScreen(
new Vector2(WorldPosition.X - Size.X / 2, WorldPosition.Y + Size.Y / 2));
pos.Y = -pos.Y;
GUI.DrawProgressBar(spriteBatch, GUI.DrawProgressBar(spriteBatch,
new Vector2(WorldPosition.X - Size.X/2, (WorldPosition.Y + Size.Y/2)), pos,
Size, progress, Size, progress,
Color.Lerp(emptyColor, fullColor, progress) * a, Color.Lerp(emptyColor, fullColor, progress) * a,
Color.White * a * 0.8f); Color.White * a * 0.8f);
} }
} }
} }
@@ -178,6 +178,7 @@ namespace Barotrauma.Items.Components
if ((targetStructure = (targetBody.UserData as Structure)) != null) if ((targetStructure = (targetBody.UserData as Structure)) != null)
{ {
if (!fixableEntities.Contains(targetStructure.Name)) return; if (!fixableEntities.Contains(targetStructure.Name)) return;
if (targetStructure.IsPlatform) return;
int sectionIndex = targetStructure.FindSectionIndex(ConvertUnits.ToDisplayUnits(pickedPosition)); int sectionIndex = targetStructure.FindSectionIndex(ConvertUnits.ToDisplayUnits(pickedPosition));
if (sectionIndex < 0) return; if (sectionIndex < 0) return;