WutheringWaves/GameServer/Controllers/RoleController.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2024-02-09 22:15:05 +00:00
using GameServer.Controllers.Attributes;
using GameServer.Models;
using GameServer.Network;
using GameServer.Network.Messages;
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 RoleController : Controller
{
public RoleController(PlayerSession session) : base(session)
{
// RoleController.
2024-02-09 22:15:05 +00:00
}
[GameEvent(GameEventType.EnterGame)]
public async Task OnEnterGame(ModelManager modelManager)
{
PlayerModel player = modelManager.Player;
await Session.Push(MessageId.PbGetRoleListNotify, new PbGetRoleListNotify
{
RoleList =
{
player.Characters.Select(i => new roleInfo
2024-02-09 22:15:05 +00:00
{
RoleId = i,
Level = 1
})
2024-02-09 22:15:05 +00:00
}
});
}
[NetEvent(MessageId.SwitchRoleRequest)]
public ResponseMessage OnSwitchRoleRequest(SwitchRoleRequest request)
{
return Response(MessageId.SwitchRoleResponse, new SwitchRoleResponse
{
RoleId = request.RoleId
});
}
2024-02-09 22:15:05 +00:00
[NetEvent(MessageId.RoleFavorListRequest)]
public ResponseMessage OnRoleFavorListRequest() => Response(MessageId.RoleFavorListResponse, new RoleFavorListResponse());
}