예제 #1
0
        public FaceFXLine Clone()
        {
            FaceFXLine clone = (FaceFXLine)MemberwiseClone();

            clone.AnimationNames = AnimationNames.Clone();
            clone.Points         = Points.Clone();
            clone.NumKeys        = NumKeys.Clone();
            return(clone);
        }
예제 #2
0
        public static void Serialize(this SerializingContainer2 sc, ref FaceFXLine line)
        {
            int   int0   = 0;
            short short0 = 0;
            short short1 = 1;

            if (sc.IsLoading)
            {
                line = new FaceFXLine();
            }

            if (sc.Game == MEGame.ME2)
            {
                sc.Serialize(ref int0);
                sc.Serialize(ref short1);
            }
            sc.Serialize(ref line.NameIndex);
            if (sc.Game == MEGame.ME2)
            {
                int unk6 = 6;
                sc.Serialize(ref unk6);
            }
            //AnimationNames
            {
                int count = line.AnimationNames?.Count ?? 0;
                sc.Serialize(ref count);
                int int1 = 1;
                if (sc.IsLoading)
                {
                    line.AnimationNames = new List <int>(count);
                }
                for (int i = 0; i < count; i++)
                {
                    if (sc.Game == MEGame.ME2)
                    {
                        sc.Serialize(ref int0);
                        sc.Serialize(ref short1);
                    }
                    if (sc.IsLoading)
                    {
                        int tmp = default;
                        sc.Serialize(ref tmp);
                        line.AnimationNames.Add(tmp);
                    }
                    else
                    {
                        int tmp = line.AnimationNames[i];
                        sc.Serialize(ref tmp);
                    }
                    if (sc.Game == MEGame.ME2)
                    {
                        sc.Serialize(ref int1);
                        sc.Serialize(ref short0);
                    }
                    else
                    {
                        sc.Serialize(ref int0);
                    }
                }
            }

            sc.Serialize(ref line.Points, Serialize);
            if (line.Points.Any())
            {
                if (sc.Game == MEGame.ME2)
                {
                    sc.Serialize(ref short0);
                }
                sc.Serialize(ref line.NumKeys, SCExt.Serialize);
            }
            else if (sc.IsLoading)
            {
                line.NumKeys = Enumerable.Repeat(0, line.AnimationNames.Count).ToList();
            }
            sc.Serialize(ref line.FadeInTime);
            sc.Serialize(ref line.FadeOutTime);
            sc.Serialize(ref int0);
            if (sc.Game == MEGame.ME2)
            {
                sc.Serialize(ref short0);
                sc.Serialize(ref short1);
            }
            sc.SerializeFaceFXString(ref line.Path);
            if (sc.Game == MEGame.ME2)
            {
                sc.Serialize(ref short1);
            }
            sc.SerializeFaceFXString(ref line.ID);
            sc.Serialize(ref line.Index);
        }