Files
ServerStudy/邮件系统课程完整代码/Server/Hotfix/Mail/Handler/Outer/C2Mail_GetHaveMailRequestHandler.cs
2026-03-05 11:39:06 +08:00

25 lines
961 B
C#

using Fantasy.Async;
using Fantasy.Network.Interface;
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
namespace Fantasy;
public sealed class C2Mail_GetHaveMailRequestHandler : RouteRPC<MailUnit, C2Mail_GetHaveMailRequest, Mail2C_GetHaveMailResposne>
{
protected override async FTask Run(MailUnit mailUnit, C2Mail_GetHaveMailRequest request, Mail2C_GetHaveMailResposne response, Action reply)
{
var mailComponent = mailUnit.GetComponent<MailComponent>();
// 这个mailComponent是不是可能会为空?答案是可能的。
// 那如果是空的怎么办呢,这样情况只能是别人恶意发包了。
if (mailComponent == null)
{
return;
}
// 检查是否有超时的邮件。如果有那就清楚掉
await mailComponent.CheckTimeOut();
// 领取当前的邮件
mailComponent.GetMailSimplifyInfos(response.Mails);
}
}