32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using Tiger.Communication.Messages.Interfaces;
|
|
using Tiger.Communication.Messages.Outgoing.Navigator;
|
|
using Tiger.Communication.Messages.Types;
|
|
using Tiger.Game.Navigator;
|
|
using Tiger.Networking.Game.Sessions;
|
|
|
|
namespace Tiger.Communication.Messages.Incoming.Navigator;
|
|
|
|
public class NavigatorInitEvent : IMessageEvent
|
|
{
|
|
private readonly IGameSessionManager _gameSessionManager;
|
|
private readonly INavigatorManager _navigatorManager;
|
|
|
|
public NavigatorInitEvent(IGameSessionManager gameSessionManager, INavigatorManager navigatorManager)
|
|
{
|
|
_gameSessionManager = gameSessionManager;
|
|
_navigatorManager = navigatorManager;
|
|
}
|
|
|
|
public IncomingHeaders Header => IncomingHeaders.NavigatorInit;
|
|
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
|
{
|
|
if (gameSession.Habbo == null)
|
|
{
|
|
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
|
return;
|
|
}
|
|
|
|
await gameSession.SendComposerAsync(new NavigatorMetadataComposer(_navigatorManager.NavigatorViews.Values));
|
|
await gameSession.SendComposerAsync(new NavigatorCollapsedComposer());
|
|
}
|
|
} |