-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55ada61
commit 01a00d1
Showing
4 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using AutomaticTypeMapper; | ||
|
||
namespace EOLib.Domain.Notifiers | ||
{ | ||
public interface IJukeboxNotifier | ||
{ | ||
void JukeboxUnavailable(); | ||
} | ||
|
||
[AutoMappedType] | ||
public class NoOpJukeboxNotifier : IJukeboxNotifier | ||
{ | ||
public void JukeboxUnavailable() { } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Login; | ||
using EOLib.Domain.Notifiers; | ||
using EOLib.Net.Handlers; | ||
using Moffat.EndlessOnline.SDK.Protocol.Net; | ||
using Moffat.EndlessOnline.SDK.Protocol.Net.Server; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.PacketHandlers.Jukebox | ||
{ | ||
[AutoMappedType] | ||
public class JukeboxReplyHandler : InGameOnlyPacketHandler<JukeboxReplyServerPacket> | ||
{ | ||
private readonly IEnumerable<IJukeboxNotifier> _jukeboxNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Jukebox; | ||
|
||
public override PacketAction Action => PacketAction.Reply; | ||
|
||
public JukeboxReplyHandler(IPlayerInfoProvider playerInfoProvider, | ||
IEnumerable<IJukeboxNotifier> jukeboxNotifiers) | ||
: base(playerInfoProvider) | ||
{ | ||
_jukeboxNotifiers = jukeboxNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(JukeboxReplyServerPacket packet) | ||
{ | ||
foreach (var notifier in _jukeboxNotifiers) | ||
notifier.JukeboxUnavailable(); | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using AutomaticTypeMapper; | ||
using EndlessClient.Dialogs.Factories; | ||
using EOLib.Domain.Notifiers; | ||
using EOLib.Localization; | ||
|
||
namespace EndlessClient.Subscribers | ||
{ | ||
[AutoMappedType] | ||
public class JukeboxEventSubscriber : IJukeboxNotifier | ||
{ | ||
private readonly IEOMessageBoxFactory _messageBoxFactory; | ||
|
||
public JukeboxEventSubscriber(IEOMessageBoxFactory messageBoxFactory) | ||
{ | ||
_messageBoxFactory = messageBoxFactory; | ||
} | ||
|
||
public void JukeboxUnavailable() | ||
{ | ||
var dlg = _messageBoxFactory.CreateMessageBox(DialogResourceID.JUKEBOX_REQUESTED_RECENTLY); | ||
dlg.ShowDialog(); | ||
} | ||
} | ||
} |