move TextAlign out of LabelWidget

This commit is contained in:
Chris Forbes
2011-10-08 17:20:29 +13:00
parent 12b8774e6d
commit be8682fc19
3 changed files with 8 additions and 7 deletions

View File

@@ -14,10 +14,11 @@ using OpenRA.Graphics;
namespace OpenRA.Widgets namespace OpenRA.Widgets
{ {
public class LabelWidget : Widget
{
public enum TextAlign { Left, Center, Right } public enum TextAlign { Left, Center, Right }
public enum TextVAlign { Top, Middle, Bottom } public enum TextVAlign { Top, Middle, Bottom }
public class LabelWidget : Widget
{
public string Text = null; public string Text = null;
public TextAlign Align = TextAlign.Left; public TextAlign Align = TextAlign.Left;
public TextVAlign VAlign = TextVAlign.Middle; public TextVAlign VAlign = TextVAlign.Middle;

View File

@@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
Font = "Bold", Font = "Bold",
Bounds = new Rectangle(margin + labelWidth + 10, y, labelWidth, 25), Bounds = new Rectangle(margin + labelWidth + 10, y, labelWidth, 25),
Text = "Their Stance", Text = "Their Stance",
Align = LabelWidget.TextAlign.Left, Align = TextAlign.Left,
}; };
bg.AddChild(ts); bg.AddChild(ts);
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
Font = "Bold", Font = "Bold",
Bounds = new Rectangle(margin + 2 * labelWidth + 20, y, labelWidth, 25), Bounds = new Rectangle(margin + 2 * labelWidth + 20, y, labelWidth, 25),
Text = "My Stance", Text = "My Stance",
Align = LabelWidget.TextAlign.Left, Align = TextAlign.Left,
}; };
bg.AddChild(ms); bg.AddChild(ms);
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{ {
Bounds = new Rectangle(margin, y, labelWidth, 25), Bounds = new Rectangle(margin, y, labelWidth, 25),
Text = p.PlayerName, Text = p.PlayerName,
Align = LabelWidget.TextAlign.Left, Align = TextAlign.Left,
Font = "Bold", Font = "Bold",
Color = p.ColorRamp.GetColor(0), Color = p.ColorRamp.GetColor(0),
}; };
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{ {
Bounds = new Rectangle( margin + labelWidth + 10, y, labelWidth, 25), Bounds = new Rectangle( margin + labelWidth + 10, y, labelWidth, 25),
Text = p.PlayerName, Text = p.PlayerName,
Align = LabelWidget.TextAlign.Left, Align = TextAlign.Left,
GetText = () => pp.Stances[ world.LocalPlayer ].ToString(), GetText = () => pp.Stances[ world.LocalPlayer ].ToString(),
}; };

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{ {
itemTemplate.IsVisible = () => true; itemTemplate.IsVisible = () => true;
itemTemplate.GetWidget<LabelWidget>("TITLE").GetText = () => "No Music Installed"; itemTemplate.GetWidget<LabelWidget>("TITLE").GetText = () => "No Music Installed";
itemTemplate.GetWidget<LabelWidget>("TITLE").Align = LabelWidget.TextAlign.Center; itemTemplate.GetWidget<LabelWidget>("TITLE").Align = TextAlign.Center;
} }
foreach (var kv in Rules.InstalledMusic) foreach (var kv in Rules.InstalledMusic)