Add Developer Menu toggle. Fixes #3296.

This commit is contained in:
Paul Chote
2013-06-29 10:31:50 +12:00
parent f4d37857aa
commit fe6c6a3017
4 changed files with 25 additions and 2 deletions

View File

@@ -77,6 +77,7 @@ namespace OpenRA.GameRules
public bool SanityCheckUnsyncedCode = false; public bool SanityCheckUnsyncedCode = false;
public int Samples = 25; public int Samples = 25;
public bool IgnoreVersionMismatch = false; public bool IgnoreVersionMismatch = false;
public bool DeveloperMenu = false;
} }
public class GraphicSettings public class GraphicSettings

View File

@@ -81,7 +81,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
}); });
}; };
widget.Get<ButtonWidget>("MAINMENU_BUTTON_ASSET_BROWSER").OnClick = () => var assetBrowserButton = widget.Get<ButtonWidget>("MAINMENU_BUTTON_ASSET_BROWSER");
assetBrowserButton.OnClick = () =>
{ {
Menu = MenuType.None; Menu = MenuType.None;
Game.OpenWindow("ASSETBROWSER_BG", new WidgetArgs() Game.OpenWindow("ASSETBROWSER_BG", new WidgetArgs()
@@ -90,7 +91,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
}); });
}; };
widget.Get<ButtonWidget>("MAINMENU_BUTTON_QUIT").OnClick = () => Game.Exit(); var quitButton = widget.Get<ButtonWidget>("MAINMENU_BUTTON_QUIT");
quitButton.OnClick = () => Game.Exit();
// Hide developer-specific buttons
if (Game.Settings.Debug.DeveloperMenu == false)
{
assetBrowserButton.IsVisible = () => false;
var offset = assetBrowserButton.Bounds.Y - quitButton.Bounds.Y;
quitButton.Bounds.Y += offset;
rootMenu.Bounds.Height += offset;
rootMenu.Bounds.Y -= offset/2;
}
} }
void RemoveShellmapUI() void RemoveShellmapUI()

View File

@@ -234,6 +234,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
verboseNatDiscoveryCheckbox.IsChecked = () => Game.Settings.Server.VerboseNatDiscovery; verboseNatDiscoveryCheckbox.IsChecked = () => Game.Settings.Server.VerboseNatDiscovery;
verboseNatDiscoveryCheckbox.OnClick = () => Game.Settings.Server.VerboseNatDiscovery ^= true; verboseNatDiscoveryCheckbox.OnClick = () => Game.Settings.Server.VerboseNatDiscovery ^= true;
var developerMenuCheckbox = debug.Get<CheckboxWidget>("DEVELOPER_MENU_CHECKBOX");
developerMenuCheckbox.IsChecked = () => Game.Settings.Debug.DeveloperMenu;
developerMenuCheckbox.OnClick = () => Game.Settings.Debug.DeveloperMenu ^= true;
bg.Get<ButtonWidget>("BUTTON_CLOSE").OnClick = () => bg.Get<ButtonWidget>("BUTTON_CLOSE").OnClick = () =>
{ {
int x, y; int x, y;

View File

@@ -379,3 +379,9 @@ Background@SETTINGS_MENU:
Width:300 Width:300
Height:20 Height:20
Text:Detailed NAT logging Text:Detailed NAT logging
Checkbox@DEVELOPER_MENU_CHECKBOX:
X:0
Y:180
Width:300
Height:20
Text:Enable Asset Browser (requires restart)