Disable world sounds when the ingame menu is open.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -60,6 +60,7 @@ Container@OBSERVER_WIDGETS:
|
||||
Background: sidebar-button-observer
|
||||
TooltipText: Options
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
DisableWorldSounds: true
|
||||
VisualHeight: 0
|
||||
Children:
|
||||
Image@ICON:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user