You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.7 KiB
43 lines
1.7 KiB
3 years ago
|
using System;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
[FriendClass(typeof(SessionPlayerComponent))]
|
||
|
public class L2G_DisconnectGateUnitHandler : AMActorRpcHandler<Scene, L2G_DisconnectGateUnit, G2L_DisconnectGateUnit>
|
||
|
{
|
||
|
protected override async ETTask Run(Scene scene, L2G_DisconnectGateUnit request, G2L_DisconnectGateUnit response, Action reply)
|
||
|
{
|
||
|
long accountId = request.AccountId;
|
||
|
|
||
|
using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.LoginGate, accountId.GetHashCode()))
|
||
|
{
|
||
|
PlayerComponent playerComponent = scene.GetComponent<PlayerComponent>();
|
||
|
Player player = playerComponent.Get(accountId);
|
||
|
|
||
|
if (player == null)
|
||
|
{
|
||
|
reply();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
scene.GetComponent<GateSessionKeyComponent>().Remove(accountId);
|
||
|
Session gateSession = Game.EventSystem.Get(player.SessionInstanceId) as Session;
|
||
|
if (gateSession != null && !gateSession.IsDisposed)
|
||
|
{
|
||
|
var sessionPlayerComp = gateSession.GetComponent<SessionPlayerComponent>();
|
||
|
if (sessionPlayerComp != null)
|
||
|
{
|
||
|
sessionPlayerComp.IsLoginAgain = true;
|
||
|
}
|
||
|
gateSession.Send(new A2C_Disconnect() { Error = ErrorCode.ERR_OtherAccountLogin});
|
||
|
gateSession?.Disconnect().Coroutine();
|
||
|
}
|
||
|
|
||
|
player.SessionInstanceId = 0;
|
||
|
player.AddComponent<PlayerOfflineOutTimeComponent>();
|
||
|
}
|
||
|
|
||
|
reply();
|
||
|
}
|
||
|
}
|
||
|
}
|