Unify cheats -> debug and adjust plumbing for new RA UI.
This commit is contained in:
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
{
|
{
|
||||||
panelType = PanelType.Debug;
|
panelType = PanelType.Debug;
|
||||||
visibleButtons++;
|
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;
|
debugPanel.IsVisible = () => panelType == PanelType.Debug;
|
||||||
debugButton.IsVisible = () => visibleButtons > 1;
|
debugButton.IsVisible = () => visibleButtons > 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,7 +411,6 @@
|
|||||||
<Compile Include="InfiltrateForExploration.cs" />
|
<Compile Include="InfiltrateForExploration.cs" />
|
||||||
<Compile Include="InfiltrateForCash.cs" />
|
<Compile Include="InfiltrateForCash.cs" />
|
||||||
<Compile Include="RenderShroudCircle.cs" />
|
<Compile Include="RenderShroudCircle.cs" />
|
||||||
<Compile Include="Widgets\Logic\CheatsLogic.cs" />
|
|
||||||
<Compile Include="CloakPaletteEffect.cs" />
|
<Compile Include="CloakPaletteEffect.cs" />
|
||||||
<Compile Include="Widgets\ColorPreviewManagerWidget.cs" />
|
<Compile Include="Widgets\ColorPreviewManagerWidget.cs" />
|
||||||
<Compile Include="Infiltrates.cs" />
|
<Compile Include="Infiltrates.cs" />
|
||||||
@@ -542,6 +541,7 @@
|
|||||||
<Compile Include="Widgets\Logic\Ingame\IngameSiloBarLogic.cs" />
|
<Compile Include="Widgets\Logic\Ingame\IngameSiloBarLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\Ingame\LoadIngamePlayerOrObserverUILogic.cs" />
|
<Compile Include="Widgets\Logic\Ingame\LoadIngamePlayerOrObserverUILogic.cs" />
|
||||||
<Compile Include="Widgets\MenuButtonWidget.cs" />
|
<Compile Include="Widgets\MenuButtonWidget.cs" />
|
||||||
|
<Compile Include="Widgets\Logic\DebugMenuLogic.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ using OpenRA.Widgets;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||||
{
|
{
|
||||||
public class CheatsLogic
|
public class DebugMenuLogic
|
||||||
{
|
{
|
||||||
public static MersenneTwister CosmeticRandom = new MersenneTwister();
|
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[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<DeveloperMode>();
|
var devTrait = world.LocalPlayer.PlayerActor.Trait<DeveloperMode>();
|
||||||
|
|
||||||
@@ -117,7 +115,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
var close = widget.GetOrNull<ButtonWidget>("CLOSE");
|
var close = widget.GetOrNull<ButtonWidget>("CLOSE");
|
||||||
if (close != null)
|
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)
|
public void Order(World world, string order)
|
||||||
@@ -97,11 +97,14 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
diplomacyButton.IsVisible = () => validPlayers > 0;
|
diplomacyButton.IsVisible = () => validPlayers > 0;
|
||||||
|
|
||||||
Widget cheats = null;
|
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 }
|
{ "onExit", () => cheats.Visible = false }
|
||||||
});
|
});
|
||||||
var cheatsButton = playerWidgets.Get<ButtonWidget>("CHEATS_BUTTON");
|
cheats.Visible = false;
|
||||||
|
|
||||||
|
var cheatsButton = playerWidgets.Get<ButtonWidget>("INGAME_DEBUG_BUTTON");
|
||||||
cheatsButton.OnClick = () => cheats.Visible ^= true;
|
cheatsButton.OnClick = () => cheats.Visible ^= true;
|
||||||
cheatsButton.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
|
cheatsButton.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
options.OnClick = () => OpenMenuPanel(options);
|
options.OnClick = () => OpenMenuPanel(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var debug = widget.GetOrNull<MenuButtonWidget>("DEBUG_BUTTON");
|
||||||
|
if (debug != null)
|
||||||
|
{
|
||||||
|
debug.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
|
||||||
|
debug.IsDisabled = () => disableSystemButtons;
|
||||||
|
debug.OnClick = () => OpenMenuPanel(debug);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenMenuPanel(MenuButtonWidget button)
|
void OpenMenuPanel(MenuButtonWidget button)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Container@CHEATS_PANEL:
|
Container@DEBUG_PANEL:
|
||||||
Logic: CheatsLogic
|
Logic: DebugMenuLogic
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
Children:
|
Children:
|
||||||
@@ -88,11 +88,11 @@ ChromeLayout:
|
|||||||
mods/cnc/chrome/replaybrowser.yaml
|
mods/cnc/chrome/replaybrowser.yaml
|
||||||
mods/cnc/chrome/ingame.yaml
|
mods/cnc/chrome/ingame.yaml
|
||||||
mods/cnc/chrome/ingame-chat.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/music.yaml
|
||||||
mods/cnc/chrome/settings.yaml
|
mods/cnc/chrome/settings.yaml
|
||||||
mods/cnc/chrome/credits.yaml
|
mods/cnc/chrome/credits.yaml
|
||||||
mods/cnc/chrome/cheats.yaml
|
|
||||||
mods/cnc/chrome/dialogs.yaml
|
mods/cnc/chrome/dialogs.yaml
|
||||||
mods/cnc/chrome/objectives.yaml
|
mods/cnc/chrome/objectives.yaml
|
||||||
mods/cnc/chrome/tooltips.yaml
|
mods/cnc/chrome/tooltips.yaml
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ Container@PLAYER_WIDGETS:
|
|||||||
Text: Diplomacy (F1)
|
Text: Diplomacy (F1)
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Key: f1
|
Key: f1
|
||||||
Button@CHEATS_BUTTON:
|
Button@INGAME_DEBUG_BUTTON:
|
||||||
X: 324
|
X: 324
|
||||||
Y: 0
|
Y: 0
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: Cheats (F2)
|
Text: Debug (F2)
|
||||||
Visible: false
|
Visible: false
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Key: f2
|
Key: f2
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ ChromeLayout:
|
|||||||
mods/d2k/chrome/ingame-observer.yaml
|
mods/d2k/chrome/ingame-observer.yaml
|
||||||
mods/ra/chrome/ingame-observerstats.yaml
|
mods/ra/chrome/ingame-observerstats.yaml
|
||||||
mods/d2k/chrome/ingame-player.yaml
|
mods/d2k/chrome/ingame-player.yaml
|
||||||
|
mods/ra/chrome/ingame-debug.yaml
|
||||||
mods/d2k/chrome/mainmenu.yaml
|
mods/d2k/chrome/mainmenu.yaml
|
||||||
mods/ra/chrome/settings.yaml
|
mods/ra/chrome/settings.yaml
|
||||||
mods/ra/chrome/credits.yaml
|
mods/ra/chrome/credits.yaml
|
||||||
@@ -80,7 +81,6 @@ ChromeLayout:
|
|||||||
mods/ra/chrome/directconnect.yaml
|
mods/ra/chrome/directconnect.yaml
|
||||||
mods/ra/chrome/replaybrowser.yaml
|
mods/ra/chrome/replaybrowser.yaml
|
||||||
mods/d2k/chrome/dropdowns.yaml
|
mods/d2k/chrome/dropdowns.yaml
|
||||||
mods/ra/chrome/cheats.yaml
|
|
||||||
mods/ra/chrome/musicplayer.yaml
|
mods/ra/chrome/musicplayer.yaml
|
||||||
mods/d2k/chrome/tooltips.yaml
|
mods/d2k/chrome/tooltips.yaml
|
||||||
mods/ra/chrome/assetbrowser.yaml
|
mods/ra/chrome/assetbrowser.yaml
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
Background@CHEATS_PANEL:
|
Background@INGAME_DEBUG_BG:
|
||||||
Logic: CheatsLogic
|
Logic: DebugMenuLogic
|
||||||
X: (WINDOW_RIGHT - WIDTH)/2
|
X: (WINDOW_RIGHT - WIDTH)/2
|
||||||
Y: (WINDOW_BOTTOM - HEIGHT)/2
|
Y: (WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width: 350
|
Width: 350
|
||||||
Height: 475
|
Height: 475
|
||||||
Visible: false
|
|
||||||
Children:
|
Children:
|
||||||
Label@LABEL_TITLE:
|
Label@LABEL_TITLE:
|
||||||
X: (PARENT_RIGHT - WIDTH)/2
|
X: (PARENT_RIGHT - WIDTH)/2
|
||||||
Y: 20
|
Y: 20
|
||||||
Width: 250
|
Width: 250
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: Cheats
|
Text: Debug Options
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Checkbox@DISABLE_SHROUD:
|
Checkbox@DISABLE_SHROUD:
|
||||||
@@ -107,4 +106,5 @@ Background@CHEATS_PANEL:
|
|||||||
Height: 25
|
Height: 25
|
||||||
Text: Close
|
Text: Close
|
||||||
Key: escape
|
Key: escape
|
||||||
|
Font: Bold
|
||||||
|
|
||||||
@@ -11,12 +11,12 @@ Container@PLAYER_WIDGETS:
|
|||||||
Text: Diplomacy (F1)
|
Text: Diplomacy (F1)
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Key: f1
|
Key: f1
|
||||||
Button@CHEATS_BUTTON:
|
Button@INGAME_DEBUG_BUTTON:
|
||||||
X: 324
|
X: 324
|
||||||
Y: 0
|
Y: 0
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: Cheats (F2)
|
Text: Debug (F2)
|
||||||
Visible: false
|
Visible: false
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Key: f2
|
Key: f2
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ ChromeLayout:
|
|||||||
mods/ra/chrome/ingame-observer.yaml
|
mods/ra/chrome/ingame-observer.yaml
|
||||||
mods/ra/chrome/ingame-observerstats.yaml
|
mods/ra/chrome/ingame-observerstats.yaml
|
||||||
mods/ra/chrome/ingame-player.yaml
|
mods/ra/chrome/ingame-player.yaml
|
||||||
|
mods/ra/chrome/ingame-debug.yaml
|
||||||
mods/ra/chrome/mainmenu.yaml
|
mods/ra/chrome/mainmenu.yaml
|
||||||
mods/ra/chrome/settings.yaml
|
mods/ra/chrome/settings.yaml
|
||||||
mods/ra/chrome/credits.yaml
|
mods/ra/chrome/credits.yaml
|
||||||
@@ -94,7 +95,6 @@ ChromeLayout:
|
|||||||
mods/ra/chrome/directconnect.yaml
|
mods/ra/chrome/directconnect.yaml
|
||||||
mods/ra/chrome/replaybrowser.yaml
|
mods/ra/chrome/replaybrowser.yaml
|
||||||
mods/ra/chrome/dropdowns.yaml
|
mods/ra/chrome/dropdowns.yaml
|
||||||
mods/ra/chrome/cheats.yaml
|
|
||||||
mods/ra/chrome/musicplayer.yaml
|
mods/ra/chrome/musicplayer.yaml
|
||||||
mods/ra/chrome/tooltips.yaml
|
mods/ra/chrome/tooltips.yaml
|
||||||
mods/ra/chrome/assetbrowser.yaml
|
mods/ra/chrome/assetbrowser.yaml
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ ChromeLayout:
|
|||||||
mods/ra/chrome/ingame-observer.yaml
|
mods/ra/chrome/ingame-observer.yaml
|
||||||
mods/ra/chrome/ingame-observerstats.yaml
|
mods/ra/chrome/ingame-observerstats.yaml
|
||||||
mods/ra/chrome/ingame-player.yaml
|
mods/ra/chrome/ingame-player.yaml
|
||||||
|
mods/ra/chrome/ingame-debug.yaml
|
||||||
mods/ra/chrome/mainmenu.yaml
|
mods/ra/chrome/mainmenu.yaml
|
||||||
mods/ra/chrome/settings.yaml
|
mods/ra/chrome/settings.yaml
|
||||||
mods/ra/chrome/credits.yaml
|
mods/ra/chrome/credits.yaml
|
||||||
@@ -123,7 +124,6 @@ ChromeLayout:
|
|||||||
mods/ra/chrome/directconnect.yaml
|
mods/ra/chrome/directconnect.yaml
|
||||||
mods/ra/chrome/replaybrowser.yaml
|
mods/ra/chrome/replaybrowser.yaml
|
||||||
mods/ra/chrome/dropdowns.yaml
|
mods/ra/chrome/dropdowns.yaml
|
||||||
mods/ra/chrome/cheats.yaml
|
|
||||||
mods/ra/chrome/musicplayer.yaml
|
mods/ra/chrome/musicplayer.yaml
|
||||||
mods/ra/chrome/tooltips.yaml
|
mods/ra/chrome/tooltips.yaml
|
||||||
mods/ra/chrome/assetbrowser.yaml
|
mods/ra/chrome/assetbrowser.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user