diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs
index 6d79dc1d2b..343fbdb9d7 100644
--- a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs
+++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
{
panelType = PanelType.Debug;
visibleButtons++;
- var debugPanel = Game.LoadWidget(world, "CHEATS_PANEL", panelParent, new WidgetArgs() { { "onExit", doNothing } });
+ var debugPanel = Game.LoadWidget(world, "DEBUG_PANEL", panelParent, new WidgetArgs() { { "onExit", doNothing }, { "transient", true } });
debugPanel.IsVisible = () => panelType == PanelType.Debug;
debugButton.IsVisible = () => visibleButtons > 1;
}
diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
index 7476d751cd..f440308453 100644
--- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
+++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
@@ -411,7 +411,6 @@
-
@@ -542,6 +541,7 @@
+
diff --git a/OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DebugMenuLogic.cs
similarity index 94%
rename from OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs
rename to OpenRA.Mods.RA/Widgets/Logic/DebugMenuLogic.cs
index 8f14691864..e1f27035f7 100644
--- a/OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs
+++ b/OpenRA.Mods.RA/Widgets/Logic/DebugMenuLogic.cs
@@ -15,12 +15,10 @@ using OpenRA.Widgets;
namespace OpenRA.Mods.RA.Widgets.Logic
{
- public class CheatsLogic
+ public class DebugMenuLogic
{
- public static MersenneTwister CosmeticRandom = new MersenneTwister();
-
[ObjectCreator.UseCtor]
- public CheatsLogic(Widget widget, Action onExit, World world)
+ public DebugMenuLogic(Widget widget, Action onExit, World world, bool transient)
{
var devTrait = world.LocalPlayer.PlayerActor.Trait();
@@ -117,7 +115,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var close = widget.GetOrNull("CLOSE");
if (close != null)
- close.OnClick = () => { Ui.CloseWindow(); onExit(); };
+ {
+ close.OnClick = () =>
+ {
+ if (transient)
+ {
+ Ui.CloseWindow();
+ Ui.Root.RemoveChild(widget);
+ }
+
+ onExit();
+ };
+ }
}
public void Order(World world, string order)
diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs
index 2896773497..36866a9be4 100644
--- a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs
+++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs
@@ -97,11 +97,14 @@ namespace OpenRA.Mods.RA.Widgets.Logic
diplomacyButton.IsVisible = () => validPlayers > 0;
Widget cheats = null;
- cheats = Game.LoadWidget(world, "CHEATS_PANEL", playerWidgets, new WidgetArgs
+ cheats = Game.LoadWidget(world, "INGAME_DEBUG_BG", playerWidgets, new WidgetArgs
{
+ { "transient", true },
{ "onExit", () => cheats.Visible = false }
});
- var cheatsButton = playerWidgets.Get("CHEATS_BUTTON");
+ cheats.Visible = false;
+
+ var cheatsButton = playerWidgets.Get("INGAME_DEBUG_BUTTON");
cheatsButton.OnClick = () => cheats.Visible ^= true;
cheatsButton.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
diff --git a/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs
index 55c4b08ba1..f91abcabfc 100644
--- a/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs
+++ b/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs
@@ -62,6 +62,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
options.OnClick = () => OpenMenuPanel(options);
}
+ var debug = widget.GetOrNull("DEBUG_BUTTON");
+ if (debug != null)
+ {
+ debug.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
+ debug.IsDisabled = () => disableSystemButtons;
+ debug.OnClick = () => OpenMenuPanel(debug);
+ }
}
void OpenMenuPanel(MenuButtonWidget button)
diff --git a/mods/cnc/chrome/cheats.yaml b/mods/cnc/chrome/ingame-debug.yaml
similarity index 98%
rename from mods/cnc/chrome/cheats.yaml
rename to mods/cnc/chrome/ingame-debug.yaml
index cd26081602..d7db534ff5 100644
--- a/mods/cnc/chrome/cheats.yaml
+++ b/mods/cnc/chrome/ingame-debug.yaml
@@ -1,5 +1,5 @@
-Container@CHEATS_PANEL:
- Logic: CheatsLogic
+Container@DEBUG_PANEL:
+ Logic: DebugMenuLogic
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
diff --git a/mods/cnc/chrome/ingamemenu.yaml b/mods/cnc/chrome/ingame-menu.yaml
similarity index 100%
rename from mods/cnc/chrome/ingamemenu.yaml
rename to mods/cnc/chrome/ingame-menu.yaml
diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml
index 29e3893fbb..13479e27d0 100644
--- a/mods/cnc/mod.yaml
+++ b/mods/cnc/mod.yaml
@@ -88,11 +88,11 @@ ChromeLayout:
mods/cnc/chrome/replaybrowser.yaml
mods/cnc/chrome/ingame.yaml
mods/cnc/chrome/ingame-chat.yaml
- mods/cnc/chrome/ingamemenu.yaml
+ mods/cnc/chrome/ingame-debug.yaml
+ mods/cnc/chrome/ingame-menu.yaml
mods/cnc/chrome/music.yaml
mods/cnc/chrome/settings.yaml
mods/cnc/chrome/credits.yaml
- mods/cnc/chrome/cheats.yaml
mods/cnc/chrome/dialogs.yaml
mods/cnc/chrome/objectives.yaml
mods/cnc/chrome/tooltips.yaml
diff --git a/mods/d2k/chrome/ingame-player.yaml b/mods/d2k/chrome/ingame-player.yaml
index e1388dd6ae..0816e8e5ab 100644
--- a/mods/d2k/chrome/ingame-player.yaml
+++ b/mods/d2k/chrome/ingame-player.yaml
@@ -11,12 +11,12 @@ Container@PLAYER_WIDGETS:
Text: Diplomacy (F1)
Font: Bold
Key: f1
- Button@CHEATS_BUTTON:
+ Button@INGAME_DEBUG_BUTTON:
X: 324
Y: 0
Width: 160
Height: 25
- Text: Cheats (F2)
+ Text: Debug (F2)
Visible: false
Font: Bold
Key: f2
diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml
index 72283a696f..e27ad056d8 100644
--- a/mods/d2k/mod.yaml
+++ b/mods/d2k/mod.yaml
@@ -65,6 +65,7 @@ ChromeLayout:
mods/d2k/chrome/ingame-observer.yaml
mods/ra/chrome/ingame-observerstats.yaml
mods/d2k/chrome/ingame-player.yaml
+ mods/ra/chrome/ingame-debug.yaml
mods/d2k/chrome/mainmenu.yaml
mods/ra/chrome/settings.yaml
mods/ra/chrome/credits.yaml
@@ -80,7 +81,6 @@ ChromeLayout:
mods/ra/chrome/directconnect.yaml
mods/ra/chrome/replaybrowser.yaml
mods/d2k/chrome/dropdowns.yaml
- mods/ra/chrome/cheats.yaml
mods/ra/chrome/musicplayer.yaml
mods/d2k/chrome/tooltips.yaml
mods/ra/chrome/assetbrowser.yaml
diff --git a/mods/ra/chrome/cheats.yaml b/mods/ra/chrome/ingame-debug.yaml
similarity index 95%
rename from mods/ra/chrome/cheats.yaml
rename to mods/ra/chrome/ingame-debug.yaml
index 1ded5cd3e4..b10dd915b9 100644
--- a/mods/ra/chrome/cheats.yaml
+++ b/mods/ra/chrome/ingame-debug.yaml
@@ -1,17 +1,16 @@
-Background@CHEATS_PANEL:
- Logic: CheatsLogic
+Background@INGAME_DEBUG_BG:
+ Logic: DebugMenuLogic
X: (WINDOW_RIGHT - WIDTH)/2
Y: (WINDOW_BOTTOM - HEIGHT)/2
Width: 350
Height: 475
- Visible: false
Children:
Label@LABEL_TITLE:
X: (PARENT_RIGHT - WIDTH)/2
Y: 20
Width: 250
Height: 25
- Text: Cheats
+ Text: Debug Options
Align: Center
Font: Bold
Checkbox@DISABLE_SHROUD:
@@ -107,4 +106,5 @@ Background@CHEATS_PANEL:
Height: 25
Text: Close
Key: escape
+ Font: Bold
diff --git a/mods/ra/chrome/ingame-player.yaml b/mods/ra/chrome/ingame-player.yaml
index a77facb70e..4c50ca7ea9 100644
--- a/mods/ra/chrome/ingame-player.yaml
+++ b/mods/ra/chrome/ingame-player.yaml
@@ -11,12 +11,12 @@ Container@PLAYER_WIDGETS:
Text: Diplomacy (F1)
Font: Bold
Key: f1
- Button@CHEATS_BUTTON:
+ Button@INGAME_DEBUG_BUTTON:
X: 324
Y: 0
Width: 160
Height: 25
- Text: Cheats (F2)
+ Text: Debug (F2)
Visible: false
Font: Bold
Key: f2
diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml
index 4690287d8b..9043bd1e6e 100644
--- a/mods/ra/mod.yaml
+++ b/mods/ra/mod.yaml
@@ -79,6 +79,7 @@ ChromeLayout:
mods/ra/chrome/ingame-observer.yaml
mods/ra/chrome/ingame-observerstats.yaml
mods/ra/chrome/ingame-player.yaml
+ mods/ra/chrome/ingame-debug.yaml
mods/ra/chrome/mainmenu.yaml
mods/ra/chrome/settings.yaml
mods/ra/chrome/credits.yaml
@@ -94,7 +95,6 @@ ChromeLayout:
mods/ra/chrome/directconnect.yaml
mods/ra/chrome/replaybrowser.yaml
mods/ra/chrome/dropdowns.yaml
- mods/ra/chrome/cheats.yaml
mods/ra/chrome/musicplayer.yaml
mods/ra/chrome/tooltips.yaml
mods/ra/chrome/assetbrowser.yaml
diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml
index 25e4f24e1c..358dbadd18 100644
--- a/mods/ts/mod.yaml
+++ b/mods/ts/mod.yaml
@@ -108,6 +108,7 @@ ChromeLayout:
mods/ra/chrome/ingame-observer.yaml
mods/ra/chrome/ingame-observerstats.yaml
mods/ra/chrome/ingame-player.yaml
+ mods/ra/chrome/ingame-debug.yaml
mods/ra/chrome/mainmenu.yaml
mods/ra/chrome/settings.yaml
mods/ra/chrome/credits.yaml
@@ -123,7 +124,6 @@ ChromeLayout:
mods/ra/chrome/directconnect.yaml
mods/ra/chrome/replaybrowser.yaml
mods/ra/chrome/dropdowns.yaml
- mods/ra/chrome/cheats.yaml
mods/ra/chrome/musicplayer.yaml
mods/ra/chrome/tooltips.yaml
mods/ra/chrome/assetbrowser.yaml