diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs index de41ecf354..f4951ab4e4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs @@ -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); diff --git a/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs b/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs index 140fcc4fca..ce4e151e4b 100644 --- a/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs @@ -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) diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index 8b0d861e32..95ec3ca692 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -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 diff --git a/mods/d2k/chrome/ingame-observer.yaml b/mods/d2k/chrome/ingame-observer.yaml index c57c1140f4..ea88067bf6 100644 --- a/mods/d2k/chrome/ingame-observer.yaml +++ b/mods/d2k/chrome/ingame-observer.yaml @@ -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 diff --git a/mods/d2k/chrome/ingame-player.yaml b/mods/d2k/chrome/ingame-player.yaml index 659a51d73a..d81993e30f 100644 --- a/mods/d2k/chrome/ingame-player.yaml +++ b/mods/d2k/chrome/ingame-player.yaml @@ -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: diff --git a/mods/ra/chrome/ingame-observer.yaml b/mods/ra/chrome/ingame-observer.yaml index 96a12da0b6..21191e2e96 100644 --- a/mods/ra/chrome/ingame-observer.yaml +++ b/mods/ra/chrome/ingame-observer.yaml @@ -60,6 +60,7 @@ Container@OBSERVER_WIDGETS: Background: sidebar-button-observer TooltipText: Options TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: diff --git a/mods/ra/chrome/ingame-player.yaml b/mods/ra/chrome/ingame-player.yaml index f1ac520c14..c5245b459c 100644 --- a/mods/ra/chrome/ingame-player.yaml +++ b/mods/ra/chrome/ingame-player.yaml @@ -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: diff --git a/mods/ts/chrome/ingame-player.yaml b/mods/ts/chrome/ingame-player.yaml index f4892cfec4..e70784c33d 100644 --- a/mods/ts/chrome/ingame-player.yaml +++ b/mods/ts/chrome/ingame-player.yaml @@ -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: