Hide faction for players who randomed in diplomacy and objectives panels

This commit is contained in:
penev92
2015-03-23 19:24:24 +02:00
parent 3c4d712b78
commit a26be8188c
2 changed files with 15 additions and 3 deletions

View File

@@ -11,6 +11,7 @@
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic namespace OpenRA.Mods.Common.Widgets.Logic
@@ -53,9 +54,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
nameLabel.GetColor = () => pp.Color.RGB; nameLabel.GetColor = () => pp.Color.RGB;
var flag = item.Get<ImageWidget>("FACTIONFLAG"); var flag = item.Get<ImageWidget>("FACTIONFLAG");
flag.GetImageName = () => pp.Country.Race;
flag.GetImageCollection = () => "flags"; flag.GetImageCollection = () => "flags";
if (lp.Stances[pp] == Stance.Ally || lp.WinState != WinState.Undefined)
{
flag.GetImageName = () => pp.Country.Race;
item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name; item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name;
}
else
{
flag.GetImageName = () => pp.PlayerReference.Race;
item.Get<LabelWidget>("FACTION").GetText = () => pp.PlayerReference.Race;
}
var team = item.Get<LabelWidget>("TEAM"); var team = item.Get<LabelWidget>("TEAM");
var teamNumber = (client == null) ? 0 : client.Team; var teamNumber = (client == null) ? 0 : client.Team;

View File

@@ -464,8 +464,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public static void AddPlayerFlagAndName(ScrollItemWidget template, Player player) public static void AddPlayerFlagAndName(ScrollItemWidget template, Player player)
{ {
var flag = template.Get<ImageWidget>("FLAG"); var flag = template.Get<ImageWidget>("FLAG");
flag.GetImageName = () => player.Country.Race;
flag.GetImageCollection = () => "flags"; flag.GetImageCollection = () => "flags";
if (player.World.RenderPlayer != null && player.World.RenderPlayer.Stances[player] != Stance.Ally)
flag.GetImageName = () => player.PlayerReference.Race;
else
flag.GetImageName = () => player.Country.Race;
var playerName = template.Get<LabelWidget>("PLAYER"); var playerName = template.Get<LabelWidget>("PLAYER");
var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex); var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex);