Пример #1
0
        public void Add(AstronomicalObject obj, Dictionary <int, EditObject> astroEditors,
                        Dictionary <int, EditObject> astroHashEditors)
        {
            astroObjects.Add(obj);
            SaveInfo info = new SaveInfo(astroObjects, astroEditors, astroHashEditors);

            serializer.Serialize(info, FileName);
        }
Пример #2
0
 void DeleteObject(AstronomicalObject astroObject)
 {
     if (astroObject is IParticle)
     {
         var item = astroObject as IParticle;
         item.RemoveFromParent();
     }
     HelpDeleteObject(astroObject);
 }
Пример #3
0
 void HelpDeleteObject(AstronomicalObject astroObject)
 {
     if (astroObject is IComplexObj)
     {
         var item = astroObject as IComplexObj;
         for (int i = 0; i < item.Count; i++)
         {
             HelpDeleteObject((AstronomicalObject)item[i]);
         }
     }
     astroObject.IsDestroy = true;
 }
Пример #4
0
 public void UpdateObjectList(AstronomicalObject obj)
 {
     if (obj is IComplexObj)
     {
         var item = obj as IComplexObj;
         for (int i = 0; i < item.Count; i++)
         {
             UpdateObjectList((AstronomicalObject)item[i]);
         }
         if (obj.uid > astroObjects[astroObjects.Count - 1].uid)
         {
             astroObjects.Add(obj);
         }
     }
 }
Пример #5
0
 public bool Remove(AstronomicalObject obj, Dictionary <int, EditObject> astroEditors,
                    Dictionary <int, EditObject> astroHashEditors)
 {
     if (astroObjects.Contains(obj))
     {
         DeleteObject(obj);
         UpdateObjects();
         SaveInfo info = new SaveInfo(astroObjects, astroEditors, astroHashEditors);
         serializer.Serialize(info, FileName);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #6
0
        public void UpdateObjects()
        {
            int counter = 0;

            while (counter < astroObjects.Count)
            {
                AstronomicalObject item = astroObjects[counter];
                if (item != null && item.IsDestroy)
                {
                    astroObjects.Remove(item);
                }
                else
                {
                    counter++;
                }
            }
        }