Cache pause state and switch back to it when closing the ingame menu. Fix formatting fail in d2k mod.yaml

This commit is contained in:
Scott_NZ
2013-04-26 18:13:34 +12:00
parent e332571102
commit 5d4fa5eea9
2 changed files with 15 additions and 5 deletions

View File

@@ -38,14 +38,16 @@ namespace OpenRA.Mods.RA.Widgets.Logic
void InitRootWidgets() void InitRootWidgets()
{ {
var cachedPause = false;
Widget optionsBG = null; Widget optionsBG = null;
optionsBG = Game.LoadWidget(world, "INGAME_OPTIONS_BG", Ui.Root, new WidgetArgs optionsBG = Game.LoadWidget(world, "INGAME_OPTIONS_BG", Ui.Root, new WidgetArgs
{ {
{ "onExit", () => { "onExit", () =>
{ {
if (world.LobbyInfo.IsSinglePlayer)
world.IssueOrder(Order.PauseGame(false));
optionsBG.Visible = false; optionsBG.Visible = false;
if (world.LobbyInfo.IsSinglePlayer)
world.IssueOrder(Order.PauseGame(cachedPause));
} }
} }
}); });
@@ -53,8 +55,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic
gameRoot.Get<ButtonWidget>("INGAME_OPTIONS_BUTTON").OnClick = () => gameRoot.Get<ButtonWidget>("INGAME_OPTIONS_BUTTON").OnClick = () =>
{ {
optionsBG.Visible ^= true; optionsBG.Visible ^= true;
if (world.LobbyInfo.IsSinglePlayer) if (optionsBG.Visible)
world.IssueOrder(Order.PauseGame(optionsBG.Visible)); {
cachedPause = world.Paused;
if (world.LobbyInfo.IsSinglePlayer)
world.IssueOrder(Order.PauseGame(true));
}
else
world.IssueOrder(Order.PauseGame(cachedPause));
}; };
Game.LoadWidget(world, "CHAT_PANEL", gameRoot, new WidgetArgs()); Game.LoadWidget(world, "CHAT_PANEL", gameRoot, new WidgetArgs());

View File

@@ -61,7 +61,8 @@ ChromeLayout:
mods/ra/chrome/dropdowns.yaml mods/ra/chrome/dropdowns.yaml
mods/ra/chrome/modchooser.yaml mods/ra/chrome/modchooser.yaml
mods/ra/chrome/cheats.yaml mods/ra/chrome/cheats.yaml
mods/ra/chrome/musicplayer.yaml mods/d2k/chrome/tooltips.yaml mods/ra/chrome/musicplayer.yaml
mods/d2k/chrome/tooltips.yaml
Weapons: Weapons:
mods/d2k/weapons/defaults.yaml mods/d2k/weapons/defaults.yaml
mods/d2k/weapons/explosions.yaml mods/d2k/weapons/explosions.yaml