2024-02-09 22:15:05 +00:00
|
|
|
|
using GameServer.Controllers.Attributes;
|
|
|
|
|
using GameServer.Network;
|
2024-02-10 16:04:03 +00:00
|
|
|
|
using GameServer.Systems.Event;
|
2024-02-09 22:15:05 +00:00
|
|
|
|
using Protocol;
|
|
|
|
|
|
|
|
|
|
namespace GameServer.Controllers;
|
|
|
|
|
internal class LoginController : Controller
|
|
|
|
|
{
|
|
|
|
|
public LoginController(PlayerSession session) : base(session)
|
|
|
|
|
{
|
|
|
|
|
// LoginController.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NetEvent(MessageId.LoginRequest)]
|
2024-02-20 19:39:08 +00:00
|
|
|
|
public async Task<RpcResult> OnLoginRequest(EventSystem eventSystem)
|
2024-02-09 22:15:05 +00:00
|
|
|
|
{
|
|
|
|
|
await eventSystem.Emit(GameEventType.Login);
|
|
|
|
|
|
|
|
|
|
return Response(MessageId.LoginResponse, new LoginResponse
|
|
|
|
|
{
|
|
|
|
|
Code = 0,
|
2024-02-20 18:55:17 +00:00
|
|
|
|
Platform = "CBT3_EU",
|
2024-02-09 22:15:05 +00:00
|
|
|
|
Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NetEvent(MessageId.EnterGameRequest)]
|
2024-02-20 19:39:08 +00:00
|
|
|
|
public RpcResult OnEnterGameRequest()
|
2024-02-09 22:15:05 +00:00
|
|
|
|
{
|
2024-02-20 19:39:08 +00:00
|
|
|
|
return Response(MessageId.EnterGameResponse, new EnterGameResponse())
|
|
|
|
|
.AddPostEvent(GameEventType.EnterGame)
|
|
|
|
|
.AddPostEvent(GameEventType.PushDataDone);
|
|
|
|
|
}
|
2024-02-09 22:15:05 +00:00
|
|
|
|
|
2024-02-20 19:39:08 +00:00
|
|
|
|
[GameEvent(GameEventType.PushDataDone)]
|
|
|
|
|
public async Task OnPushDataDone()
|
|
|
|
|
{
|
2024-02-09 22:15:05 +00:00
|
|
|
|
await Session.Push(MessageId.PushDataCompleteNotify, new PushDataCompleteNotify());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NetEvent(MessageId.HeartbeatRequest)]
|
2024-02-20 19:39:08 +00:00
|
|
|
|
public RpcResult OnHeartbeatRequest() => Response(MessageId.HeartbeatResponse, new HeartbeatResponse());
|
2024-02-09 22:15:05 +00:00
|
|
|
|
}
|