29 lines
996 B
C#
29 lines
996 B
C#
using Fantasy;
|
|
using Fantasy.Async;
|
|
using Fantasy.Network.Interface;
|
|
using NB.Game;
|
|
using NBF;
|
|
|
|
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
|
|
|
namespace NB;
|
|
|
|
public sealed class C2Mail_GetHaveMailRequestHandler : AddressRPC<Player, C2Mail_GetHaveMailRequest, Mail2C_GetHaveMailResposne>
|
|
{
|
|
protected override async FTask Run(Player 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);
|
|
}
|
|
} |