Example #1
0
        // Token: 0x060001F6 RID: 502 RVA: 0x00010F20 File Offset: 0x0000F120
        public void FromStreamEx(Stream s, PmxElementFormat f)
        {
            this.Name  = PmxStreamHelper.ReadString(s, f);
            this.NameE = PmxStreamHelper.ReadString(s, f);
            this.Panel = PmxStreamHelper.ReadElement_Int32(s, 1, true);
            this.Kind  = (PmxMorph.OffsetKind)PmxStreamHelper.ReadElement_Int32(s, 1, true);
            int num = PmxStreamHelper.ReadElement_Int32(s, 4, true);

            this.OffsetList.Clear();
            this.OffsetList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                switch (this.Kind)
                {
                case PmxMorph.OffsetKind.Group:
                case PmxMorph.OffsetKind.Flip:
                {
                    PmxGroupMorph pmxGroupMorph = new PmxGroupMorph();
                    pmxGroupMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxGroupMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Vertex:
                {
                    PmxVertexMorph pmxVertexMorph = new PmxVertexMorph();
                    pmxVertexMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxVertexMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Bone:
                {
                    PmxBoneMorph pmxBoneMorph = new PmxBoneMorph();
                    pmxBoneMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxBoneMorph);
                    break;
                }

                case PmxMorph.OffsetKind.UV:
                case PmxMorph.OffsetKind.UVA1:
                case PmxMorph.OffsetKind.UVA2:
                case PmxMorph.OffsetKind.UVA3:
                case PmxMorph.OffsetKind.UVA4:
                {
                    PmxUVMorph pmxUVMorph = new PmxUVMorph();
                    pmxUVMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxUVMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Material:
                {
                    PmxMaterialMorph pmxMaterialMorph = new PmxMaterialMorph();
                    pmxMaterialMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxMaterialMorph);
                    break;
                }

                case PmxMorph.OffsetKind.Impulse:
                {
                    PmxImpulseMorph pmxImpulseMorph = new PmxImpulseMorph();
                    pmxImpulseMorph.FromStreamEx(s, f);
                    this.OffsetList.Add(pmxImpulseMorph);
                    break;
                }
                }
            }
        }
        public void FromStreamEx(Stream s, PmxElementFormat f = null)
        {
            Name  = PmxStreamHelper.ReadString(s, f);
            NameE = PmxStreamHelper.ReadString(s, f);
            Panel = PmxStreamHelper.ReadElement_Int32(s, 1);
            Kind  = (OffsetKind)PmxStreamHelper.ReadElement_Int32(s, 1);
            int num = PmxStreamHelper.ReadElement_Int32(s);

            OffsetList.Clear();
            OffsetList.Capacity = num;
            for (int i = 0; i < num; i++)
            {
                switch (Kind)
                {
                case OffsetKind.Group:
                case OffsetKind.Flip:
                {
                    PmxGroupMorph pmxGroupMorph = new PmxGroupMorph();
                    pmxGroupMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxGroupMorph);
                    break;
                }

                case OffsetKind.Vertex:
                {
                    PmxVertexMorph pmxVertexMorph = new PmxVertexMorph();
                    pmxVertexMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxVertexMorph);
                    break;
                }

                case OffsetKind.Bone:
                {
                    PmxBoneMorph pmxBoneMorph = new PmxBoneMorph();
                    pmxBoneMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxBoneMorph);
                    break;
                }

                case OffsetKind.Impulse:
                {
                    PmxImpulseMorph pmxImpulseMorph = new PmxImpulseMorph();
                    pmxImpulseMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxImpulseMorph);
                    break;
                }

                case OffsetKind.Material:
                {
                    PmxMaterialMorph pmxMaterialMorph = new PmxMaterialMorph();
                    pmxMaterialMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxMaterialMorph);
                    break;
                }

                case OffsetKind.UV:
                case OffsetKind.UVA1:
                case OffsetKind.UVA2:
                case OffsetKind.UVA3:
                case OffsetKind.UVA4:
                {
                    PmxUVMorph pmxUVMorph = new PmxUVMorph();
                    pmxUVMorph.FromStreamEx(s, f);
                    OffsetList.Add(pmxUVMorph);
                    break;
                }
                }
            }
            if (f.WithID)
            {
                base.UID = PmxStreamHelper.ReadElement_UInt(s);
                base.CID = PmxStreamHelper.ReadElement_UInt(s);
            }
        }