ClickSound and ClickDisabledSound and ChatLine are optional ui sounds.
This commit is contained in:
@@ -40,6 +40,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public bool Shadow = ChromeMetrics.Get<bool>("ButtonTextShadow");
|
||||
public Color ContrastColorDark = ChromeMetrics.Get<Color>("ButtonTextContrastColorDark");
|
||||
public Color ContrastColorLight = ChromeMetrics.Get<Color>("ButtonTextContrastColorLight");
|
||||
public string ClickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||
public string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
|
||||
public bool Disabled = false;
|
||||
public bool Highlighted = false;
|
||||
public Func<string> GetText;
|
||||
@@ -144,10 +146,10 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
OnKeyPress(e);
|
||||
if (!DisableKeySound)
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", ClickSound, null);
|
||||
}
|
||||
else if (!DisableKeySound)
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", ClickDisabledSound, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -185,12 +187,12 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
OnMouseDown(mi);
|
||||
Depressed = true;
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", ClickSound, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
YieldMouseFocus(mi);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Game.Sound.PlayNotification(ModRules, null, "Sounds", ClickDisabledSound, null);
|
||||
}
|
||||
}
|
||||
else if (mi.Event == MouseInputEvent.Move && HasMouseFocus)
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
// Mask to prevent any clicks from being sent to other widgets
|
||||
fullscreenMask = new MaskWidget();
|
||||
fullscreenMask.Bounds = new Rectangle(0, 0, Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height);
|
||||
fullscreenMask.OnMouseDown += mi => { Game.Sound.PlayNotification(ModRules, null, "Sounds", "ClickSound", null); RemovePanel(); };
|
||||
fullscreenMask.OnMouseDown += mi => { Game.Sound.PlayNotification(ModRules, null, "Sounds", ClickSound, null); RemovePanel(); };
|
||||
if (onCancel != null)
|
||||
fullscreenMask.OnMouseDown += _ => onCancel();
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
readonly Selection selection;
|
||||
readonly World world;
|
||||
|
||||
readonly string clickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CycleProductionActorsHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||
: base(widget, modData, "CycleProductionActorsKey", "WORLD_KEYHANDLER", logicArgs)
|
||||
@@ -32,6 +34,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
viewport = worldRenderer.Viewport;
|
||||
selection = world.Selection;
|
||||
this.world = world;
|
||||
|
||||
MiniYaml yaml;
|
||||
if (logicArgs.TryGetValue("ClickSound", out yaml))
|
||||
clickSound = yaml.Value;
|
||||
}
|
||||
|
||||
protected override bool OnHotkeyActivated(KeyInput e)
|
||||
@@ -54,7 +60,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
if (next == null)
|
||||
next = facilities.First();
|
||||
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", clickSound, null);
|
||||
|
||||
selection.Combine(world, new Actor[] { next }, false, true);
|
||||
viewport.Center(selection.Actors);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Commands;
|
||||
@@ -36,11 +37,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
readonly TabCompletionLogic tabCompletion = new TabCompletionLogic();
|
||||
|
||||
readonly string chatLineSound = ChromeMetrics.Get<string>("ChatLineSound");
|
||||
|
||||
bool disableTeamChat;
|
||||
bool teamChat;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, ModData modData, bool isMenuChat)
|
||||
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, ModData modData, bool isMenuChat, Dictionary<string, MiniYaml> logicArgs)
|
||||
{
|
||||
this.orderManager = orderManager;
|
||||
this.modRules = modData.DefaultRules;
|
||||
@@ -167,6 +170,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
MiniYaml yaml;
|
||||
if (logicArgs.TryGetValue("ChatLineSound", out yaml))
|
||||
chatLineSound = yaml.Value;
|
||||
}
|
||||
|
||||
bool SwitchTeamChat()
|
||||
@@ -239,7 +246,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
chatScrollPanel.ScrollToBottom(smooth: true);
|
||||
|
||||
if (!suppressSound)
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", chatLineSound, null);
|
||||
}
|
||||
|
||||
bool disposed = false;
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
readonly World world;
|
||||
readonly Widget worldRoot;
|
||||
readonly Widget menuRoot;
|
||||
readonly string clickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||
|
||||
bool disableSystemButtons;
|
||||
Widget currentWidget;
|
||||
|
||||
@@ -107,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
if (statsHotkeys[i].IsActivatedBy(e))
|
||||
{
|
||||
Game.Sound.PlayNotification(modData.DefaultRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(modData.DefaultRules, null, "Sounds", clickSound, null);
|
||||
OpenMenuPanel(stats, new WidgetArgs() { { "activePanel", i } });
|
||||
return true;
|
||||
}
|
||||
@@ -117,6 +119,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (logicArgs.TryGetValue("ClickSound", out yaml))
|
||||
clickSound = yaml.Value;
|
||||
}
|
||||
|
||||
void OpenMenuPanel(MenuButtonWidget button, WidgetArgs widgetArgs = null)
|
||||
|
||||
@@ -43,6 +43,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
readonly World world;
|
||||
readonly WorldRenderer worldRenderer;
|
||||
|
||||
readonly string clickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ObserverStatsLogic(World world, ModData modData, WorldRenderer worldRenderer, Widget widget,
|
||||
Action onExit, ObserverStatsPanel activePanel, Dictionary<string, MiniYaml> logicArgs)
|
||||
@@ -128,7 +130,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
if (statsHotkeys[i].IsActivatedBy(e))
|
||||
{
|
||||
Game.Sound.PlayNotification(modData.DefaultRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(modData.DefaultRules, null, "Sounds", clickSound, null);
|
||||
statsDropDownOptions[i].OnClick();
|
||||
return true;
|
||||
}
|
||||
@@ -137,6 +139,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (logicArgs.TryGetValue("ClickSound", out yaml))
|
||||
clickSound = yaml.Value;
|
||||
}
|
||||
|
||||
void ClearStats()
|
||||
|
||||
@@ -63,6 +63,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
bool addBotOnMapLoad;
|
||||
bool teamChat;
|
||||
|
||||
readonly string chatLineSound = ChromeMetrics.Get<string>("ChatLineSound");
|
||||
|
||||
// Listen for connection failures
|
||||
void ConnectionStateChanged(OrderManager om)
|
||||
{
|
||||
@@ -95,7 +97,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
internal LobbyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, OrderManager orderManager,
|
||||
Action onExit, Action onStart, bool skirmishMode)
|
||||
Action onExit, Action onStart, bool skirmishMode, Dictionary<string, MiniYaml> logicArgs)
|
||||
{
|
||||
map = MapCache.UnknownMap;
|
||||
lobby = widget;
|
||||
@@ -433,6 +435,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
// Add a bot on the first lobbyinfo update
|
||||
if (skirmishMode)
|
||||
addBotOnMapLoad = true;
|
||||
|
||||
MiniYaml yaml;
|
||||
if (logicArgs.TryGetValue("ChatLineSound", out yaml))
|
||||
chatLineSound = yaml.Value;
|
||||
}
|
||||
|
||||
bool disposed;
|
||||
@@ -472,7 +478,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (scrolledToBottom)
|
||||
lobbyChatPanel.ScrollToBottom(smooth: true);
|
||||
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", chatLineSound, null);
|
||||
}
|
||||
|
||||
bool SwitchTeamChat()
|
||||
|
||||
@@ -73,6 +73,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public readonly int TabWidth = 30;
|
||||
public readonly int ArrowWidth = 20;
|
||||
|
||||
public readonly string ClickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||
public readonly string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
|
||||
|
||||
public readonly HotkeyReference PreviousProductionTabKey = new HotkeyReference();
|
||||
public readonly HotkeyReference NextProductionTabKey = new HotkeyReference();
|
||||
|
||||
@@ -270,9 +273,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (leftPressed || rightPressed)
|
||||
{
|
||||
if ((leftPressed && !leftDisabled) || (rightPressed && !rightDisabled))
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", ClickSound, null);
|
||||
else
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", ClickDisabledSound, null);
|
||||
}
|
||||
|
||||
// Check production tabs
|
||||
@@ -280,7 +283,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (offsetloc.X > 0 && offsetloc.X < contentWidth)
|
||||
{
|
||||
CurrentQueue = Groups[queueGroup].Tabs[offsetloc.X / (TabWidth - 1)].Queue;
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", ClickSound, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -293,13 +296,13 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
if (PreviousProductionTabKey.IsActivatedBy(e))
|
||||
{
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", ClickSound, null);
|
||||
return SelectNextTab(true);
|
||||
}
|
||||
|
||||
if (NextProductionTabKey.IsActivatedBy(e))
|
||||
{
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", ClickSound, null);
|
||||
return SelectNextTab(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public int TopBottomSpacing = 2;
|
||||
public int ItemSpacing = 0;
|
||||
public int ButtonDepth = ChromeMetrics.Get<int>("ButtonDepth");
|
||||
public string ClickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||
public string Background = "scrollpanel-bg";
|
||||
public string Button = "scrollpanel-button";
|
||||
public int ContentHeight;
|
||||
@@ -323,7 +324,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
lastMouseLocation = mi.Location;
|
||||
|
||||
if (mi.Event == MouseInputEvent.Down && ((upPressed && !upDisabled) || (downPressed && !downDisabled) || thumbPressed))
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", "ClickSound", null);
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", ClickSound, null);
|
||||
}
|
||||
|
||||
return upPressed || downPressed || thumbPressed;
|
||||
|
||||
@@ -7,3 +7,6 @@ Metrics:
|
||||
ColorPickerActorType: fact.colorpicker
|
||||
ColorPickerRemapIndices: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
|
||||
TextfieldColorHighlight: 800000
|
||||
ChatLineSound: ChatLine
|
||||
ClickDisabledSound: ClickDisabledSound
|
||||
ClickSound: ClickSound
|
||||
|
||||
@@ -7,3 +7,6 @@ Metrics:
|
||||
FactionSuffix-smuggler: ordos
|
||||
FactionSuffix-mercenary: ordos
|
||||
TextfieldColorHighlight: 7f4d29
|
||||
ChatLineSound: ChatLine
|
||||
ClickDisabledSound: ClickDisabledSound
|
||||
ClickSound: ClickSound
|
||||
|
||||
@@ -6,3 +6,6 @@ Metrics:
|
||||
ButtonFont: Bold
|
||||
CheckboxPressedState: true
|
||||
ColorPickerRemapIndices: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
|
||||
ChatLineSound: ChatLine
|
||||
ClickDisabledSound: ClickDisabledSound
|
||||
ClickSound: ClickSound
|
||||
|
||||
@@ -16,3 +16,6 @@ Metrics:
|
||||
IncompatibleProtectedGameColor: B22222
|
||||
IncompatibleVersionColor: D3D3D3
|
||||
TextfieldColorHighlight: 562020
|
||||
ChatLineSound: ChatLine
|
||||
ClickDisabledSound: ClickDisabledSound
|
||||
ClickSound: ClickSound
|
||||
|
||||
@@ -3,3 +3,6 @@ Metrics:
|
||||
ColorPickerActorType: mmch.colorpicker
|
||||
ColorPickerRemapIndices: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
|
||||
TextfieldColorHighlight: 1a1a1a
|
||||
ChatLineSound: ChatLine
|
||||
ClickDisabledSound: ClickDisabledSound
|
||||
ClickSound: ClickSound
|
||||
|
||||
Reference in New Issue
Block a user