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;
|
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");
|
var winLossWatcher = playerWidgets.Get<LogicTickerWidget>("WIN_LOSS_WATCHER");
|
||||||
winLossWatcher.OnTick = () =>
|
winLossWatcher.OnTick = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
{
|
{
|
||||||
Widget menu;
|
Widget menu;
|
||||||
|
|
||||||
|
enum PanelType { Objectives, Debug }
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public CncIngameMenuLogic(Widget widget, World world, Action onExit, WorldRenderer worldRenderer)
|
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, () => mpe.Fade(CncMenuPaletteEffect.EffectType.Black));
|
||||||
Game.RunAfterDelay(1200 + 40 * mpe.Info.FadeLength, () =>
|
Game.RunAfterDelay(1200 + 40 * mpe.Info.FadeLength, () =>
|
||||||
{
|
{
|
||||||
Game.Disconnect();
|
Game.Disconnect();
|
||||||
Ui.ResetAll();
|
Ui.ResetAll();
|
||||||
Game.LoadShellMap();
|
Game.LoadShellMap();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -88,10 +90,39 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
onExit();
|
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 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)
|
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:
|
Container@CHEATS_PANEL:
|
||||||
Logic:CheatsLogic
|
Logic:CheatsLogic
|
||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
Width:PARENT_RIGHT
|
||||||
Y:(WINDOW_BOTTOM - 110)/2
|
Height:PARENT_BOTTOM
|
||||||
Width:590
|
|
||||||
Height:145
|
|
||||||
Children:
|
Children:
|
||||||
Label@TITLE:
|
Label@TITLE:
|
||||||
Width:590
|
Width:PARENT_RIGHT
|
||||||
Y:0-25
|
Y:0-25
|
||||||
Font:BigBold
|
Font:BigBold
|
||||||
Contrast:true
|
Contrast:true
|
||||||
Align:Center
|
Align:Center
|
||||||
Text:Cheats
|
Text:Debug Options
|
||||||
Background@bg:
|
Background@bg:
|
||||||
Width:590
|
Width:PARENT_RIGHT
|
||||||
Height:140
|
Height:PARENT_BOTTOM
|
||||||
Background:panel-black
|
Background:panel-black
|
||||||
Children:
|
Children:
|
||||||
|
Label@CHEATS_TITLE:
|
||||||
|
Y:25
|
||||||
|
Font:Bold
|
||||||
|
Text:Cheats
|
||||||
|
Align:Center
|
||||||
|
Width:PARENT_RIGHT
|
||||||
Checkbox@INSTANT_BUILD:
|
Checkbox@INSTANT_BUILD:
|
||||||
X:15
|
X:45
|
||||||
Y:15
|
Y:45
|
||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text:Instant Build Speed
|
Text:Instant Build Speed
|
||||||
Checkbox@ENABLE_TECH:
|
Checkbox@ENABLE_TECH:
|
||||||
X:15
|
X:45
|
||||||
Y:45
|
Y:75
|
||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text:Build Everything
|
Text:Build Everything
|
||||||
Checkbox@BUILD_ANYWHERE:
|
Checkbox@BUILD_ANYWHERE:
|
||||||
X:15
|
X:45
|
||||||
Y:75
|
Y:105
|
||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text:Build Anywhere
|
Text:Build Anywhere
|
||||||
Checkbox@UNLIMITED_POWER:
|
Checkbox@UNLIMITED_POWER:
|
||||||
X:200
|
X:290
|
||||||
Y:15
|
Y:45
|
||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text:Unlimited Power
|
Text:Unlimited Power
|
||||||
Checkbox@INSTANT_CHARGE:
|
Checkbox@INSTANT_CHARGE:
|
||||||
X:200
|
X:290
|
||||||
Y:45
|
Y:75
|
||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text:Instant Charge Time
|
Text:Instant Charge Time
|
||||||
Checkbox@SHOW_MUZZLES:
|
|
||||||
X:200
|
|
||||||
Y:75
|
|
||||||
Height:20
|
|
||||||
Width:200
|
|
||||||
Text:Show Muzzle Positions
|
|
||||||
Checkbox@DISABLE_SHROUD:
|
Checkbox@DISABLE_SHROUD:
|
||||||
X:400
|
X:290
|
||||||
Y:15
|
Y:105
|
||||||
Height:20
|
Height:20
|
||||||
Width:200
|
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:
|
Checkbox@SHOW_UNIT_PATHS:
|
||||||
X:400
|
X:45
|
||||||
Y:45
|
Y:235
|
||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text:Show Unit Paths
|
Text:Show Unit Paths
|
||||||
Checkbox@SHOW_ASTAR:
|
Checkbox@SHOW_ASTAR:
|
||||||
X:400
|
X:45
|
||||||
Y:75
|
Y:265
|
||||||
Height:20
|
Height:20
|
||||||
Width:200
|
Width:200
|
||||||
Text:Show A* Cost
|
Text:Show A* Cost
|
||||||
Checkbox@DESYNC_ARMED:
|
Checkbox@SHOW_MUZZLES:
|
||||||
X:400
|
X:290
|
||||||
Y:105
|
Y:235
|
||||||
Width:20
|
|
||||||
Height:20
|
Height:20
|
||||||
Button@DESYNC:
|
Width:200
|
||||||
X:430
|
Text:Show Muzzle Positions
|
||||||
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
|
|
||||||
@@ -74,12 +74,6 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Container@PLAYER_WIDGETS:
|
Container@PLAYER_WIDGETS:
|
||||||
Children:
|
Children:
|
||||||
LogicTicker@WIN_LOSS_WATCHER:
|
LogicTicker@WIN_LOSS_WATCHER:
|
||||||
Button@CHEATS_BUTTON:
|
|
||||||
X:WINDOW_RIGHT-400
|
|
||||||
Y:5
|
|
||||||
Width:140
|
|
||||||
Height:35
|
|
||||||
Text:Cheats
|
|
||||||
WorldCommand:
|
WorldCommand:
|
||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
Height:WINDOW_BOTTOM
|
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:
|
Container@INGAME_MENU:
|
||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
Height:WINDOW_BOTTOM
|
Height:WINDOW_BOTTOM
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ Container@SERVER_LOBBY:
|
|||||||
Y:257
|
Y:257
|
||||||
Width:130
|
Width:130
|
||||||
Height:20
|
Height:20
|
||||||
Text: Allow Cheats
|
Text: Debug Menu
|
||||||
Checkbox@CRATES_CHECKBOX:
|
Checkbox@CRATES_CHECKBOX:
|
||||||
X:160
|
X:160
|
||||||
Y:257
|
Y:257
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
Container@CONQUEST_OBJECTIVES:
|
Container@CONQUEST_OBJECTIVES:
|
||||||
Logic:CncConquestObjectivesLogic
|
Logic:CncConquestObjectivesLogic
|
||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
Width:PARENT_RIGHT
|
||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Height:PARENT_BOTTOM
|
||||||
Width:512
|
|
||||||
Height:320
|
|
||||||
Children:
|
Children:
|
||||||
Label@TITLE:
|
Label@TITLE:
|
||||||
Width:PARENT_RIGHT
|
Width:PARENT_RIGHT
|
||||||
|
|||||||
Reference in New Issue
Block a user