Replace DrawTargetLine checkbox with an Automatic/Manual/Disabled dropdown.
This commit is contained in:
@@ -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