예제 #1
0
        public BoneEditor(PictureBox picBox)
        {
            setViewport(picBox);
            picBox.MouseClick += picBox_MouseClick;
            picBox.MouseDown += picBox_MouseDown;
            picBox.MouseUp += picBox_MouseUp;
            picBox.MouseMove += picBox_MouseMove;
            picBox.KeyDown += BoneEditor_KeyDown;
            picBox.KeyUp += BoneEditor_KeyUp;
            picBox.LostFocus += picBox_LostFocus;
            SelectMode = SelectModes.Bones;

            rootPos = new PointF(0,0);

            bones.Add(root);
            Bone b = root;
            b = AddBone(b);
            b = AddBone(b);
            b = AddBone(b);
            b = AddBone(b);

            GreedStep = 20;
            SnapGrid = false;
            DrawGrid = false;

            Character = new BAnimator.Character();
            Character.RootBone = root;
        }
예제 #2
0
 public BoneGraphics(Character parent)
 {
     IsRoot = false;
     Character = parent;
     Group = null;
     Order = 0;
     Length = 100;
     Angle = 0;
 }
예제 #3
0
        public static Character Load(string filename)
        {
            BinaryReader reader = new BinaryReader(File.OpenRead(filename));

            Character ch = new Character();

            string file_id = reader.ReadString();
            if (file_id != _file_id)
            {
                throw new Exception("Wrong file id");
            }
            int version = reader.ReadInt32();
            if (version == 1)
                LoadV1(ch, reader);

            return ch;
        }
예제 #4
0
 public BoneGraphicsManager(Character ch)
 {
     parent = ch;
 }
예제 #5
0
 public void LoadCharacter(Character ch)
 {
     Character = ch;
     root = ch.RootBone;
     bones.Clear();
     bones.Add(root);
     AddSubBones(root);
     RefreshBonesNode();
     RefreshBonesTree();
     Redraw();
 }
예제 #6
0
 private static void LoadV1(Character ch, BinaryReader reader)
 {
     ch.Name = reader.ReadString();
     ch.Author = reader.ReadString();
     ch.Description = reader.ReadString();
     //root bone read
     Bone root = new Bone();
     root.Name = reader.ReadString();
     uint id = reader.ReadUInt32();
     bool isroot = reader.ReadBoolean();
     if (!isroot)
     {
         throw new Exception("Неожиданная ошибка при чтении файла: первая кость не помечена, как корневая");
     }
     ch.RootBone = root;
     int children = reader.ReadInt32();
     for (int i = 0; i < children; i++)
     {
         ReadBone(root, reader);
     }
 }