예제 #1
0
        void SerializeData(SerializingContainer Container)
        {
            if (Container.isLoading)
            {
                Data = new ME3DataAnimSetStruct();
            }
            Data.unk1 = Container + Data.unk1;
            Data.unk2 = Container + Data.unk2;
            Data.unk3 = Container + Data.unk3;
            Data.unk4 = Container + Data.unk4;
            int count = 0;

            if (!Container.isLoading)
            {
                count = Data.Data.Length;
            }
            count = Container + count;
            if (Container.isLoading)
            {
                Data.Data = new ME3FaceFXLine[count];
            }
            for (int i = 0; i < count; i++)
            {
                if (Container.isLoading)
                {
                    Data.Data[i] = new ME3FaceFXLine();
                }
                ME3FaceFXLine d = Data.Data[i];
                d.Name = Container + d.Name;
                if (Container.isLoading)
                {
                    d.NameAsString = header.Names[d.Name];
                }
                int count2 = 0;
                if (!Container.isLoading)
                {
                    count2 = d.animations.Length;
                }
                count2 = Container + count2;
                if (Container.isLoading)
                {
                    d.animations = new ME3NameRef[count2];
                }
                for (int j = 0; j < count2; j++)
                {
                    if (Container.isLoading)
                    {
                        d.animations[j] = new ME3NameRef();
                    }
                    ME3NameRef u = d.animations[j];
                    u.index         = Container + u.index;
                    u.unk2          = Container + u.unk2;
                    d.animations[j] = u;
                }
                count2 = 0;
                if (!Container.isLoading)
                {
                    count2 = d.points.Length;
                }
                count2 = Container + count2;
                if (Container.isLoading)
                {
                    d.points = new ControlPoint[count2];
                }
                for (int j = 0; j < count2; j++)
                {
                    if (Container.isLoading)
                    {
                        d.points[j] = new ControlPoint();
                    }
                    ControlPoint u = d.points[j];
                    u.time         = Container + u.time;
                    u.weight       = Container + u.weight;
                    u.inTangent    = Container + u.inTangent;
                    u.leaveTangent = Container + u.leaveTangent;
                    d.points[j]    = u;
                }
                if (d.animations.Length > 0)
                {
                    count2 = 0;
                    if (!Container.isLoading)
                    {
                        count2 = d.numKeys.Length;
                    }
                    count2 = Container + count2;
                    if (Container.isLoading)
                    {
                        d.numKeys = new int[count2];
                    }
                    for (int j = 0; j < count2; j++)
                    {
                        d.numKeys[j] = Container + d.numKeys[j];
                    }
                }
                else if (Container.isLoading)
                {
                    d.numKeys = new int[0];
                }
                d.FadeInTime  = Container + d.FadeInTime;
                d.FadeOutTime = Container + d.FadeOutTime;
                d.unk2        = Container + d.unk2;
                d.path        = SerializeString(Container, d.path);
                d.ID          = SerializeString(Container, d.ID);
                d.index       = Container + d.index;
                Data.Data[i]  = d;
            }
        }
예제 #2
0
        private void treeView2_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeNode t = treeView2.SelectedNode;

            if (t == null || t.Parent == null)
            {
                return;
            }
            TreeNode t1 = t.Parent;

            if (t1 == null || t1.Parent == null)
            {
                return;
            }
            TreeNode t2 = t1.Parent;

            if (t2 == null || t2.Parent == null)
            {
                return;
            }
            string result; int i; float f = 0;

            if (t2.Text == "Entries")
            {
                int           entidx = t1.Index;
                int           subidx = t.Index;
                ME3FaceFXLine d      = FaceFX.Data.Data[entidx];
                switch (subidx)
                {
                case 0:    //unk1
                    result = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.Name.ToString(), true);
                    i      = -1;
                    if (int.TryParse(result, out i) && i >= 0 && i < FaceFX.Header.Names.Length)
                    {
                        d.Name         = i;
                        d.NameAsString = FaceFX.Header.Names[d.Name];
                    }

                    break;

                case 4:    //FadeInTime
                    result = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.FadeInTime.ToString(), true);
                    if (float.TryParse(result, out f))
                    {
                        d.FadeInTime = f;
                    }
                    break;

                case 5:    //FadeInTime
                    result = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.FadeOutTime.ToString(), true);
                    if (float.TryParse(result, out f))
                    {
                        d.FadeOutTime = f;
                    }
                    break;

                case 6:    //unk2
                    result = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.unk2.ToString(), true);
                    i      = -1;
                    if (int.TryParse(result, out i) && i >= 0 && i < FaceFX.Header.Names.Length)
                    {
                        d.unk2 = i;
                    }
                    break;

                case 7:    //Path
                    d.path = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.path, true);
                    break;

                case 8:    //ID
                    d.ID = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.ID, true);
                    break;

                case 9:    //unk3
                    result = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.index.ToString(), true);
                    i      = -1;
                    if (int.TryParse(result, out i) && i >= 0 && i < FaceFX.Header.Names.Length)
                    {
                        d.index = i;
                    }
                    break;

                default:
                    return;
                }
                FaceFX.Data.Data[entidx] = d;
                FaceFX.Save();
            }
            else if (t2.Parent.Text == "Entries")
            {
                int           entidx    = t2.Index;
                int           subidx    = t1.Index;
                int           subsubidx = t.Index;
                ME3FaceFXLine d         = FaceFX.Data.Data[entidx];
                switch (subidx)
                {
                case 1:
                    ME3NameRef u = d.animations[subsubidx];
                    result = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", u.index + " ; " + u.unk2, true);
                    string[] reslist = result.Split(';');
                    if (reslist.Length != 2)
                    {
                        return;
                    }
                    if (int.TryParse(reslist[0].Trim(), out i))
                    {
                        u.index = i;
                    }
                    else
                    {
                        return;
                    }
                    if (int.TryParse(reslist[1].Trim(), out i))
                    {
                        u.unk2 = i;
                    }
                    else
                    {
                        return;
                    }
                    d.animations[subsubidx] = u;
                    break;

                case 2:
                    ControlPoint u2 = d.points[subsubidx];
                    result  = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", u2.time + " ; " + u2.weight + " ; " + u2.inTangent + " ; " + u2.leaveTangent, true);
                    reslist = result.Split(';');
                    if (reslist.Length != 4)
                    {
                        return;
                    }
                    if (float.TryParse(reslist[0].Trim(), out f))
                    {
                        u2.time = f;
                    }
                    else
                    {
                        return;
                    }
                    if (float.TryParse(reslist[1].Trim(), out f))
                    {
                        u2.weight = f;
                    }
                    else
                    {
                        return;
                    }
                    if (float.TryParse(reslist[2].Trim(), out f))
                    {
                        u2.inTangent = f;
                    }
                    else
                    {
                        return;
                    }
                    if (float.TryParse(reslist[3].Trim(), out f))
                    {
                        u2.leaveTangent = f;
                    }
                    else
                    {
                        return;
                    }
                    d.points[subsubidx] = u2;
                    break;

                case 3:
                    result = PromptDialog.Prompt(null, "Please enter new value", "ME3Explorer", d.numKeys[subsubidx].ToString(), true);
                    if (int.TryParse(result.Trim(), out i))
                    {
                        d.numKeys[subsubidx] = i;
                    }
                    else
                    {
                        return;
                    }
                    break;
                }
                FaceFX.Data.Data[entidx] = d;
                FaceFX.Save();
            }
        }
        void SerializeData(SerializingContainer Container)
        {
            if (Container.isLoading)
            {
                data = new ME2DataAnimSetStruct();
            }
            data.unk1 = Container + data.unk1;
            data.unk2 = Container + data.unk2;
            data.unk3 = Container + data.unk3;
            data.unk4 = Container + data.unk4;
            data.unk5 = Container + data.unk5;
            data.unk6 = Container + data.unk6;
            data.unk7 = Container + data.unk7;
            data.unk8 = Container + data.unk8;
            data.unk9 = Container + data.unk9;
            int count = 0;

            if (!Container.isLoading)
            {
                count = data.Data.Length;
            }
            count = Container + count;
            if (Container.isLoading)
            {
                data.Data = new ME2FaceFXLine[count];
            }
            for (int i = 0; i < count; i++)
            {
                if (Container.isLoading)
                {
                    data.Data[i] = new ME2FaceFXLine();
                }
                ME2FaceFXLine d = (ME2FaceFXLine)data.Data[i];
                d.unk0 = Container + d.unk0;
                d.unk1 = Container + d.unk1;
                d.Name = Container + d.Name;
                if (Container.isLoading)
                {
                    d.NameAsString = header.Names[d.Name];
                }
                d.unk6 = Container + d.unk6;
                int animationCount = 0;
                if (!Container.isLoading)
                {
                    animationCount = d.animations.Length;
                }
                animationCount = Container + animationCount;
                if (Container.isLoading)
                {
                    d.animations = new ME2NameRef[animationCount];
                }
                for (int j = 0; j < animationCount; j++)
                {
                    if (Container.isLoading)
                    {
                        d.animations[j] = new ME2NameRef();
                    }
                    ME2NameRef u = d.animations[j] as ME2NameRef;
                    u.unk0          = Container + u.unk0;
                    u.unk1          = Container + u.unk1;
                    u.index         = Container + u.index;
                    u.unk2          = Container + u.unk2;
                    u.unk3          = Container + u.unk3;
                    d.animations[j] = u;
                }
                int pointCount = 0;
                if (!Container.isLoading)
                {
                    pointCount = d.points.Length;
                }
                pointCount = Container + pointCount;
                if (Container.isLoading)
                {
                    d.points = new ControlPoint[pointCount];
                }
                for (int j = 0; j < pointCount; j++)
                {
                    if (Container.isLoading)
                    {
                        d.points[j] = new ControlPoint();
                    }
                    ControlPoint u = d.points[j];
                    u.time         = Container + u.time;
                    u.weight       = Container + u.weight;
                    u.inTangent    = Container + u.inTangent;
                    u.leaveTangent = Container + u.leaveTangent;
                    d.points[j]    = u;
                }

                if (pointCount > 0)
                {
                    d.unk4 = Container + d.unk4;
                    int numKeysCount = 0;
                    if (!Container.isLoading)
                    {
                        numKeysCount = d.numKeys.Length;
                    }
                    numKeysCount = Container + numKeysCount;
                    if (Container.isLoading)
                    {
                        d.numKeys = new int[numKeysCount];
                    }
                    for (int j = 0; j < numKeysCount; j++)
                    {
                        d.numKeys[j] = Container + d.numKeys[j];
                    }
                }
                else if (Container.isLoading)
                {
                    d.numKeys = new int[d.animations.Length];
                }
                d.FadeInTime  = Container + d.FadeInTime;
                d.FadeOutTime = Container + d.FadeOutTime;
                d.unk2        = Container + d.unk2;
                d.unk5        = Container + d.unk5;
                d.path        = SerializeString(Container, d.path);
                d.ID          = SerializeString(Container, d.ID);
                d.index       = Container + d.index;
                data.Data[i]  = d;
            }
        }