Beispiel #1
0
        public static void PersistColorRgba(this StatePersister persister, ref ColorRgba value, [CallerArgumentExpression("value")] string name = "")
        {
            persister.BeginObject(name);

            var r = value.R;

            persister.PersistByte(ref r);

            var g = value.G;

            persister.PersistByte(ref g);

            var b = value.B;

            persister.PersistByte(ref b);

            var a = value.A;

            persister.PersistByte(ref a);

            persister.EndObject();

            if (persister.Mode == StatePersistMode.Read)
            {
                value = new ColorRgba(r, g, b, a);
            }
        }
Beispiel #2
0
        public static void PersistListWithByteCountValue <T>(this StatePersister persister, List <T> value, PersistListItemCallback <T> callback)
        {
            persister.BeginObject();

            var count = (byte)value.Count;

            persister.PersistByte(ref count);

            PersistListImpl(persister, value, count, callback);

            persister.EndObject();
        }
Beispiel #3
0
        public static void PersistListWithByteCount <T>(this StatePersister persister, List <T> value, PersistListItemCallback <T> callback, [CallerArgumentExpression("value")] string name = "")
        {
            persister.BeginObject(name);

            var count = (byte)value.Count;

            persister.PersistByte(ref count);

            PersistListImpl(persister, value, count, callback);

            persister.EndObject();
        }