Merge pull request #7722 from penev92/bleed_diplomacyWindow
Closes #7391
This commit is contained in:
@@ -27,6 +27,7 @@ namespace OpenRA
|
||||
|
||||
public bool LockRace = false;
|
||||
public string Race;
|
||||
public string RaceFlagName;
|
||||
|
||||
// ColorRamp naming retained for backward compatibility
|
||||
public bool LockColor = false;
|
||||
|
||||
@@ -46,7 +46,9 @@ namespace OpenRA
|
||||
public Shroud Shroud;
|
||||
public World World { get; private set; }
|
||||
|
||||
static CountryInfo ChooseCountry(World world, string name, bool requireSelectable = true)
|
||||
string selectedCountryName;
|
||||
|
||||
CountryInfo ChooseCountry(World world, string name, bool requireSelectable = true)
|
||||
{
|
||||
var selectableCountries = world.Map.Rules.Actors["world"].Traits
|
||||
.WithInterface<CountryInfo>().Where(c => !requireSelectable || c.Selectable)
|
||||
@@ -55,6 +57,8 @@ namespace OpenRA
|
||||
var selected = selectableCountries.FirstOrDefault(c => c.Race == name)
|
||||
?? selectableCountries.Random(world.SharedRandom);
|
||||
|
||||
selectedCountryName = selected.Name;
|
||||
|
||||
// Don't loop infinite
|
||||
for (var i = 0; i <= 10 && selected.RandomRaceMembers.Any(); i++)
|
||||
{
|
||||
@@ -83,6 +87,8 @@ namespace OpenRA
|
||||
PlayerName = client.Name;
|
||||
botType = client.Bot;
|
||||
Country = ChooseCountry(world, client.Race);
|
||||
pr.Race = selectedCountryName;
|
||||
pr.RaceFlagName = client.Race;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
@@ -53,9 +54,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
nameLabel.GetColor = () => pp.Color.RGB;
|
||||
|
||||
var flag = item.Get<ImageWidget>("FACTIONFLAG");
|
||||
flag.GetImageName = () => pp.Country.Race;
|
||||
flag.GetImageCollection = () => "flags";
|
||||
item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name;
|
||||
if (lp.Stances[pp] == Stance.Ally || lp.WinState != WinState.Undefined)
|
||||
{
|
||||
flag.GetImageName = () => pp.Country.Race;
|
||||
item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag.GetImageName = () => pp.PlayerReference.RaceFlagName;
|
||||
item.Get<LabelWidget>("FACTION").GetText = () => pp.PlayerReference.Race;
|
||||
}
|
||||
|
||||
var team = item.Get<LabelWidget>("TEAM");
|
||||
var teamNumber = (client == null) ? 0 : client.Team;
|
||||
|
||||
@@ -464,8 +464,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
public static void AddPlayerFlagAndName(ScrollItemWidget template, Player player)
|
||||
{
|
||||
var flag = template.Get<ImageWidget>("FLAG");
|
||||
flag.GetImageName = () => player.Country.Race;
|
||||
flag.GetImageCollection = () => "flags";
|
||||
if (player.World.RenderPlayer != null && player.World.RenderPlayer.Stances[player] != Stance.Ally)
|
||||
flag.GetImageName = () => player.PlayerReference.RaceFlagName;
|
||||
else
|
||||
flag.GetImageName = () => player.Country.Race;
|
||||
|
||||
var playerName = template.Get<LabelWidget>("PLAYER");
|
||||
var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex);
|
||||
|
||||
Reference in New Issue
Block a user