Пример #1
0
 internal ReinNetMessageHolder(ReinNetMessage message, NetworkMessageData context)
 {
     this.message = message;
     if (this.message == null)
     {
         Main.LogF("Placeholder1");
         return;
     }
     this.messageType = message.GetType().ToString();
     if (!NT_messageLookup.ContainsKey(this.messageType))
     {
         Main.LogF("Placeholder2");
         return;
     }
     this.handler = NT_messageLookup[this.messageType];
     if (this.handler == null)
     {
         Main.LogF("Placeholder3");
         return;
     }
     this.contextData = context;
     if (this.contextData == null)
     {
         Main.LogF("Placeholder4");
         return;
     }
     this.safeToSend = true;
 }
Пример #2
0
 public override void Deserialize(NetworkReader reader)
 {
     this.safeToSend = reader.ReadBoolean();
     if (!this.safeToSend)
     {
         Main.LogF("Placeholder6");
         return;
     }
     this.messageType = reader.ReadString();
     this.contextData = NetworkMessageData.Read(reader);
     if (NT_messageLookup.ContainsKey(this.messageType))
     {
         this.handler = NT_messageLookup[this.messageType];
     }
     else
     {
         this.handler = null;
         Main.LogF("Unregistered message type: " + this.messageType + " recieved.\nThis means that the message was not fully Deserialized, and may cause other networking issues.");
         return;
     }
     this.message = this.handler?.Deserialize(reader);
 }