Update TextNotificationsManager to use Ui.Send
This commit is contained in:
@@ -21,9 +21,8 @@ using OpenRA.Widgets;
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
[ChromeLogicArgsHotkeys("OpenTeamChat", "OpenGeneralChat")]
|
||||
public class IngameChatLogic : ChromeLogic
|
||||
public class IngameChatLogic : ChromeLogic, INotificationHandler<TextNotification>
|
||||
{
|
||||
readonly OrderManager orderManager;
|
||||
readonly Ruleset modRules;
|
||||
readonly World world;
|
||||
|
||||
@@ -47,7 +46,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
[ObjectCreator.UseCtor]
|
||||
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, ModData modData, bool isMenuChat, Dictionary<string, MiniYaml> logicArgs)
|
||||
{
|
||||
this.orderManager = orderManager;
|
||||
modRules = modData.DefaultRules;
|
||||
this.isMenuChat = isMenuChat;
|
||||
this.world = world;
|
||||
@@ -209,12 +207,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
chatScrollPanel.RemoveChildren();
|
||||
chatScrollPanel.ScrollToBottom();
|
||||
|
||||
foreach (var notification in orderManager.NotificationsCache)
|
||||
foreach (var notification in TextNotificationsManager.Notifications)
|
||||
if (IsNotificationEligible(notification))
|
||||
AddNotification(notification, true);
|
||||
|
||||
orderManager.AddTextNotification += AddNotificationWrapper;
|
||||
|
||||
chatText.IsDisabled = () => !chatEnabled || (world.IsReplay && !Game.Settings.Debug.EnableDebugCommandsInReplays);
|
||||
|
||||
if (!isMenuChat)
|
||||
@@ -260,7 +256,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Ui.ResetTooltips();
|
||||
}
|
||||
|
||||
public void AddNotificationWrapper(TextNotification notification)
|
||||
void INotificationHandler<TextNotification>.Handle(TextNotification notification)
|
||||
{
|
||||
if (!IsNotificationEligible(notification))
|
||||
return;
|
||||
@@ -315,18 +311,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
notification.Pool == TextNotificationPool.Mission;
|
||||
}
|
||||
|
||||
bool disposed = false;
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
orderManager.AddTextNotification -= AddNotificationWrapper;
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
bool IsNotificationMuted(TextNotification notification)
|
||||
{
|
||||
return Game.Settings.Game.HideReplayChat && world.IsReplay && notification.ClientId != TextNotificationsManager.SystemClientId;
|
||||
|
||||
Reference in New Issue
Block a user