Fix country names in lobby
This commit is contained in:
@@ -150,7 +150,7 @@ namespace OpenRA.Server
|
||||
Index = newConn.PlayerIndex,
|
||||
PaletteIndex = ChooseFreePalette(),
|
||||
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
||||
Country = "Random",
|
||||
Country = "random",
|
||||
State = Session.ClientState.NotReady,
|
||||
SpawnPoint = 0,
|
||||
Team = 0,
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
{
|
||||
Widget Players, LocalPlayerTemplate, RemotePlayerTemplate;
|
||||
|
||||
Dictionary<string,string> CountryNames;
|
||||
public LobbyDelegate ()
|
||||
{
|
||||
var r = Chrome.rootWidget;
|
||||
@@ -38,6 +39,8 @@ namespace OpenRA.Widgets.Delegates
|
||||
LocalPlayerTemplate = Players.GetWidget("TEMPLATE_LOCAL");
|
||||
RemotePlayerTemplate = Players.GetWidget("TEMPLATE_REMOTE");
|
||||
|
||||
CountryNames = Rules.Info["world"].Traits.WithInterface<OpenRA.Traits.CountryInfo>().ToDictionary(a => a.Race, a => a.Name);
|
||||
CountryNames.Add("random", "Random");
|
||||
|
||||
var mapButton = lobby.GetWidget("CHANGEMAP_BUTTON");
|
||||
mapButton.OnMouseUp = mi => {
|
||||
@@ -78,7 +81,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
var faction = template.GetWidget<ButtonWidget>("FACTION");
|
||||
faction.OnMouseUp = CycleRace;
|
||||
var factionname = faction.GetWidget<LabelWidget>("FACTIONNAME");
|
||||
factionname.GetText = () => c.Country;
|
||||
factionname.GetText = () => CountryNames[c.Country];
|
||||
var factionflag = faction.GetWidget<ImageWidget>("FACTIONFLAG");
|
||||
factionflag.GetImageName = () => c.Country;
|
||||
factionflag.GetImageCollection = () => "flags";
|
||||
@@ -100,7 +103,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
var faction = template.GetWidget<LabelWidget>("FACTION");
|
||||
var factionname = faction.GetWidget<LabelWidget>("FACTIONNAME");
|
||||
factionname.GetText = () => c.Country;
|
||||
factionname.GetText = () => CountryNames[c.Country];
|
||||
var factionflag = faction.GetWidget<ImageWidget>("FACTIONFLAG");
|
||||
factionflag.GetImageName = () => c.Country;
|
||||
factionflag.GetImageCollection = () => "flags";
|
||||
@@ -142,10 +145,10 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CycleRace(MouseInput mi)
|
||||
{
|
||||
var countries = new[] { "Random" }.Concat(Game.world.GetCountries().Select(c => c.Race));
|
||||
var countries = CountryNames.Select(a => a.Key);
|
||||
|
||||
if (mi.Button == MouseButton.Right)
|
||||
countries = countries.Reverse();
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<image name="bottom" x="297" y="223" width="210" height="30" />
|
||||
<image name="bg" x="306" y="31" width="192" height="192" />
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
</collection>
|
||||
</collection>
|
||||
|
||||
<collection name="power-gdi" src="chrome-gdi.png">
|
||||
<collection name="power-gdi" src="chrome-gdi.png">
|
||||
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
|
||||
</collection>
|
||||
<collection name="palette-gdi" src="chrome-gdi.png">
|
||||
@@ -58,11 +58,11 @@
|
||||
<image name="bottom" x="297" y="223" width="210" height="30" />
|
||||
<image name="bg" x="306" y="31" width="192" height="192" />
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
</collection>
|
||||
</collection>
|
||||
|
||||
<collection name="power-nod" src="chrome-nod.png">
|
||||
<collection name="power-nod" src="chrome-nod.png">
|
||||
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
|
||||
</collection>
|
||||
<collection name="palette-nod" src="chrome-nod.png">
|
||||
@@ -199,7 +199,7 @@
|
||||
<collection name="flags" src="buttons.png">
|
||||
<image name="gdi" x="30" y="84" width="30" height="15" />
|
||||
<image name="nod" x="0" y="84" width="30" height="15" />
|
||||
<image name="Random" x="60" y="84" width="30" height="15" />
|
||||
<image name="random" x="60" y="84" width="30" height="15" />
|
||||
</collection>
|
||||
<collection name="music" src="musicplayer.png">
|
||||
<image name="pause" x="0" y="0" width="25" height="25" />
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<image name="right" x="498" y="31" width="9" height="192" />
|
||||
<image name="bottom" x="297" y="223" width="210" height="30" />
|
||||
<image name="bg" x="306" y="31" width="192" height="192" />
|
||||
</collection>
|
||||
<collection name="power-allies" src="chrome-allies.png">
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
</collection>
|
||||
<collection name="power-allies" src="chrome-allies.png">
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
</collection>
|
||||
<collection name="palette-allies" src="chrome-allies.png">
|
||||
<image name="top" x="297" y="288" width="201" height="9" />
|
||||
@@ -54,9 +54,9 @@
|
||||
<image name="bottom" x="297" y="223" width="210" height="30" />
|
||||
<image name="bg" x="306" y="31" width="192" height="192" />
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
</collection>
|
||||
<collection name="power-soviet" src="chrome-soviet.png">
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
</collection>
|
||||
<collection name="power-soviet" src="chrome-soviet.png">
|
||||
<image name="power-indicator" x="187" y="4" width="4" height="7" />
|
||||
</collection>
|
||||
<collection name="palette-soviet" src="chrome-soviet.png">
|
||||
<image name="top" x="297" y="288" width="201" height="9" />
|
||||
@@ -192,7 +192,7 @@
|
||||
<collection name="flags" src="buttons.png">
|
||||
<image name="allies" x="30" y="84" width="30" height="15" />
|
||||
<image name="soviet" x="0" y="84" width="30" height="15" />
|
||||
<image name="Random" x="60" y="84" width="30" height="15" />
|
||||
<image name="random" x="60" y="84" width="30" height="15" />
|
||||
</collection>
|
||||
<collection name="music" src="musicplayer.png">
|
||||
<image name="pause" x="0" y="0" width="25" height="25" />
|
||||
|
||||
Reference in New Issue
Block a user