Exemple #1
0
        public void Time_Set_Get()
        {
            var buff = new SerializableNpcBuff();

            buff.Time = 600;

            Assert.Equal(600, buff.Time);
        }
Exemple #2
0
        public void Type_Set_Get()
        {
            var buff = new SerializableNpcBuff();

            buff.Type = 128;

            Assert.Equal(128, buff.Type);
        }
Exemple #3
0
        public void Read()
        {
            var bytes = new byte[] { 0, 1, 120, 0 };

            SerializableNpcBuff.Read(bytes, out var buff);

            Assert.Equal(256, buff.Type);
            Assert.Equal(120, buff.Time);

            var buffer = new byte[4];

            var writtenLength = buff.Write(buffer);

            Assert.Equal(bytes.Length, writtenLength);
            Assert.Equal(bytes, buffer);
        }
 /// <summary>
 /// Reads an <see cref="SerializableNpcBuff"/> from the specified span and returns the number of bytes read.
 /// </summary>
 /// <param name="span">The span to read from.</param>
 /// <param name="npcBuff">The resulting <see cref="SerializableNpcBuff"/></param>
 /// <returns>The read <see cref="SerializableNpcBuff"/>.</returns>
 public static int Read(Span <byte> span, out SerializableNpcBuff npcBuff)
 {
     npcBuff = default;
     return(span.Read(ref npcBuff._bytes, 4));
 }