Beispiel #1
0
 public void Delete(MapItem item)
 {
     if (item is MapObject)
     {
         MapObject o = (MapObject)item;
         if (objects.Contains(o))
         {
             objects.Remove(o);
             layer.GetChild("obj").childs.Remove(o.Object.Name);
             Map.Pad(layer.GetChild("obj"), objects.ToArray());
         }
     }
     else if (item is MapTile)
     {
         MapTile t = (MapTile)item;
         if (tiles.Contains(t))
         {
             tiles.Remove(t);
             layer.GetChild("tile").childs.Remove(t.Object.Name);
             Map.Pad(layer.GetChild("tile"), tiles.ToArray());
         }
     }
     else
     {
         Map.Instance.Delete(item);
     }
 }
Beispiel #2
0
 public void Delete(MapItem item)
 {
     if (item is MapLife)
     {
         MapLife l = (MapLife)item;
         if (lifes.Contains(l))
         {
             lifes.Remove(l);
             map.GetChild("life").childs.Remove(l.Object.Name);
             Map.Pad(map.GetChild("life"), lifes.ToArray());
         }
     }
     else if (item is MapReactor)
     {
         MapReactor r = (MapReactor)item;
         if (reactors.Contains(r))
         {
             reactors.Remove(r);
             map.GetChild("reactor").childs.Remove(r.Object.Name);
             Map.Pad(map.GetChild("reactor"), reactors.ToArray());
         }
     }
     else if (item is MapLR)
     {
         MapLR l = (MapLR)item;
         if (lrs.Contains(l))
         {
             lrs.Remove(l);
             map.GetChild("ladderRope").childs.Remove(l.Object.Name);
             Map.Pad(map.GetChild("ladderRope"), lrs.ToArray(), 1);
         }
     }
     else if (item is MapSeat)
     {
         MapSeat s = (MapSeat)item;
         if (seats.Contains(s))
         {
             seats.Remove(s);
             map.GetChild("seat").childs.Remove(s.Object.Name);
             Map.Pad(map.GetChild("seat"), seats.ToArray());
         }
     }
     else if (item is MapPortal)
     {
         MapPortal p = (MapPortal)item;
         if (portals.Contains(p))
         {
             portals.Remove(p);
             map.GetChild("portal").childs.Remove(p.Object.Name);
             Map.Pad(map.GetChild("portal"), portals.ToArray());
             // TODO SORT
         }
     }
     else if (item is MapToolTip)
     {
         MapToolTip t = (MapToolTip)item;
         if (tooltips.Contains(t))
         {
             tooltips.Remove(t);
             map.GetChild("ToolTip").childs.Remove(t.Object.Name);
             t.Image.parent.childs.Remove(t.Object.Name);
             Map.Pad(map.GetChild("ToolTip"), t.Image.parent, tooltips.ToArray());
         }
     }
     else if (item is MapToolTipCorner)
     {
         Delete(((MapToolTipCorner)item).ToolTip);
     }
     else if (item is MapClock)
     {
         if (clock != null)
         {
             map.childs.Remove("clock");
             clock = null;
         }
     }
     else
     {
         layers[(int)MapEditor.Instance.Layer.Value].Delete(item);
     }
 }