Пример #1
0
        public static void Save(World w, KinectRagdollGame g, String filename)
        {

            KillMouseJoints(w, g);


            FileStream writer = new FileStream(filename, FileMode.Create);

            SaveFile sf = new SaveFile();
            foreach (Body b in w.BodyList) {
                //if (!g.ragdollManager.OwnsBody(b))
                //{
                    sf.bodyList.Add(b);
                //}
            }

            foreach (Joint j in w.JointList)
            {
                if (!g.ragdollManager.OwnsJoint(j))
                {
                    sf.jointList.Add(j);
                }
            }
            
            
            sf.gravity = w.Gravity;

            sf.ragdoll = g.ragdollManager.ragdoll;

            sf.objectives = g.objectiveManager.objectives;

            sf.powerups = g.powerupManager.Powerups;

            sf.hazards = g.hazardManager.Hazards;

            WriteSaveFile(writer, sf);

        }
Пример #2
0
 public static void SetClipboard(SaveFile s)
 {
     FileStream writer = new FileStream("clipboard.xml", FileMode.Create);
     WriteSaveFile(writer, s);
 }
Пример #3
0
 private static void WriteSaveFile(FileStream writer, SaveFile sf)
 {
     DataContractSerializer ser = new DataContractSerializer(
         typeof(SaveFile), null, Int32.MaxValue, false, true, null);
     ser.WriteObject(writer, sf);
     writer.Close();
 }
Пример #4
0
        internal void CopySelected()
        {
           
            SaveFile clipBoard = new SaveFile();

            

            foreach (Object o in multipleSelect.CheckedItems)
            {

                doHighlighting(o, null);

                if (o is Body)
                {
                    clipBoard.bodyList.Add((Body)o);
                }
                else if (o is Joint)
                {
                    clipBoard.jointList.Add((Joint)o);
                }
            }

            Serializer.SetClipboard(clipBoard);

           
        }