Add visual indicator when the game is muted.

This commit is contained in:
Paul Chote
2020-02-22 13:26:33 +00:00
committed by Matthias Mailänder
parent 3f601e1ec1
commit 85faa5edf6
8 changed files with 185 additions and 0 deletions

View File

@@ -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;
}
}
}

View File

@@ -112,6 +112,26 @@ Container@OBSERVER_WIDGETS:
Align: Center Align: Center
Font: Bold Font: Bold
Contrast: true 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: LogicKeyListener@OBSERVER_KEY_LISTENER:
MenuButton@OPTIONS_BUTTON: MenuButton@OPTIONS_BUTTON:
Key: escape Key: escape
@@ -1479,6 +1499,26 @@ Container@PLAYER_WIDGETS:
Y: 5 Y: 5
ImageCollection: stance-icons ImageCollection: stance-icons
ImageName: hold-fire 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: Image@SIDEBAR_BACKGROUND:
X: WINDOW_RIGHT - WIDTH - 5 X: WINDOW_RIGHT - WIDTH - 5
Y: 5 Y: 5

View File

@@ -2,6 +2,26 @@ Container@OBSERVER_WIDGETS:
Logic: MenuButtonsChromeLogic Logic: MenuButtonsChromeLogic
Children: Children:
LogicKeyListener@OBSERVER_KEY_LISTENER: 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: MenuButton@OPTIONS_BUTTON:
X: 5 X: 5
Y: 5 Y: 5

View File

@@ -248,6 +248,26 @@ Container@PLAYER_WIDGETS:
Y: 5 Y: 5
ImageCollection: stance-icons ImageCollection: stance-icons
ImageName: hold-fire 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: Image@SIDEBAR_BACKGROUND_TOP:
X: WINDOW_RIGHT - 226 X: WINDOW_RIGHT - 226
Y: 0 Y: 0

View File

@@ -1,5 +1,25 @@
Container@OBSERVER_WIDGETS: Container@OBSERVER_WIDGETS:
Children: 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: Image@SIDEBAR_BACKGROUND_TOP:
X: WINDOW_RIGHT - 250 X: WINDOW_RIGHT - 250
Y: 10 Y: 10

View File

@@ -275,6 +275,26 @@ Container@PLAYER_WIDGETS:
Y: 5 Y: 5
ImageCollection: stance-icons ImageCollection: stance-icons
ImageName: hold-fire 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: Image@SIDEBAR_BACKGROUND_TOP:
Logic: AddFactionSuffixLogic Logic: AddFactionSuffixLogic
X: WINDOW_RIGHT - 250 X: WINDOW_RIGHT - 250

View File

@@ -2,6 +2,26 @@ Container@OBSERVER_WIDGETS:
Logic: MenuButtonsChromeLogic Logic: MenuButtonsChromeLogic
Children: Children:
LogicKeyListener@OBSERVER_KEY_LISTENER: 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: MenuButton@OPTIONS_BUTTON:
X: 5 X: 5
Y: 5 Y: 5

View File

@@ -264,6 +264,26 @@ Container@PLAYER_WIDGETS:
Y: 5 Y: 5
ImageCollection: stance-icons ImageCollection: stance-icons
ImageName: hold-fire 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: Image@SIDEBAR_BACKGROUND_TOP:
Logic: AddFactionSuffixLogic Logic: AddFactionSuffixLogic
X: WINDOW_RIGHT - 235 X: WINDOW_RIGHT - 235