diff --git a/OpenRA.Mods.Common/Widgets/Logic/MuteIndicatorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MuteIndicatorLogic.cs new file mode 100644 index 0000000000..f7e84e6585 --- /dev/null +++ b/OpenRA.Mods.Common/Widgets/Logic/MuteIndicatorLogic.cs @@ -0,0 +1,25 @@ +#region Copyright & License Information +/* + * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using OpenRA.Widgets; + +namespace OpenRA.Mods.Common.Widgets.Logic +{ + public class MuteIndicatorLogic : ChromeLogic + { + [ObjectCreator.UseCtor] + public MuteIndicatorLogic(Widget widget) + { + var gs = Game.Settings.Sound; + widget.IsVisible = () => gs.Mute; + } + } +} diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index 0c8b5b4b4a..6722809660 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -112,6 +112,26 @@ Container@OBSERVER_WIDGETS: Align: Center Font: Bold Contrast: true + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 295 + Y: 5 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true LogicKeyListener@OBSERVER_KEY_LISTENER: MenuButton@OPTIONS_BUTTON: Key: escape @@ -1479,6 +1499,26 @@ Container@PLAYER_WIDGETS: Y: 5 ImageCollection: stance-icons ImageName: hold-fire + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 240 + Y: 5 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true Image@SIDEBAR_BACKGROUND: X: WINDOW_RIGHT - WIDTH - 5 Y: 5 diff --git a/mods/d2k/chrome/ingame-observer.yaml b/mods/d2k/chrome/ingame-observer.yaml index 2055764af8..ec746c8e5d 100644 --- a/mods/d2k/chrome/ingame-observer.yaml +++ b/mods/d2k/chrome/ingame-observer.yaml @@ -2,6 +2,26 @@ Container@OBSERVER_WIDGETS: Logic: MenuButtonsChromeLogic Children: LogicKeyListener@OBSERVER_KEY_LISTENER: + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 260 + Y: 5 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true MenuButton@OPTIONS_BUTTON: X: 5 Y: 5 diff --git a/mods/d2k/chrome/ingame-player.yaml b/mods/d2k/chrome/ingame-player.yaml index 1003835f62..17223ebbca 100644 --- a/mods/d2k/chrome/ingame-player.yaml +++ b/mods/d2k/chrome/ingame-player.yaml @@ -248,6 +248,26 @@ Container@PLAYER_WIDGETS: Y: 5 ImageCollection: stance-icons ImageName: hold-fire + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 231 + Y: 5 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true Image@SIDEBAR_BACKGROUND_TOP: X: WINDOW_RIGHT - 226 Y: 0 diff --git a/mods/ra/chrome/ingame-observer.yaml b/mods/ra/chrome/ingame-observer.yaml index 1c83d8c29c..a82be94fb9 100644 --- a/mods/ra/chrome/ingame-observer.yaml +++ b/mods/ra/chrome/ingame-observer.yaml @@ -1,5 +1,25 @@ Container@OBSERVER_WIDGETS: Children: + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 260 + Y: 10 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true Image@SIDEBAR_BACKGROUND_TOP: X: WINDOW_RIGHT - 250 Y: 10 diff --git a/mods/ra/chrome/ingame-player.yaml b/mods/ra/chrome/ingame-player.yaml index 535df496f3..09d731a78c 100644 --- a/mods/ra/chrome/ingame-player.yaml +++ b/mods/ra/chrome/ingame-player.yaml @@ -275,6 +275,26 @@ Container@PLAYER_WIDGETS: Y: 5 ImageCollection: stance-icons ImageName: hold-fire + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 260 + Y: 10 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true Image@SIDEBAR_BACKGROUND_TOP: Logic: AddFactionSuffixLogic X: WINDOW_RIGHT - 250 diff --git a/mods/ts/chrome/ingame-observer.yaml b/mods/ts/chrome/ingame-observer.yaml index ef7ebf4b74..934e43b9c2 100644 --- a/mods/ts/chrome/ingame-observer.yaml +++ b/mods/ts/chrome/ingame-observer.yaml @@ -2,6 +2,26 @@ Container@OBSERVER_WIDGETS: Logic: MenuButtonsChromeLogic Children: LogicKeyListener@OBSERVER_KEY_LISTENER: + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 260 + Y: 5 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true MenuButton@OPTIONS_BUTTON: X: 5 Y: 5 diff --git a/mods/ts/chrome/ingame-player.yaml b/mods/ts/chrome/ingame-player.yaml index 3e6ad68f74..f346ba963d 100644 --- a/mods/ts/chrome/ingame-player.yaml +++ b/mods/ts/chrome/ingame-player.yaml @@ -264,6 +264,26 @@ Container@PLAYER_WIDGETS: Y: 5 ImageCollection: stance-icons ImageName: hold-fire + Container@MUTE_INDICATOR: + Logic: MuteIndicatorLogic + X: WINDOW_RIGHT - WIDTH - 245 + Y: 5 + Width: 200 + Height: 25 + Children: + Image@ICON: + X: PARENT_RIGHT - WIDTH + Y: 1 + Width: 24 + Height: 24 + ImageCollection: sidebar-bits + ImageName: indicator-muted + Label@LABEL: + Width: PARENT_RIGHT - 30 + Height: 25 + Align: Right + Text: Audio Muted + Contrast: true Image@SIDEBAR_BACKGROUND_TOP: Logic: AddFactionSuffixLogic X: WINDOW_RIGHT - 235