Skip to content

Commit

Permalink
handle kick from gameserver
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Jul 1, 2024
1 parent c5c5420 commit d7a1296
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ public enum GameServerPacketType : byte
EntitySetTarget = 0x11,
AutoAttackStart = 0x12,
AutoAttackStop = 0x13,
ActionFailed = 0x14
ActionFailed = 0x14,
ServerClose=0x15
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public override void HandlePacket(byte[] data) {
case GameServerPacketType.ActionFailed:
OnActionFailed(data);
break;
case GameServerPacketType.ServerClose:
OnServerClose();
break;
}
}

Expand Down Expand Up @@ -248,4 +251,9 @@ private void OnActionFailed(byte[] data) {
ActionFailedPacket packet = new ActionFailedPacket(data);
_eventProcessor.QueueEvent(() => PlayerEntity.Instance.OnActionFailed(packet.PlayerAction));
}

private void OnServerClose() {
Debug.Log("ServerClose received from Gameserver");
_client.Disconnect();
}
}

0 comments on commit d7a1296

Please sign in to comment.