提交示例代码
This commit is contained in:
23
邮件系统课程完整代码/Server/Hotfix/Gate/Handler/C2G_ExitHandler.cs
Normal file
23
邮件系统课程完整代码/Server/Hotfix/Gate/Handler/C2G_ExitHandler.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
using Fantasy.Network.Interface;
|
||||
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class C2G_ExitHandler : Message<C2G_Exit>
|
||||
{
|
||||
protected override async FTask Run(Session session, C2G_Exit message)
|
||||
{
|
||||
var gateAccountFlagComponent = session.GetComponent<GateAccountFlagComponent>();
|
||||
if (gateAccountFlagComponent == null)
|
||||
{
|
||||
Log.Warning($"有用户不是通过正常途径访问到这个接口,IP:{session.RemoteEndPoint.ToString()}");
|
||||
return;
|
||||
}
|
||||
Log.Debug($"用户名:{gateAccountFlagComponent.Account.Name} 退出游戏的协议。");
|
||||
// 如果执行了这个session.Dispose,就会断开这个连接,这样的情况下,客户端也会断开。
|
||||
session.Dispose();
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user