Exemplo n.º 1
0
        /// <summary>
        /// Create a ComponentList from UltimaSDK
        /// </summary>
        public MultiEditorComponentList(MultiComponentList list, MultiEditor.UserControls.MultiEditor parent)
        {
            _parent = parent;
            Width   = list.Width;
            Height  = list.Height;
            Tiles   = new List <MultiTile>();
            for (int x = 0; x < Width; ++x)
            {
                for (int y = 0; y < Height; ++y)
                {
                    for (int i = 0; i < list.Tiles[x][y].Length; ++i)
                    {
                        Tiles.Add(new MultiTile(
                                      list.Tiles[x][y][i].ID,
                                      x,
                                      y,
                                      list.Tiles[x][y][i].Z,
                                      list.Tiles[x][y][i].Flag));
                    }

                    Tiles.Add(new FloorTile(x, y, _parent.DrawFloorZ));
                }
            }

            CalcSolver();
            Tiles.Sort();
            UndoList  = new UndoStruct[_undoListMaxSize];
            _modified = true;
            RecalculateMinMax();
        }
        public static UndoStruct GetUndoStruct()
        {
            UndoStruct undo = new UndoStruct();

            undo.AllVisualContenders         = AllVisualContenders.ToList();
            undo._VisualBracketsList         = VisualBracketsList.ToList();
            undo._VisualUnplacedBracketsList = _VisualUnplacedBracketsList.ToList();
            return(undo);
        }
        /// <summary>
        /// the application will save the last 15 changes
        /// </summary>
        /// TODO: FINISH THIS!
        public static void AddToUndoList()
        {
            // save the current event to struct
            UndoStruct undo = new UndoStruct();

            undo.AllVisualContenders         = new List <VisualContender>();
            undo._VisualBracketsList         = new List <VisualBracket>(VisualBracketsList.Clone());
            undo._VisualUnplacedBracketsList = new List <VisualContender>(VisualUnplacedBracketsList.ToList());

            if (UndoList.Count == 14)
            {
                UndoList.RemoveAt(0);
            }

            UndoList.Add(undo);
        }
 /// <summary>
 /// Create a blank ComponentList
 /// </summary>
 public MultiEditorComponentList(int width, int height, MultiEditor parent)
 {
     Parent = parent;
     Width  = width;
     Height = height;
     Tiles  = new List <MultiTile>();
     for (int x = 0; x < Width; ++x)
     {
         for (int y = 0; y < Height; ++y)
         {
             Tiles.Add(new FloorTile(x, y, Parent.DrawFloorZ));
         }
     }
     UndoList = new UndoStruct[UndoListMaxSize];
     Modified = true;
     RecalcMinMax();
 }
 /// <summary>
 /// Create a ComponentList from UltimaSDK
 /// </summary>
 public MultiEditorComponentList(MultiComponentList list, MultiEditor parent)
 {
     Parent = parent;
     Width = list.Width;
     Height = list.Height;
     Tiles = new List<MultiTile>();
     for (int x = 0; x < Width; ++x)
     {
         for (int y = 0; y < Height; ++y)
         {
             for (int i = 0; i < list.Tiles[x][y].Length; ++i)
             {
                 Tiles.Add(new MultiTile(list.Tiles[x][y][i].ID, x, y, list.Tiles[x][y][i].Z, list.Tiles[x][y][i].Flag));
             }
             Tiles.Add(new FloorTile(x, y, Parent.DrawFloorZ));
         }
     }
     CalcSolver();
     Tiles.Sort();
     UndoList = new UndoStruct[UndoListMaxSize];
     Modified = true;
     RecalcMinMax();
 }
 /// <summary>
 /// Create a blank ComponentList
 /// </summary>
 public MultiEditorComponentList(int width, int height, MultiEditor parent)
 {
     Parent = parent;
     Width = width;
     Height = height;
     Tiles = new List<MultiTile>();
     for (int x = 0; x < Width; ++x)
     {
         for (int y = 0; y < Height; ++y)
         {
             Tiles.Add(new FloorTile(x, y, Parent.DrawFloorZ));
         }
     }
     UndoList = new UndoStruct[UndoListMaxSize];
     Modified = true;
     RecalcMinMax();
 }