Exemplo n.º 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;
            }
        }
Exemplo n.º 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 = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", d.Name.ToString(), 0, 0);
                    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 = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", d.FadeInTime.ToString(), 0, 0);
                    if (float.TryParse(result, out f))
                    {
                        d.FadeInTime = f;
                    }
                    break;

                case 5:    //FadeInTime
                    result = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", d.FadeOutTime.ToString(), 0, 0);
                    if (float.TryParse(result, out f))
                    {
                        d.FadeOutTime = f;
                    }
                    break;

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

                case 7:    //Path
                    d.path = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", d.path, 0, 0);
                    break;

                case 8:    //ID
                    d.ID = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", d.ID, 0, 0);
                    break;

                case 9:    //unk3
                    result = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", d.index.ToString(), 0, 0);
                    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 = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", u.index + " ; " + u.unk2, 0, 0);
                    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  = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", u2.time + " ; " + u2.weight + " ; " + u2.inTangent + " ; " + u2.leaveTangent, 0, 0);
                    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 = Microsoft.VisualBasic.Interaction.InputBox("Please enter new value", "ME3Explorer", d.numKeys[subsubidx].ToString(), 0, 0);
                    if (int.TryParse(result.Trim(), out i))
                    {
                        d.numKeys[subsubidx] = i;
                    }
                    else
                    {
                        return;
                    }
                    break;
                }
                FaceFX.Data.Data[entidx] = d;
                FaceFX.Save();
            }
        }