public void Deserialize(Stream stream)
    {
        BinaryReader br = new BinaryReader(stream);

        id       = br.ReadInt32();
        clientId = br.ReadInt32();
        objectId = br.ReadInt32();
        userType = (UserPacketType)br.ReadByte();
    }
示例#2
0
 void OnReceivePacket(int id, UserPacketType type, Stream stream)
 {
     Debug.Log("ElChatScreenRecibe---: " + type);
     if (type == (byte)UserPacketType.Message)
     {
         Debug.Log("---Y es un mensaje");
         StringPacket packet = new StringPacket();
         packet.Deserialize(stream);
         if (NetworkManager.Instance.isServer)
         {
             // MessageManager manager = new MessageManager();
             MessageManager.Instance.SendMessage(packet.payload.message, 0);
         }
         messages.text += packet.payload.message + System.Environment.NewLine;
     }
 }
示例#3
0
 public GamePacket(UserPacketType uType) : base(PacketType.User)
 {
     this.userType = uType;
 }
示例#4
0
 public GameNetworkPacket(UserPacketType type) : base((ushort)type, true)
 {
 }