using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;

namespace NB.Game;

public class
    S2G_GetPlayerBasicInfoRequestHandler : RouteRPC<Scene, S2G_GetPlayerBasicInfoRequest,
    G2S_GetPlayerBasicInfoResponse>
{
    protected override async FTask Run(Scene scene, S2G_GetPlayerBasicInfoRequest request,
        G2S_GetPlayerBasicInfoResponse response, Action reply)
    {
        var playerBasicCacheManageComponent = scene.GetComponent<PlayerBasicCacheManageComponent>();
        if (playerBasicCacheManageComponent != null)
        {
            var list = await playerBasicCacheManageComponent.GetPlayerBasicCacheInfos(request.IdList);
            if (list != null && list.Count > 0)
            {
                response.RoleList.AddRange(list);
            }
        }
    }
}