Move C&C cheats into a panel on options menu.
This commit is contained in:
@@ -147,17 +147,6 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
playerWidgets.Get<ButtonWidget>("OPTIONS_BUTTON").OnClick = OptionsClicked;
|
||||
|
||||
var cheatsButton = playerWidgets.Get<ButtonWidget>("CHEATS_BUTTON");
|
||||
cheatsButton.OnClick = () =>
|
||||
{
|
||||
if (menu != MenuType.None)
|
||||
Ui.CloseWindow();
|
||||
|
||||
menu = MenuType.Cheats;
|
||||
Game.OpenWindow("CHEATS_PANEL", new WidgetArgs() {{"onExit", () => menu = MenuType.None }});
|
||||
};
|
||||
cheatsButton.IsVisible = () => world.LocalPlayer != null && world.LobbyInfo.GlobalSettings.AllowCheats;
|
||||
|
||||
var winLossWatcher = playerWidgets.Get<LogicTickerWidget>("WIN_LOSS_WATCHER");
|
||||
winLossWatcher.OnTick = () =>
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
Widget menu;
|
||||
|
||||
enum PanelType { Objectives, Debug }
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncIngameMenuLogic(Widget widget, World world, Action onExit, WorldRenderer worldRenderer)
|
||||
{
|
||||
@@ -41,9 +43,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
Game.RunAfterDelay(1200, () => mpe.Fade(CncMenuPaletteEffect.EffectType.Black));
|
||||
Game.RunAfterDelay(1200 + 40 * mpe.Info.FadeLength, () =>
|
||||
{
|
||||
Game.Disconnect();
|
||||
Ui.ResetAll();
|
||||
Game.LoadShellMap();
|
||||
Game.Disconnect();
|
||||
Ui.ResetAll();
|
||||
Game.LoadShellMap();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -88,10 +90,39 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
onExit();
|
||||
};
|
||||
|
||||
// Mission objectives panel
|
||||
// Menu panels - ordered from lowest to highest priority
|
||||
var panelParent = Game.OpenWindow(world, "INGAME_MENU_PANEL");
|
||||
PanelType Panel = PanelType.Objectives;
|
||||
var visibleButtons = 0;
|
||||
|
||||
// Debug / Cheats panel
|
||||
var debugButton = panelParent.Get<ButtonWidget>("DEBUG_BUTTON");
|
||||
debugButton.OnClick = () => Panel = PanelType.Debug;
|
||||
debugButton.IsDisabled = () => Panel == PanelType.Debug;
|
||||
|
||||
if (world.LocalPlayer != null && world.LobbyInfo.GlobalSettings.AllowCheats)
|
||||
{
|
||||
Panel = PanelType.Debug;
|
||||
visibleButtons++;
|
||||
var debugPanel = Game.LoadWidget(world, "CHEATS_PANEL", panelParent, new WidgetArgs(){{"onExit", doNothing}});
|
||||
debugPanel.IsVisible = () => Panel == PanelType.Debug;
|
||||
debugButton.IsVisible = () => visibleButtons > 1;
|
||||
}
|
||||
|
||||
// Mission objectives
|
||||
var iop = world.WorldActor.TraitsImplementing<IObjectivesPanel>().FirstOrDefault();
|
||||
var objectivesButton = panelParent.Get<ButtonWidget>("OBJECTIVES_BUTTON");
|
||||
objectivesButton.OnClick = () => Panel = PanelType.Objectives;
|
||||
objectivesButton.IsDisabled = () => Panel == PanelType.Objectives;
|
||||
|
||||
if (iop != null && iop.ObjectivesPanel != null)
|
||||
Game.OpenWindow(world, iop.ObjectivesPanel);
|
||||
{
|
||||
Panel = PanelType.Objectives;
|
||||
visibleButtons++;
|
||||
var objectivesPanel = Game.LoadWidget(world, iop.ObjectivesPanel, panelParent, new WidgetArgs());
|
||||
objectivesPanel.IsVisible = () => Panel == PanelType.Objectives;
|
||||
objectivesButton.IsVisible = () => visibleButtons > 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,109 +1,101 @@
|
||||
Container@CHEATS_PANEL:
|
||||
Logic:CheatsLogic
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - 110)/2
|
||||
Width:590
|
||||
Height:145
|
||||
Width:PARENT_RIGHT
|
||||
Height:PARENT_BOTTOM
|
||||
Children:
|
||||
Label@TITLE:
|
||||
Width:590
|
||||
Width:PARENT_RIGHT
|
||||
Y:0-25
|
||||
Font:BigBold
|
||||
Contrast:true
|
||||
Align:Center
|
||||
Text:Cheats
|
||||
Text:Debug Options
|
||||
Background@bg:
|
||||
Width:590
|
||||
Height:140
|
||||
Width:PARENT_RIGHT
|
||||
Height:PARENT_BOTTOM
|
||||
Background:panel-black
|
||||
Children:
|
||||
Label@CHEATS_TITLE:
|
||||
Y:25
|
||||
Font:Bold
|
||||
Text:Cheats
|
||||
Align:Center
|
||||
Width:PARENT_RIGHT
|
||||
Checkbox@INSTANT_BUILD:
|
||||
X:15
|
||||
Y:15
|
||||
X:45
|
||||
Y:45
|
||||
Width:200
|
||||
Height:20
|
||||
Text:Instant Build Speed
|
||||
Checkbox@ENABLE_TECH:
|
||||
X:15
|
||||
Y:45
|
||||
X:45
|
||||
Y:75
|
||||
Width:200
|
||||
Height:20
|
||||
Text:Build Everything
|
||||
Checkbox@BUILD_ANYWHERE:
|
||||
X:15
|
||||
Y:75
|
||||
X:45
|
||||
Y:105
|
||||
Width:200
|
||||
Height:20
|
||||
Text:Build Anywhere
|
||||
Checkbox@UNLIMITED_POWER:
|
||||
X:200
|
||||
Y:15
|
||||
X:290
|
||||
Y:45
|
||||
Width:200
|
||||
Height:20
|
||||
Text:Unlimited Power
|
||||
Checkbox@INSTANT_CHARGE:
|
||||
X:200
|
||||
Y:45
|
||||
X:290
|
||||
Y:75
|
||||
Width:200
|
||||
Height:20
|
||||
Text:Instant Charge Time
|
||||
Checkbox@SHOW_MUZZLES:
|
||||
X:200
|
||||
Y:75
|
||||
Height:20
|
||||
Width:200
|
||||
Text:Show Muzzle Positions
|
||||
Checkbox@DISABLE_SHROUD:
|
||||
X:400
|
||||
Y:15
|
||||
X:290
|
||||
Y:105
|
||||
Height:20
|
||||
Width:200
|
||||
Text:Disable Shroud
|
||||
Text:Disable Shroud & Fog
|
||||
Button@GIVE_CASH:
|
||||
X:20
|
||||
Y:155
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Give $20,000
|
||||
Button@GIVE_EXPLORATION:
|
||||
X:186
|
||||
Y:155
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Clear Shroud
|
||||
Button@RESET_EXPLORATION:
|
||||
X:352
|
||||
Y:155
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Reset Shroud
|
||||
Label@VISUALIZATIONS_TITLE:
|
||||
Y:215
|
||||
Font:Bold
|
||||
Text:Visualizations
|
||||
Align:Center
|
||||
Width:PARENT_RIGHT
|
||||
Checkbox@SHOW_UNIT_PATHS:
|
||||
X:400
|
||||
Y:45
|
||||
X:45
|
||||
Y:235
|
||||
Width:200
|
||||
Height:20
|
||||
Text:Show Unit Paths
|
||||
Checkbox@SHOW_ASTAR:
|
||||
X:400
|
||||
Y:75
|
||||
X:45
|
||||
Y:265
|
||||
Height:20
|
||||
Width:200
|
||||
Text:Show A* Cost
|
||||
Checkbox@DESYNC_ARMED:
|
||||
X:400
|
||||
Y:105
|
||||
Width:20
|
||||
Checkbox@SHOW_MUZZLES:
|
||||
X:290
|
||||
Y:235
|
||||
Height:20
|
||||
Button@DESYNC:
|
||||
X:430
|
||||
Y:100
|
||||
Width:120
|
||||
Height:25
|
||||
Text: Force Desync
|
||||
Button@CLOSE:
|
||||
Key:escape
|
||||
X:0
|
||||
Y:139
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Close
|
||||
Button@GIVE_CASH:
|
||||
X:150
|
||||
Y:139
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Give Cash
|
||||
Button@GIVE_EXPLORATION:
|
||||
X:300
|
||||
Y:139
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Give Exploration
|
||||
Button@RESET_EXPLORATION:
|
||||
X:450
|
||||
Y:139
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Reset Exploration
|
||||
Width:200
|
||||
Text:Show Muzzle Positions
|
||||
@@ -74,12 +74,6 @@ Container@OBSERVER_WIDGETS:
|
||||
Container@PLAYER_WIDGETS:
|
||||
Children:
|
||||
LogicTicker@WIN_LOSS_WATCHER:
|
||||
Button@CHEATS_BUTTON:
|
||||
X:WINDOW_RIGHT-400
|
||||
Y:5
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Cheats
|
||||
WorldCommand:
|
||||
Width:WINDOW_RIGHT
|
||||
Height:WINDOW_BOTTOM
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
Container@INGAME_MENU_PANEL:
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||
Width:512
|
||||
Height:320
|
||||
Children:
|
||||
Button@OBJECTIVES_BUTTON:
|
||||
Y:PARENT_BOTTOM - 1
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Objectives
|
||||
Visible: false
|
||||
Button@DEBUG_BUTTON:
|
||||
X:150
|
||||
Y:PARENT_BOTTOM - 1
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Debug
|
||||
Visible: false
|
||||
Container@INGAME_MENU:
|
||||
Width:WINDOW_RIGHT
|
||||
Height:WINDOW_BOTTOM
|
||||
|
||||
@@ -347,7 +347,7 @@ Container@SERVER_LOBBY:
|
||||
Y:257
|
||||
Width:130
|
||||
Height:20
|
||||
Text: Allow Cheats
|
||||
Text: Debug Menu
|
||||
Checkbox@CRATES_CHECKBOX:
|
||||
X:160
|
||||
Y:257
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
Container@CONQUEST_OBJECTIVES:
|
||||
Logic:CncConquestObjectivesLogic
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||
Width:512
|
||||
Height:320
|
||||
Width:PARENT_RIGHT
|
||||
Height:PARENT_BOTTOM
|
||||
Children:
|
||||
Label@TITLE:
|
||||
Width:PARENT_RIGHT
|
||||
|
||||
Reference in New Issue
Block a user