//Client Receiving Information from Server public static void Welcome(Packet _packet) { string _msg = _packet.ReadString(); int _myId = _packet.ReadInt(); Console.WriteLine($"Message from server: {_msg}"); UserClient.instance.myId = _myId; ClientSend.WelcomeReceived(); UserClient.instance.udp.Connect(((IPEndPoint)UserClient.instance.tcp.socket.Client.LocalEndPoint).Port); }
private void HandleData(byte[] _data) { ClientSend.WelcomeReceived(); using (Packet _packet = new Packet(_data)) { int _packetLength = _packet.ReadInt(); _data = _packet.ReadBytes(_packetLength); } ThreadManager.ExecuteOnMainThread(() => { using (Packet _packet = new Packet(_data)) { int _packetId = _packet.ReadInt(); Console.WriteLine($"Packet ID {_packetId}"); packetHandlers[_packetId](_packet); } }); }