Clean ObserverShroudSelectorLogic.cs of "race"
This commit is contained in:
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public readonly Player Player;
|
public readonly Player Player;
|
||||||
public readonly string Label;
|
public readonly string Label;
|
||||||
public readonly Color Color;
|
public readonly Color Color;
|
||||||
public readonly string Race;
|
public readonly string Faction;
|
||||||
public readonly Func<bool> IsSelected;
|
public readonly Func<bool> IsSelected;
|
||||||
public readonly Action OnClick;
|
public readonly Action OnClick;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Player = p;
|
Player = p;
|
||||||
Label = p.PlayerName;
|
Label = p.PlayerName;
|
||||||
Color = p.Color.RGB;
|
Color = p.Color.RGB;
|
||||||
Race = p.Faction.InternalName;
|
Faction = p.Faction.InternalName;
|
||||||
IsSelected = () => p.World.RenderPlayer == p;
|
IsSelected = () => p.World.RenderPlayer == p;
|
||||||
OnClick = () => { p.World.RenderPlayer = p; logic.selected = this; p.World.Selection.Clear(); };
|
OnClick = () => { p.World.RenderPlayer = p; logic.selected = this; p.World.Selection.Clear(); };
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Player = p;
|
Player = p;
|
||||||
Label = label;
|
Label = label;
|
||||||
Color = Color.White;
|
Color = Color.White;
|
||||||
Race = null;
|
Faction = null;
|
||||||
IsSelected = () => w.RenderPlayer == p;
|
IsSelected = () => w.RenderPlayer == p;
|
||||||
OnClick = () => { w.RenderPlayer = p; logic.selected = this; };
|
OnClick = () => { w.RenderPlayer = p; logic.selected = this; };
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Func<CameraOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
Func<CameraOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(template, option.IsSelected, option.OnClick);
|
var item = ScrollItemWidget.Setup(template, option.IsSelected, option.OnClick);
|
||||||
var showFlag = option.Race != null;
|
var showFlag = option.Faction != null;
|
||||||
|
|
||||||
var label = item.Get<LabelWidget>("LABEL");
|
var label = item.Get<LabelWidget>("LABEL");
|
||||||
label.IsVisible = () => showFlag;
|
label.IsVisible = () => showFlag;
|
||||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var flag = item.Get<ImageWidget>("FLAG");
|
var flag = item.Get<ImageWidget>("FLAG");
|
||||||
flag.IsVisible = () => showFlag;
|
flag.IsVisible = () => showFlag;
|
||||||
flag.GetImageCollection = () => "flags";
|
flag.GetImageCollection = () => "flags";
|
||||||
flag.GetImageName = () => option.Race;
|
flag.GetImageName = () => option.Faction;
|
||||||
|
|
||||||
var labelAlt = item.Get<LabelWidget>("NOFLAG_LABEL");
|
var labelAlt = item.Get<LabelWidget>("NOFLAG_LABEL");
|
||||||
labelAlt.IsVisible = () => !showFlag;
|
labelAlt.IsVisible = () => !showFlag;
|
||||||
@@ -109,17 +109,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
|
|
||||||
var shroudLabel = shroudSelector.Get<LabelWidget>("LABEL");
|
var shroudLabel = shroudSelector.Get<LabelWidget>("LABEL");
|
||||||
shroudLabel.IsVisible = () => selected.Race != null;
|
shroudLabel.IsVisible = () => selected.Faction != null;
|
||||||
shroudLabel.GetText = () => selected.Label;
|
shroudLabel.GetText = () => selected.Label;
|
||||||
shroudLabel.GetColor = () => selected.Color;
|
shroudLabel.GetColor = () => selected.Color;
|
||||||
|
|
||||||
var shroudFlag = shroudSelector.Get<ImageWidget>("FLAG");
|
var shroudFlag = shroudSelector.Get<ImageWidget>("FLAG");
|
||||||
shroudFlag.IsVisible = () => selected.Race != null;
|
shroudFlag.IsVisible = () => selected.Faction != null;
|
||||||
shroudFlag.GetImageCollection = () => "flags";
|
shroudFlag.GetImageCollection = () => "flags";
|
||||||
shroudFlag.GetImageName = () => selected.Race;
|
shroudFlag.GetImageName = () => selected.Faction;
|
||||||
|
|
||||||
var shroudLabelAlt = shroudSelector.Get<LabelWidget>("NOFLAG_LABEL");
|
var shroudLabelAlt = shroudSelector.Get<LabelWidget>("NOFLAG_LABEL");
|
||||||
shroudLabelAlt.IsVisible = () => selected.Race == null;
|
shroudLabelAlt.IsVisible = () => selected.Faction == null;
|
||||||
shroudLabelAlt.GetText = () => selected.Label;
|
shroudLabelAlt.GetText = () => selected.Label;
|
||||||
shroudLabelAlt.GetColor = () => selected.Color;
|
shroudLabelAlt.GetColor = () => selected.Color;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user