Disable world sounds when the ingame menu is open.

This commit is contained in:
Paul Chote
2016-12-10 18:41:31 +00:00
parent 443c3ee72d
commit 55f76c02d6
8 changed files with 18 additions and 0 deletions

View File

@@ -105,12 +105,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (button.Pause && world.LobbyInfo.IsSinglePlayer)
world.SetPauseState(true);
var cachedDisableWorldSounds = Game.Sound.DisableWorldSounds;
if (button.DisableWorldSounds)
Game.Sound.DisableWorldSounds = true;
widgetArgs = widgetArgs ?? new WidgetArgs();
widgetArgs.Add("onExit", () =>
{
if (button.HideIngameUI)
worldRoot.IsVisible = () => true;
if (button.DisableWorldSounds)
Game.Sound.DisableWorldSounds = cachedDisableWorldSounds;
if (button.Pause && world.LobbyInfo.IsSinglePlayer)
world.SetPauseState(cachedPause);

View File

@@ -16,6 +16,7 @@ namespace OpenRA.Mods.Common.Widgets
public readonly string MenuContainer = "INGAME_MENU";
public readonly bool Pause = true;
public readonly bool HideIngameUI = true;
public readonly bool DisableWorldSounds = false;
[ObjectCreator.UseCtor]
public MenuButtonWidget(ModData modData)

View File

@@ -91,6 +91,7 @@ Container@OBSERVER_WIDGETS:
Height: 25
TooltipText: Menu
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
Children:
Image:
X: 7
@@ -275,6 +276,7 @@ Container@PLAYER_WIDGETS:
Font: Bold
TooltipText: Menu
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
Children:
Image@ICON:
X: 7

View File

@@ -7,6 +7,7 @@ Container@OBSERVER_WIDGETS:
Text: Options (Esc)
Font: Bold
Key: escape
DisableWorldSounds: true
MenuButton@OBSERVER_STATS_BUTTON:
MenuContainer: INGAME_OBSERVERSTATS_BG
HideIngameUI: False

View File

@@ -49,6 +49,7 @@ Container@PLAYER_WIDGETS:
Background:
TooltipText: Debug Menu
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
VisualHeight: 0
Children:
Image@ICON:
@@ -121,6 +122,7 @@ Container@PLAYER_WIDGETS:
Background:
TooltipText: Options
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
VisualHeight: 0
Children:
Image@ICON:

View File

@@ -60,6 +60,7 @@ Container@OBSERVER_WIDGETS:
Background: sidebar-button-observer
TooltipText: Options
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
VisualHeight: 0
Children:
Image@ICON:

View File

@@ -111,6 +111,7 @@ Container@PLAYER_WIDGETS:
Background: sidebar-button
TooltipText: Debug Menu
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
VisualHeight: 0
Children:
Image@ICON:
@@ -127,6 +128,7 @@ Container@PLAYER_WIDGETS:
Background: sidebar-button
TooltipText: Options
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
VisualHeight: 0
Children:
Image@ICON:

View File

@@ -53,6 +53,7 @@ Container@PLAYER_WIDGETS:
Background: sidebar-button
TooltipText: Debug Menu
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
VisualHeight: 0
Children:
Image@ICON:
@@ -130,6 +131,7 @@ Container@PLAYER_WIDGETS:
Background: sidebar-button
TooltipText: Options
TooltipContainer: TOOLTIP_CONTAINER
DisableWorldSounds: true
VisualHeight: 0
Children:
Image@ICON: