ClickSound and ClickDisabledSound and ChatLine are optional ui sounds.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user