Merge pull request #8975 from penev92/bleed_rename

Some more renaming from "country" and "race" to "faction"
This commit is contained in:
Matthias Mailänder
2015-08-08 16:13:16 +02:00
11 changed files with 49 additions and 48 deletions

View File

@@ -104,19 +104,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
dropdown.ShowDropDown("SPAWN_DROPDOWN_TEMPLATE", 150, spawnPoints, setupItem);
}
public static void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client,
public static void ShowFactionDropDown(DropDownButtonWidget dropdown, Session.Client client,
OrderManager orderManager, Dictionary<string, LobbyFaction> factions)
{
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (race, itemTemplate) =>
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (factionId, itemTemplate) =>
{
var item = ScrollItemWidget.Setup(itemTemplate,
() => client.Race == race,
() => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, race))));
var faction = factions[race];
() => client.Faction == factionId,
() => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, factionId))));
var faction = factions[factionId];
item.Get<LabelWidget>("LABEL").GetText = () => faction.Name;
var flag = item.Get<ImageWidget>("FLAG");
flag.GetImageCollection = () => "flags";
flag.GetImageName = () => race;
flag.GetImageName = () => factionId;
item.GetTooltipText = () => faction.Description;
return item;
};
@@ -398,9 +398,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Dictionary<string, LobbyFaction> factions)
{
var dropdown = parent.Get<DropDownButtonWidget>("FACTION");
dropdown.IsDisabled = () => s.LockRace || orderManager.LocalClient.IsReady;
dropdown.OnMouseDown = _ => ShowRaceDropDown(dropdown, c, orderManager, factions);
var factionDescription = factions[c.Race].Description;
dropdown.IsDisabled = () => s.LockFaction || orderManager.LocalClient.IsReady;
dropdown.OnMouseDown = _ => ShowFactionDropDown(dropdown, c, orderManager, factions);
var factionDescription = factions[c.Faction].Description;
dropdown.GetTooltipText = () => factionDescription;
SetupFactionWidget(dropdown, s, c, factions);
}
@@ -409,9 +409,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Dictionary<string, LobbyFaction> factions)
{
var factionName = parent.Get<LabelWidget>("FACTIONNAME");
factionName.GetText = () => factions[c.Race].Name;
factionName.GetText = () => factions[c.Faction].Name;
var factionFlag = parent.Get<ImageWidget>("FACTIONFLAG");
factionFlag.GetImageName = () => c.Race;
factionFlag.GetImageName = () => c.Faction;
factionFlag.GetImageCollection = () => "flags";
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var cachedWidth = 0;
var labelText = "";
string playerCountry = null;
string playerFaction = null;
var playerTeam = -1;
tooltipContainer.BeforeRender = () =>
@@ -44,20 +44,20 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (occupant == null)
{
labelText = "Available spawn";
playerCountry = null;
playerFaction = null;
playerTeam = 0;
widget.Bounds.Height = singleHeight;
}
else
{
labelText = occupant.PlayerName;
playerCountry = occupant.Country;
playerFaction = occupant.Faction;
playerTeam = occupant.Team;
widget.Bounds.Height = playerTeam > 0 ? doubleHeight : singleHeight;
teamWidth = teamFont.Measure(team.GetText()).X;
}
label.Bounds.X = playerCountry != null ? flag.Bounds.Right + labelMargin : labelMargin;
label.Bounds.X = playerFaction != null ? flag.Bounds.Right + labelMargin : labelMargin;
var textWidth = ownerFont.Measure(labelText).X;
if (textWidth != cachedWidth)
@@ -71,9 +71,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
label.GetText = () => labelText;
flag.IsVisible = () => playerCountry != null;
flag.IsVisible = () => playerFaction != null;
flag.GetImageCollection = () => "flags";
flag.GetImageName = () => playerCountry;
flag.GetImageName = () => playerFaction;
team.GetText = () => "Team {0}".F(playerTeam);
team.IsVisible = () => playerTeam > 0;
}

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Widgets
public readonly int ClientIndex;
public readonly string PlayerName;
public readonly int Team;
public readonly string Country;
public readonly string Faction;
public readonly int SpawnPoint;
public SpawnOccupant(Session.Client client)
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets
ClientIndex = client.Index;
PlayerName = client.Name;
Team = client.Team;
Country = client.Race;
Faction = client.Faction;
SpawnPoint = client.SpawnPoint;
}
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets
ClientIndex = player.ClientIndex;
PlayerName = player.Name;
Team = player.Team;
Country = player.FactionId;
Faction = player.FactionId;
SpawnPoint = player.SpawnPoint;
}
}