Replace DrawTargetLine checkbox with an Automatic/Manual/Disabled dropdown.
This commit is contained in:
@@ -21,6 +21,7 @@ namespace OpenRA
|
||||
{
|
||||
public enum MouseScrollType { Disabled, Standard, Inverted, Joystick }
|
||||
public enum StatusBarsType { Standard, DamageShow, AlwaysShow }
|
||||
public enum TargetLinesType { Disabled, Manual, Automatic }
|
||||
|
||||
[Flags]
|
||||
public enum MPGameFilters
|
||||
@@ -208,8 +209,8 @@ namespace OpenRA
|
||||
|
||||
public bool UseClassicMouseStyle = false;
|
||||
public StatusBarsType StatusBars = StatusBarsType.Standard;
|
||||
public TargetLinesType TargetLines = TargetLinesType.Automatic;
|
||||
public bool UsePlayerStanceColors = false;
|
||||
public bool DrawTargetLine = true;
|
||||
|
||||
public bool AllowDownloading = true;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -210,23 +210,29 @@ Container@SETTINGS_PANEL:
|
||||
Width: PARENT_RIGHT - 35
|
||||
Height: PARENT_BOTTOM - 12
|
||||
Label@STATUS_BARS:
|
||||
X: 310
|
||||
X: 250
|
||||
Y: 257
|
||||
Width: 145
|
||||
Text: Status Bars:
|
||||
Align: Right
|
||||
DropDownButton@STATUS_BAR_DROPDOWN:
|
||||
X: 400
|
||||
Y: 245
|
||||
Width: 170
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Text: Standard
|
||||
Checkbox@DISPLAY_TARGET_LINES_CHECKBOX:
|
||||
X: 310
|
||||
Label@TARGET_LINES:
|
||||
X: 250
|
||||
Y: 228
|
||||
Width: 145
|
||||
Text: Target Lines:
|
||||
Align: Right
|
||||
DropDownButton@TARGET_LINES_DROPDOWN:
|
||||
X: 400
|
||||
Y: 215
|
||||
Width: 200
|
||||
Height: 20
|
||||
Width: 170
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Text: Display Target Lines
|
||||
Label@LOCALIZATION_TITLE:
|
||||
Y: 265
|
||||
Width: PARENT_RIGHT
|
||||
|
||||
@@ -224,9 +224,11 @@ Background@SETTINGS_PANEL:
|
||||
Width: PARENT_RIGHT - 35
|
||||
Height: PARENT_BOTTOM - 12
|
||||
Label@STATUS_BARS:
|
||||
X: 310
|
||||
X: 250
|
||||
Y: 278
|
||||
Width: 145
|
||||
Text: Status Bars:
|
||||
Align: Right
|
||||
DropDownButton@STATUS_BAR_DROPDOWN:
|
||||
X: 400
|
||||
Y: 265
|
||||
@@ -234,13 +236,18 @@ Background@SETTINGS_PANEL:
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Text: Standard
|
||||
Checkbox@DISPLAY_TARGET_LINES_CHECKBOX:
|
||||
X: 310
|
||||
Label@TARGET_LINES:
|
||||
X: 250
|
||||
Y: 243
|
||||
Width: 145
|
||||
Text: Target Lines:
|
||||
Align: Right
|
||||
DropDownButton@TARGET_LINES_DROPDOWN:
|
||||
X: 400
|
||||
Y: 230
|
||||
Width: 200
|
||||
Height: 20
|
||||
Width: 170
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Text: Display Target Lines
|
||||
Label@LOCALIZATION_TITLE:
|
||||
Y: 270
|
||||
Width: PARENT_RIGHT
|
||||
|
||||
Reference in New Issue
Block a user