Replace DrawTargetLine checkbox with an Automatic/Manual/Disabled dropdown.
This commit is contained in:
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
|
||||
IEnumerable<IRenderable> RenderInner(WorldRenderer wr)
|
||||
{
|
||||
if (Game.Settings.Game.DrawTargetLine)
|
||||
if (Game.Settings.Game.TargetLines != TargetLinesType.Disabled)
|
||||
yield return new TargetLineRenderable(targetLine, building.Owner.Color, rp.Info.LineWidth);
|
||||
|
||||
if (circles != null || flag != null)
|
||||
|
||||
@@ -45,6 +45,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void ShowTargetLines(Actor self)
|
||||
{
|
||||
if (Game.Settings.Game.TargetLines < TargetLinesType.Automatic)
|
||||
return;
|
||||
|
||||
// Target lines are only automatically shown for the owning player
|
||||
// Spectators and allies must use the force-display modifier
|
||||
if (self.IsIdle || self.Owner != self.World.LocalPlayer)
|
||||
@@ -61,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<IRenderable> IRenderAboveShroudWhenSelected.RenderAboveShroud(Actor self, WorldRenderer wr)
|
||||
{
|
||||
if (!self.Owner.IsAlliedWith(self.World.LocalPlayer))
|
||||
if (!self.Owner.IsAlliedWith(self.World.LocalPlayer) || Game.Settings.Game.TargetLines == TargetLinesType.Disabled)
|
||||
return Enumerable.Empty<IRenderable>();
|
||||
|
||||
// Players want to see the lines when in waypoint mode.
|
||||
@@ -70,9 +73,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (--lifetime <= 0 && !force)
|
||||
return Enumerable.Empty<IRenderable>();
|
||||
|
||||
if (!(force || Game.Settings.Game.DrawTargetLine))
|
||||
return Enumerable.Empty<IRenderable>();
|
||||
|
||||
renderableCache.Clear();
|
||||
var prev = self.CenterPosition;
|
||||
var a = self.CurrentActivity;
|
||||
|
||||
@@ -205,7 +205,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
BindCheckboxPref(panel, "PIXELDOUBLE_CHECKBOX", ds, "PixelDouble");
|
||||
BindCheckboxPref(panel, "CURSORDOUBLE_CHECKBOX", ds, "CursorDouble");
|
||||
BindCheckboxPref(panel, "FRAME_LIMIT_CHECKBOX", ds, "CapFramerate");
|
||||
BindCheckboxPref(panel, "DISPLAY_TARGET_LINES_CHECKBOX", gs, "DrawTargetLine");
|
||||
BindCheckboxPref(panel, "PLAYER_STANCE_COLORS_CHECKBOX", gs, "UsePlayerStanceColors");
|
||||
|
||||
var languageDropDownButton = panel.Get<DropDownButtonWidget>("LANGUAGE_DROPDOWNBUTTON");
|
||||
@@ -219,8 +218,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
|
||||
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
|
||||
statusBarsDropDown.GetText = () => gs.StatusBars.ToString() == "Standard" ?
|
||||
"Standard" : gs.StatusBars.ToString() == "DamageShow" ? "Show On Damage" : "Always Show";
|
||||
statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard ?
|
||||
"Standard" : gs.StatusBars == StatusBarsType.DamageShow ? "Show On Damage" : "Always Show";
|
||||
|
||||
var targetLinesDropDown = panel.Get<DropDownButtonWidget>("TARGET_LINES_DROPDOWN");
|
||||
targetLinesDropDown.OnMouseDown = _ => ShowTargetLinesDropdown(targetLinesDropDown, gs);
|
||||
targetLinesDropDown.GetText = () => gs.TargetLines == TargetLinesType.Automatic ?
|
||||
"Automatic" : gs.TargetLines == TargetLinesType.Manual ? "Manual" : "Disabled";
|
||||
|
||||
// Update zoom immediately
|
||||
var pixelDoubleCheckbox = panel.Get<CheckboxWidget>("PIXELDOUBLE_CHECKBOX");
|
||||
@@ -716,6 +720,29 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ShowTargetLinesDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, TargetLinesType>()
|
||||
{
|
||||
{ "Automatic", TargetLinesType.Automatic },
|
||||
{ "Manual", TargetLinesType.Manual },
|
||||
{ "Disabled", TargetLinesType.Disabled },
|
||||
};
|
||||
|
||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||
() => s.TargetLines == options[o],
|
||||
() => s.TargetLines = options[o]);
|
||||
|
||||
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
||||
return item;
|
||||
};
|
||||
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MakeMouseFocusSettingsLive()
|
||||
{
|
||||
var gameSettings = Game.Settings.Game;
|
||||
|
||||
Reference in New Issue
Block a user