Warning texts when water pressure is increasing to dangerous levels and when running out of oxygen, added a method for invoking an arbitrary action after a delay to CoroutineManager
This commit is contained in:
@@ -32,6 +32,7 @@ namespace Barotrauma
|
||||
get { return size; }
|
||||
}
|
||||
|
||||
public Vector2 Origin;
|
||||
|
||||
public float LifeTime
|
||||
{
|
||||
@@ -39,13 +40,41 @@ namespace Barotrauma
|
||||
set { lifeTime = value; }
|
||||
}
|
||||
|
||||
public GUIMessage(string text, Color color, Vector2 position, float lifeTime)
|
||||
public Alignment Alignment
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool Centered;
|
||||
|
||||
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool centered)
|
||||
{
|
||||
coloredText = new ColoredText(text, color);
|
||||
pos = position;
|
||||
this.lifeTime = lifeTime;
|
||||
this.Alignment = textAlignment;
|
||||
|
||||
size = GUI.Font.MeasureString(text);
|
||||
if (textAlignment.HasFlag(Alignment.Left))
|
||||
Origin.X += size.X * 0.5f;
|
||||
|
||||
if (textAlignment.HasFlag(Alignment.Right))
|
||||
Origin.X -= size.X * 0.5f;
|
||||
|
||||
if (textAlignment.HasFlag(Alignment.Top))
|
||||
Origin.Y += size.Y * 0.5f;
|
||||
|
||||
if (textAlignment.HasFlag(Alignment.Bottom))
|
||||
Origin.Y -= size.Y * 0.5f;
|
||||
|
||||
if (centered)
|
||||
{
|
||||
Origin = new Vector2((int)(0.5f * size.X), (int)(0.5f * size.Y));
|
||||
}
|
||||
else
|
||||
{
|
||||
size = GUI.Font.MeasureString(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user