Ejemplo n.º 1
0
 public void WriteTo(IStarboundStream stream)
 {
     if (Value == null)
     {
         stream.WriteUInt8(0);
     }
     else if (Value is float)
     {
         stream.WriteInt8(1);
         stream.WriteSingle((float)Value);
     }
     else if (Value is bool)
     {
         stream.WriteInt8(2);
         stream.WriteBoolean((bool)Value);
     }
     else if (Value is int)
     {
         stream.WriteInt8(3);
         stream.WriteInt32((int)Value);
     }
     else if (Value is string)
     {
         stream.WriteInt8(4);
         stream.WriteString((string)Value);
     }
     else if (Value is Json[])
     {
         stream.WriteInt8(5);
         var array = (Json[])Value;
         stream.WriteVLQ((ulong)array.Length);
         for (var i = 0; i < array.Length; i++)
         {
             array[i].WriteTo(stream);
         }
     }
     else if (Value is JsonDict)
     {
         stream.WriteInt8(7);
         var dict = (JsonDict)Value;
         stream.WriteVLQ((ulong)dict.Count);
         foreach (var kvp in dict)
         {
             stream.WriteString(kvp.Key);
             kvp.Value.WriteTo(stream);
         }
     }
 }
Ejemplo n.º 2
0
 public void WriteTo(IStarboundStream stream)
 {
     stream.WriteSingle(X);
     stream.WriteSingle(Y);
 }
Ejemplo n.º 3
0
 public void WriteTo(IStarboundStream stream)
 {
     stream.WriteVariant(DamageFactors);
     stream.WriteSingle(TotalHealth);
 }
Ejemplo n.º 4
0
 public void WriteTo(IStarboundStream stream)
 {
     stream.WriteUInt8((byte)DamageType);
     stream.WriteSingle(Amount);
 }