Esempio n. 1
0
        public static TextEvent Serdes(TextEvent e, AssetMapping mapping, ISerializer s, TextId textSourceId)
        {
            e ??= new TextEvent(textSourceId);
            if (e.TextSourceId != textSourceId)
            {
                throw new InvalidOperationException($"Called Serdes on a TextEvent with source id {e.TextSourceId} but passed in source id {textSourceId}");
            }

            if (s == null)
            {
                throw new ArgumentNullException(nameof(s));
            }
            e.TextSourceId = textSourceId;
            e.Location     = s.EnumU8(nameof(Location), e.Location ?? TextLocation.NoPortrait);
            e.Unk2         = s.UInt8(nameof(Unk2), e.Unk2);
            e.Unk3         = s.UInt8(nameof(Unk3), e.Unk3);
            e.CharacterId  = CharacterId.SerdesU8(nameof(CharacterId), e.CharacterId, AssetType.Npc, mapping, s);
            e.TextId       = s.UInt8(nameof(TextId), e.TextId);
            e.Unk6         = s.UInt16(nameof(Unk6), e.Unk6);
            e.Unk8         = s.UInt16(nameof(Unk8), e.Unk8);
            return(e);
        }