void OnReceivePacket(ushort type, Stream stream) { switch (type) { case (ushort)UserPacketType.Message: MessagePacket messagePacket = new MessagePacket(); messagePacket.Deserialize(stream); if (ConnectionManager.Instance.isServer) { MessageManager.Instance.SendString(messagePacket.payload, 0); } messages.text += messagePacket.payload + System.Environment.NewLine; break; case (ushort)UserPacketType.Position: PositionPacket positionPacket = new PositionPacket(); positionPacket.Deserialize(stream); if (ConnectionManager.Instance.isServer) { MessageManager.Instance.SendPosition(positionPacket.payload, 0); } // Aca enviaria el payload a donde sea necesario break; } }
void OnReceivePacket(ushort type, Stream stream) { switch (type) { case (ushort)UserPacketType.Message: MessagePacket messagePacket = new MessagePacket(); messagePacket.Deserialize(stream); text.text = messagePacket.payload; break; } }
public void OnReceivePacket(ushort packetType, Stream stream, IPEndPoint ip) { if (packetType == (ushort)PacketType.Message) { MessagePacket message = new MessagePacket(); message.Deserialize(stream); screenText.text += message.payload + System.Environment.NewLine; } }