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)
|
if (button.Pause && world.LobbyInfo.IsSinglePlayer)
|
||||||
world.SetPauseState(true);
|
world.SetPauseState(true);
|
||||||
|
|
||||||
|
var cachedDisableWorldSounds = Game.Sound.DisableWorldSounds;
|
||||||
|
if (button.DisableWorldSounds)
|
||||||
|
Game.Sound.DisableWorldSounds = true;
|
||||||
|
|
||||||
widgetArgs = widgetArgs ?? new WidgetArgs();
|
widgetArgs = widgetArgs ?? new WidgetArgs();
|
||||||
widgetArgs.Add("onExit", () =>
|
widgetArgs.Add("onExit", () =>
|
||||||
{
|
{
|
||||||
if (button.HideIngameUI)
|
if (button.HideIngameUI)
|
||||||
worldRoot.IsVisible = () => true;
|
worldRoot.IsVisible = () => true;
|
||||||
|
|
||||||
|
if (button.DisableWorldSounds)
|
||||||
|
Game.Sound.DisableWorldSounds = cachedDisableWorldSounds;
|
||||||
|
|
||||||
if (button.Pause && world.LobbyInfo.IsSinglePlayer)
|
if (button.Pause && world.LobbyInfo.IsSinglePlayer)
|
||||||
world.SetPauseState(cachedPause);
|
world.SetPauseState(cachedPause);
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public readonly string MenuContainer = "INGAME_MENU";
|
public readonly string MenuContainer = "INGAME_MENU";
|
||||||
public readonly bool Pause = true;
|
public readonly bool Pause = true;
|
||||||
public readonly bool HideIngameUI = true;
|
public readonly bool HideIngameUI = true;
|
||||||
|
public readonly bool DisableWorldSounds = false;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MenuButtonWidget(ModData modData)
|
public MenuButtonWidget(ModData modData)
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Height: 25
|
Height: 25
|
||||||
TooltipText: Menu
|
TooltipText: Menu
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
Children:
|
Children:
|
||||||
Image:
|
Image:
|
||||||
X: 7
|
X: 7
|
||||||
@@ -275,6 +276,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Font: Bold
|
Font: Bold
|
||||||
TooltipText: Menu
|
TooltipText: Menu
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 7
|
X: 7
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Text: Options (Esc)
|
Text: Options (Esc)
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Key: escape
|
Key: escape
|
||||||
|
DisableWorldSounds: true
|
||||||
MenuButton@OBSERVER_STATS_BUTTON:
|
MenuButton@OBSERVER_STATS_BUTTON:
|
||||||
MenuContainer: INGAME_OBSERVERSTATS_BG
|
MenuContainer: INGAME_OBSERVERSTATS_BG
|
||||||
HideIngameUI: False
|
HideIngameUI: False
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background:
|
Background:
|
||||||
TooltipText: Debug Menu
|
TooltipText: Debug Menu
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
@@ -121,6 +122,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background:
|
Background:
|
||||||
TooltipText: Options
|
TooltipText: Options
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Background: sidebar-button-observer
|
Background: sidebar-button-observer
|
||||||
TooltipText: Options
|
TooltipText: Options
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background: sidebar-button
|
Background: sidebar-button
|
||||||
TooltipText: Debug Menu
|
TooltipText: Debug Menu
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
@@ -127,6 +128,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background: sidebar-button
|
Background: sidebar-button
|
||||||
TooltipText: Options
|
TooltipText: Options
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background: sidebar-button
|
Background: sidebar-button
|
||||||
TooltipText: Debug Menu
|
TooltipText: Debug Menu
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
@@ -130,6 +131,7 @@ Container@PLAYER_WIDGETS:
|
|||||||
Background: sidebar-button
|
Background: sidebar-button
|
||||||
TooltipText: Options
|
TooltipText: Options
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
DisableWorldSounds: true
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
|
|||||||
Reference in New Issue
Block a user