38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
@@ -11,6 +11,8 @@ namespace Barotrauma
|
||||
|
||||
private Vector2 size;
|
||||
|
||||
public readonly bool WorldSpace;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return coloredText.Text; }
|
||||
@@ -27,57 +29,69 @@ namespace Barotrauma
|
||||
set { pos = value; }
|
||||
}
|
||||
|
||||
public Vector2 Size
|
||||
{
|
||||
get { return size; }
|
||||
}
|
||||
|
||||
public Vector2 Origin;
|
||||
|
||||
public float LifeTime
|
||||
{
|
||||
get { return lifeTime; }
|
||||
set { lifeTime = value; }
|
||||
}
|
||||
|
||||
public Alignment Alignment
|
||||
public Vector2 Velocity
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public Vector2 Size
|
||||
{
|
||||
get { return size; }
|
||||
}
|
||||
|
||||
public Vector2 Origin;
|
||||
|
||||
/// <summary>
|
||||
/// Autocentered messages are automatically placed at the center of the screen and prevented from overlapping with each other
|
||||
/// </summary>
|
||||
public bool AutoCenter;
|
||||
public float Timer;
|
||||
|
||||
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool autoCenter)
|
||||
public float LifeTime
|
||||
{
|
||||
get { return lifeTime; }
|
||||
}
|
||||
|
||||
public ScalableFont Font
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public GUIMessage(string text, Color color, float lifeTime, ScalableFont font = null)
|
||||
{
|
||||
coloredText = new ColoredText(text, color, false);
|
||||
pos = position;
|
||||
this.lifeTime = lifeTime;
|
||||
this.Alignment = textAlignment;
|
||||
this.AutoCenter = autoCenter;
|
||||
Timer = lifeTime;
|
||||
|
||||
size = GUI.Font.MeasureString(text);
|
||||
size = font.MeasureString(text);
|
||||
Origin = new Vector2(0, size.Y * 0.5f);
|
||||
|
||||
Font = font;
|
||||
}
|
||||
|
||||
public GUIMessage(string text, Color color, Vector2 worldPosition, Vector2 velocity, float lifeTime, Alignment textAlignment = Alignment.Center, ScalableFont font = null)
|
||||
{
|
||||
coloredText = new ColoredText(text, color, false);
|
||||
WorldSpace = true;
|
||||
pos = worldPosition;
|
||||
Timer = lifeTime;
|
||||
Velocity = velocity;
|
||||
this.lifeTime = lifeTime;
|
||||
|
||||
Font = font;
|
||||
|
||||
size = font.MeasureString(text);
|
||||
|
||||
Origin = new Vector2((int)(0.5f * size.X), (int)(0.5f * size.Y));
|
||||
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.Right))
|
||||
Origin.X += size.X * 0.5f;
|
||||
|
||||
if (textAlignment.HasFlag(Alignment.Bottom))
|
||||
if (textAlignment.HasFlag(Alignment.Top))
|
||||
Origin.Y -= size.Y * 0.5f;
|
||||
|
||||
if (autoCenter)
|
||||
{
|
||||
Origin = new Vector2((int)(0.5f * size.X), (int)(0.5f * size.Y));
|
||||
}
|
||||
if (textAlignment.HasFlag(Alignment.Bottom))
|
||||
Origin.Y += size.Y * 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user