コード例 #1
0
ファイル: NSMBLevel.cs プロジェクト: poudink/NSMB-Editor
        public int RemoveZIndex(LevelItem obj)
        {
            int idx = -1;

            if (obj is NSMBObject)
            {
                idx = Objects.IndexOf(obj as NSMBObject);
                Objects.Remove(obj as NSMBObject);
            }
            if (obj is NSMBSprite)
            {
                idx = Sprites.IndexOf(obj as NSMBSprite);
                Sprites.Remove(obj as NSMBSprite);
            }
            if (obj is NSMBEntrance)
            {
                idx = Entrances.IndexOf(obj as NSMBEntrance);
                Entrances.Remove(obj as NSMBEntrance);
            }
            if (obj is NSMBView)
            {
                NSMBView v = obj as NSMBView;
                if (v.isZone)
                {
                    idx = Zones.IndexOf(v);
                    Zones.Remove(v);
                }
                else
                {
                    idx = Views.IndexOf(v);
                    Views.Remove(v);
                }
            }
            if (obj is NSMBPathPoint)
            {
                NSMBPathPoint pp = obj as NSMBPathPoint;
                idx = pp.parent.points.IndexOf(pp);
                pp.parent.points.Remove(pp);
                if (pp.parent.points.Count == 0)
                {
                    if (pp.parent.isProgressPath)
                    {
                        ProgressPaths.Remove(pp.parent);
                    }
                    else
                    {
                        Paths.Remove(pp.parent);
                    }
                }
            }
            return(idx == -1 ? 0 : idx);
        }
コード例 #2
0
ファイル: NSMBLevel.cs プロジェクト: poudink/NSMB-Editor
 public void Remove(LevelItem obj)
 {
     if (obj is NSMBObject)
     {
         Objects.Remove(obj as NSMBObject);
     }
     if (obj is NSMBSprite)
     {
         Sprites.Remove(obj as NSMBSprite);
     }
     if (obj is NSMBEntrance)
     {
         Entrances.Remove(obj as NSMBEntrance);
     }
     if (obj is NSMBView)
     {
         NSMBView v = obj as NSMBView;
         if (v.isZone)
         {
             Zones.Remove(v);
         }
         else
         {
             Views.Remove(v);
         }
     }
     if (obj is NSMBPathPoint)
     {
         NSMBPathPoint pp = obj as NSMBPathPoint;
         pp.parent.points.Remove(pp);
         if (pp.parent.points.Count == 0)
         {
             if (pp.parent.isProgressPath)
             {
                 ProgressPaths.Remove(pp.parent);
             }
             else
             {
                 Paths.Remove(pp.parent);
             }
         }
     }
 }