Ejemplo n.º 1
0
        public static MapEventZone Serdes(MapEventZone existing, ISerializer s, byte y)
        {
            if (s == null)
            {
                throw new ArgumentNullException(nameof(s));
            }

            s.Begin("Zone");
            bool global = y == 0xff;
            var  zone   = existing ?? new MapEventZone
            {
                Global = global,
                Y      = global ? (byte)0 : y
            };

            zone.X = s.Transform <byte, byte>(nameof(X), zone.X, S.UInt8, StoreIncrementedConverter.Instance);
            // ApiUtil.Assert(global && zone.X == 0xff || !global && zone.X != 0xff);
            zone.Unk1    = s.UInt8(nameof(Unk1), zone.Unk1);
            zone.Trigger = s.EnumU16(nameof(Trigger), zone.Trigger);
            ushort?nodeId = s.Transform <ushort, ushort?>(nameof(Node), zone.Node?.Id, S.UInt16, MaxToNullConverter.Instance);

            if (nodeId != null && zone.Node == null)
            {
                zone.Node = new DummyEventNode(nodeId.Value);
            }

            s.End();
            return(zone);
        }
Ejemplo n.º 2
0
 public static MapEventZone Serdes(MapEventZone existing, ISerializer s, in byte y)