Beispiel #1
0
        public bool Read(BinaryReader bin, LegacyFigure pFig)
        {
            LegacyFigure parentFigure = pFig;

            DrawAs = bin.ReadInt32();
            DrawWidth = bin.ReadInt32();
            LineWidth = bin.ReadInt32();
            ShowLine = bin.ReadBoolean();
            Color = bin.ReadInt32();
            InColor = bin.ReadInt32();
            Fill = bin.ReadBoolean();
            x = bin.ReadInt32();
            y = bin.ReadInt32();
            state = bin.ReadInt32();
            length = bin.ReadInt32();
            index = bin.ReadInt32();
            AngleToParent = bin.ReadSingle();
            Bitmap = bin.ReadInt32();
            BitmapXOffs = bin.ReadInt32();
            BitmapYOffs = bin.ReadInt32();
            BitmapRotation = bin.ReadSingle();
            BitmapAlpha = bin.ReadByte();

            nCount = bin.ReadInt32();
            for (int i = 0;i < nCount;i++)
            {
                LegacyJoint pChild = new LegacyJoint();
                pChild.parent = this;
                pChild.Read(bin, pFig);

                children.Add(pChild);
            }

            pFig.Joints.Add(this);
            return true;
        }
Beispiel #2
0
        public static List<StickJoint> Read(string file)
        {
            int nCount;
            LegacyFigure fig = new LegacyFigure();

            LegacyJoint pJoint;
            LegacyTJointBitmap bmp;

            BinaryReader bin = new BinaryReader(File.Open(file, FileMode.Open));

            fig.DrawMode = bin.ReadInt32();
            fig.Tension = bin.ReadSingle();
            fig.CurveWidth = bin.ReadInt32();
            fig.JointCount = bin.ReadInt32();
            nCount = bin.ReadInt32();
            for (int i = 0;i < nCount;i++)
            {
                pJoint = new LegacyJoint();
                pJoint.Read(bin, fig);
            }

            fig.PoseCount = bin.ReadInt32();
            fig.Alpha = 1 - (fig.PoseCount / 255);
            fig.BitmapCount = bin.ReadInt32();
            for (int i = 0;i < fig.BitmapCount;i++)
            {
                bmp = new LegacyTJointBitmap();
                bmp.Load(bin);
                fig.Bitmaps.Add(bmp);
            }

            List<StickJoint> x = new List<StickJoint>();
            StickCustom cust = new StickCustom();

            foreach (LegacyJoint j in fig.Joints)
                x.Add(new StickJoint(j));

            for (int i = 0;i < fig.Joints.Count;i++)
                for (int j = 0;j < fig.Joints[i].children.Count;j++)
                {
                    StickJoint lj = x[fig.Joints.IndexOf(fig.Joints[i].children[j])];
                    x[i].children.Add(lj);
                    lj.parent = x[i];
                }

            for (int z = 0;z < fig.Bitmaps.Count; z++)
                for (int i = 0;i < x.Count;i++)
                {
                    x[i].bitmaps.Add(fig.Bitmaps[z].bitmap);
                    x[i].Bitmap_names.Add(fig.Bitmaps[z].name);
                    x[i].Bitmap_Offsets.Add(new Point(fig.Joints[i].BitmapXOffs, fig.Joints[i].BitmapYOffs));
                    x[i].Bitmap_Rotations.Add(Math.Abs(Convert.ToInt32(fig.Joints[i].BitmapRotation)));

                    x[i].Bitmap_IDs.Add(z);
                    Functions.AssignGlid(x[i], x[i].bitmaps.IndexOf(fig.Bitmaps[z].bitmap));
                }

            return x;
        }