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); }
void DeleteObject(AstronomicalObject astroObject) { if (astroObject is IParticle) { var item = astroObject as IParticle; item.RemoveFromParent(); } HelpDeleteObject(astroObject); }
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; }
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); } } }
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); } }
public void UpdateObjects() { int counter = 0; while (counter < astroObjects.Count) { AstronomicalObject item = astroObjects[counter]; if (item != null && item.IsDestroy) { astroObjects.Remove(item); } else { counter++; } } }