Fix country names in lobby
This commit is contained in:
@@ -150,7 +150,7 @@ namespace OpenRA.Server
|
|||||||
Index = newConn.PlayerIndex,
|
Index = newConn.PlayerIndex,
|
||||||
PaletteIndex = ChooseFreePalette(),
|
PaletteIndex = ChooseFreePalette(),
|
||||||
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
||||||
Country = "Random",
|
Country = "random",
|
||||||
State = Session.ClientState.NotReady,
|
State = Session.ClientState.NotReady,
|
||||||
SpawnPoint = 0,
|
SpawnPoint = 0,
|
||||||
Team = 0,
|
Team = 0,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
Widget Players, LocalPlayerTemplate, RemotePlayerTemplate;
|
Widget Players, LocalPlayerTemplate, RemotePlayerTemplate;
|
||||||
|
|
||||||
|
Dictionary<string,string> CountryNames;
|
||||||
public LobbyDelegate ()
|
public LobbyDelegate ()
|
||||||
{
|
{
|
||||||
var r = Chrome.rootWidget;
|
var r = Chrome.rootWidget;
|
||||||
@@ -38,6 +39,8 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
LocalPlayerTemplate = Players.GetWidget("TEMPLATE_LOCAL");
|
LocalPlayerTemplate = Players.GetWidget("TEMPLATE_LOCAL");
|
||||||
RemotePlayerTemplate = Players.GetWidget("TEMPLATE_REMOTE");
|
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");
|
var mapButton = lobby.GetWidget("CHANGEMAP_BUTTON");
|
||||||
mapButton.OnMouseUp = mi => {
|
mapButton.OnMouseUp = mi => {
|
||||||
@@ -78,7 +81,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
var faction = template.GetWidget<ButtonWidget>("FACTION");
|
var faction = template.GetWidget<ButtonWidget>("FACTION");
|
||||||
faction.OnMouseUp = CycleRace;
|
faction.OnMouseUp = CycleRace;
|
||||||
var factionname = faction.GetWidget<LabelWidget>("FACTIONNAME");
|
var factionname = faction.GetWidget<LabelWidget>("FACTIONNAME");
|
||||||
factionname.GetText = () => c.Country;
|
factionname.GetText = () => CountryNames[c.Country];
|
||||||
var factionflag = faction.GetWidget<ImageWidget>("FACTIONFLAG");
|
var factionflag = faction.GetWidget<ImageWidget>("FACTIONFLAG");
|
||||||
factionflag.GetImageName = () => c.Country;
|
factionflag.GetImageName = () => c.Country;
|
||||||
factionflag.GetImageCollection = () => "flags";
|
factionflag.GetImageCollection = () => "flags";
|
||||||
@@ -100,7 +103,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
var faction = template.GetWidget<LabelWidget>("FACTION");
|
var faction = template.GetWidget<LabelWidget>("FACTION");
|
||||||
var factionname = faction.GetWidget<LabelWidget>("FACTIONNAME");
|
var factionname = faction.GetWidget<LabelWidget>("FACTIONNAME");
|
||||||
factionname.GetText = () => c.Country;
|
factionname.GetText = () => CountryNames[c.Country];
|
||||||
var factionflag = faction.GetWidget<ImageWidget>("FACTIONFLAG");
|
var factionflag = faction.GetWidget<ImageWidget>("FACTIONFLAG");
|
||||||
factionflag.GetImageName = () => c.Country;
|
factionflag.GetImageName = () => c.Country;
|
||||||
factionflag.GetImageCollection = () => "flags";
|
factionflag.GetImageCollection = () => "flags";
|
||||||
@@ -145,7 +148,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
bool CycleRace(MouseInput mi)
|
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)
|
if (mi.Button == MouseButton.Right)
|
||||||
countries = countries.Reverse();
|
countries = countries.Reverse();
|
||||||
|
|||||||
@@ -199,7 +199,7 @@
|
|||||||
<collection name="flags" src="buttons.png">
|
<collection name="flags" src="buttons.png">
|
||||||
<image name="gdi" x="30" y="84" width="30" height="15" />
|
<image name="gdi" x="30" y="84" width="30" height="15" />
|
||||||
<image name="nod" x="0" 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>
|
||||||
<collection name="music" src="musicplayer.png">
|
<collection name="music" src="musicplayer.png">
|
||||||
<image name="pause" x="0" y="0" width="25" height="25" />
|
<image name="pause" x="0" y="0" width="25" height="25" />
|
||||||
|
|||||||
@@ -192,7 +192,7 @@
|
|||||||
<collection name="flags" src="buttons.png">
|
<collection name="flags" src="buttons.png">
|
||||||
<image name="allies" x="30" y="84" width="30" height="15" />
|
<image name="allies" x="30" y="84" width="30" height="15" />
|
||||||
<image name="soviet" x="0" 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>
|
||||||
<collection name="music" src="musicplayer.png">
|
<collection name="music" src="musicplayer.png">
|
||||||
<image name="pause" x="0" y="0" width="25" height="25" />
|
<image name="pause" x="0" y="0" width="25" height="25" />
|
||||||
|
|||||||
Reference in New Issue
Block a user