Faction dropdown flags.

This commit is contained in:
Paul Chote
2010-11-28 11:46:14 +13:00
parent 4c517c0e59
commit 45cd6caeec
2 changed files with 18 additions and 7 deletions

View File

@@ -157,7 +157,7 @@ namespace OpenRA.Widgets
ww.OnMouseUp = mi => { var result = origMouseUp(mi); HideDropDown(); return result; }; ww.OnMouseUp = mi => { var result = origMouseUp(mi); HideDropDown(); return result; };
ww.ClickThrough = false; ww.ClickThrough = false;
ww.IsVisible = () => true; ww.IsVisible = () => true;
ww.Bounds = new Rectangle(0, y, ww.Bounds.Width, ww.Bounds.Height); ww.Bounds = new Rectangle(1, y, ww.Bounds.Width, ww.Bounds.Height);
ww.OnMouseMove = mi => ww.OnMouseMove = mi =>
{ {

View File

@@ -253,17 +253,28 @@ namespace OpenRA.Widgets.Delegates
foreach (var c in CountryNames) foreach (var c in CountryNames)
{ {
var cc = c; var cc = c;
dropDownOptions.Add(new Pair<string, Action>( cc.Value, dropDownOptions.Add(new Pair<string, Action>( cc.Key,
() => orderManager.IssueOrder( Order.Command("race "+cc.Key) )) ); () => orderManager.IssueOrder( Order.Command("race "+cc.Key) )) );
}; };
DropDownButtonWidget.ShowDropDown( race, DropDownButtonWidget.ShowDropDown( race,
dropDownOptions, dropDownOptions,
(ac, w) => new LabelWidget (ac, w) =>
{
var ret = new LabelWidget
{ {
Bounds = new Rectangle(0, 0, w, 24), Bounds = new Rectangle(0, 0, w, 24),
Text = " {0}".F(ac.First), Text = " {0}".F(CountryNames[ac.First]),
OnMouseUp = mi => { ac.Second(); return true; }, OnMouseUp = mi => { ac.Second(); return true; },
};
ret.AddChild(new ImageWidget
{
Bounds = new Rectangle(5, 5, 40, 15),
GetImageName = () => ac.First,
GetImageCollection = () => "flags",
});
return ret;
}); });
} }