Convert lobby checkboxes to new options backend.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
@@ -67,7 +68,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var debug = widget.GetOrNull<MenuButtonWidget>("DEBUG_BUTTON");
|
||||
if (debug != null)
|
||||
{
|
||||
debug.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
|
||||
// Can't use DeveloperMode.Enabled because there is a hardcoded hack to *always*
|
||||
// enable developer mode for singleplayer games, but we only want to show the button
|
||||
// if it has been explicitly enabled
|
||||
var def = world.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>().Enabled;
|
||||
var enabled = world.LobbyInfo.GlobalSettings.OptionOrDefault("cheats", def);
|
||||
debug.IsVisible = () => enabled;
|
||||
debug.IsDisabled = () => disableSystemButtons;
|
||||
debug.OnClick = () => OpenMenuPanel(debug, new WidgetArgs()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user