Example #1
0
        public static void Serialize(FloorAndCeiling fc, ISerializer s)
        {
            s.EnumU8(nameof(fc.Properties), () => fc.Properties, x => fc.Properties = x, x => ((byte)x, x.ToString()));
            s.Dynamic(fc, nameof(fc.Unk1));
            s.Dynamic(fc, nameof(fc.Unk2));
            s.Dynamic(fc, nameof(fc.Unk3));
            s.Dynamic(fc, nameof(fc.AnimationCount));
            s.Dynamic(fc, nameof(fc.Unk5));
            s.UInt16(nameof(fc.TextureNumber),
                     () => FormatUtil.Untweak((ushort?)fc.TextureNumber),
                     x => fc.TextureNumber = (DungeonFloorId?)FormatUtil.Tweak(x));

            s.Dynamic(fc, nameof(fc.Unk8));
        }
Example #2
0
        public static FloorAndCeiling Serdes(int _, FloorAndCeiling existing, ISerializer s)
        {
            var fc = existing ?? new FloorAndCeiling();

            s.Begin();
            fc.Properties     = s.EnumU8(nameof(fc.Properties), fc.Properties);
            fc.Unk1           = s.UInt8(nameof(fc.Unk1), fc.Unk1);
            fc.Unk2           = s.UInt8(nameof(fc.Unk2), fc.Unk2);
            fc.Unk3           = s.UInt8(nameof(fc.Unk3), fc.Unk3);
            fc.AnimationCount = s.UInt8(nameof(fc.AnimationCount), fc.AnimationCount);
            fc.Unk5           = s.UInt8(nameof(fc.Unk5), fc.Unk5);
            fc.TextureNumber  = s.TransformEnumU16(nameof(TextureNumber), fc.TextureNumber, Tweak <DungeonFloorId> .Instance);
            fc.Unk8           = s.UInt16(nameof(fc.Unk8), fc.Unk8);
            s.End();
            return(fc);
        }
Example #3
0
        public static FloorAndCeiling Serdes(int _, FloorAndCeiling existing, AssetMapping mapping, ISerializer s)
        {
            if (s == null)
            {
                throw new ArgumentNullException(nameof(s));
            }
            var fc = existing ?? new FloorAndCeiling();

            fc.Properties     = s.EnumU8(nameof(fc.Properties), fc.Properties);
            fc.Unk1           = s.UInt8(nameof(fc.Unk1), fc.Unk1);
            fc.Unk2           = s.UInt8(nameof(fc.Unk2), fc.Unk2);
            fc.Unk3           = s.UInt8(nameof(fc.Unk3), fc.Unk3);
            fc.AnimationCount = s.UInt8(nameof(fc.AnimationCount), fc.AnimationCount);
            fc.Unk5           = s.UInt8(nameof(fc.Unk5), fc.Unk5);
            fc.SpriteId       = SpriteId.SerdesU16(nameof(SpriteId), fc.SpriteId, AssetType.Floor, mapping, s);
            fc.Unk8           = s.UInt16(nameof(fc.Unk8), fc.Unk8);
            return(fc);
        }