diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 35545cb786..5f95edb4db 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -238,6 +238,7 @@ + diff --git a/OpenRA.Game/Traits/World/Country.cs b/OpenRA.Game/Traits/World/Country.cs index f7d6fa850e..5a3aa95855 100644 --- a/OpenRA.Game/Traits/World/Country.cs +++ b/OpenRA.Game/Traits/World/Country.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. diff --git a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs index 634c5be1a8..6c5b9cad3a 100644 --- a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs @@ -81,6 +81,11 @@ namespace OpenRA.Widgets.Delegates faction.OnMouseUp = CycleRace; faction.GetText = () => c.Country; + //TODO: make part of button? + var factionflag = template.GetWidget("FACTIONFLAG"); + factionflag.GetImageName = () => c.Country; + factionflag.GetImageCollection = () => "flags"; + var spawn = template.GetWidget("SPAWN"); spawn.OnMouseUp = CycleSpawnPoint; spawn.GetText = () => (c.SpawnPoint == 0) ? "-" : c.SpawnPoint.ToString(); @@ -101,6 +106,10 @@ namespace OpenRA.Widgets.Delegates var faction = template.GetWidget("FACTION"); faction.GetText = () => c.Country; + var factionflag = template.GetWidget("FACTIONFLAG"); + factionflag.GetImageName = () => c.Country; + factionflag.GetImageCollection = () => "flags"; + var spawn = template.GetWidget("SPAWN"); spawn.GetText = () => (c.SpawnPoint == 0) ? "-" : c.SpawnPoint.ToString(); diff --git a/OpenRA.Game/Widgets/ImageWidget.cs b/OpenRA.Game/Widgets/ImageWidget.cs new file mode 100644 index 0000000000..3008b710a0 --- /dev/null +++ b/OpenRA.Game/Widgets/ImageWidget.cs @@ -0,0 +1,41 @@ + +using System; +using OpenRA.Graphics; + +namespace OpenRA.Widgets +{ + public class ImageWidget : Widget + { + public string ImageCollection = ""; + public string ImageName = ""; + public Func GetImageName; + public Func GetImageCollection; + + public ImageWidget () + : base() + { + GetImageName = () => { return ImageName; }; + GetImageCollection = () => { return ImageCollection; }; + } + + public ImageWidget(Widget other) + : base(other) + { + ImageName = (other as ImageWidget).ImageName; + GetImageName = (other as ImageWidget).GetImageName; + } + + public override Widget Clone() + { + return new ImageWidget(this); + } + + public override void DrawInner(World world) + { + var name = GetImageName(); + var collection = GetImageCollection(); + var position = DrawPosition(); + WidgetUtils.DrawRGBA(ChromeProvider.GetImage(Game.chrome.renderer, collection, name), position); + } + } +} diff --git a/mods/cnc/chrome.xml b/mods/cnc/chrome.xml index 4223aa0023..0c7c9132c4 100644 --- a/mods/cnc/chrome.xml +++ b/mods/cnc/chrome.xml @@ -13,8 +13,11 @@ - + + + + @@ -56,8 +59,11 @@ - + + + + @@ -190,4 +196,9 @@ + + + + + diff --git a/mods/cnc/menus.yaml b/mods/cnc/menus.yaml index 9ec0c3938b..3a8f125cc7 100644 --- a/mods/cnc/menus.yaml +++ b/mods/cnc/menus.yaml @@ -340,10 +340,16 @@ Container: Button@FACTION: Id:FACTION Text:Faction - Width:90 + Width:60 Height:25 X:180 Y:0 + Image@FACTIONFLAG: + Id:FACTIONFLAG + Width:30 + Height:25 + X:235 + Y:0 Button@SPAWN: Id:SPAWN Text:Spawn @@ -388,11 +394,17 @@ Container: Label@FACTION: Id:FACTION Text:Faction - Width:90 + Width:60 Height:25 X:180 Y:0 Align:Center + Image@FACTIONFLAG: + Id:FACTIONFLAG + Width:30 + Height:25 + X:235 + Y:0 Label@SPAWN: Id:SPAWN Text:Spawn diff --git a/mods/ra/chrome.xml b/mods/ra/chrome.xml index 14c5402cc7..d183b31b7a 100644 --- a/mods/ra/chrome.xml +++ b/mods/ra/chrome.xml @@ -188,5 +188,10 @@ + + + + + diff --git a/mods/ra/menus.yaml b/mods/ra/menus.yaml index 9ec0c3938b..3a8f125cc7 100644 --- a/mods/ra/menus.yaml +++ b/mods/ra/menus.yaml @@ -340,10 +340,16 @@ Container: Button@FACTION: Id:FACTION Text:Faction - Width:90 + Width:60 Height:25 X:180 Y:0 + Image@FACTIONFLAG: + Id:FACTIONFLAG + Width:30 + Height:25 + X:235 + Y:0 Button@SPAWN: Id:SPAWN Text:Spawn @@ -388,11 +394,17 @@ Container: Label@FACTION: Id:FACTION Text:Faction - Width:90 + Width:60 Height:25 X:180 Y:0 Align:Center + Image@FACTIONFLAG: + Id:FACTIONFLAG + Width:30 + Height:25 + X:235 + Y:0 Label@SPAWN: Id:SPAWN Text:Spawn