public MainUc() { InitializeComponent(); MapsManager.Init(@"D:\Dofus\app\content\maps"); Entities = new List <MapEntity>(); DoubleBuffered = true; SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); MapHeight = Constant.MapHeight; MapWidth = Constant.MapWidth; CommonCellHeight = 43; CommonCellWidth = 86; ViewGrid = true; DrawMode = DrawMode.All; TraceOnOver = false; InactiveCellColor = Color.DarkGray; ActiveCellColor = Color.Transparent; StatesColors = new Dictionary <CellState, Color> { [CellState.Walkable] = Color.DarkGray, [CellState.NonWalkable] = Color.Black, [CellState.BluePlacement] = Color.DodgerBlue, [CellState.RedPlacement] = Color.Red, [CellState.Trigger] = Color.Orange, [CellState.Road] = Color.LightGoldenrodYellow }; SetCellNumber(); BuildMap(); }
public void Clear() { var tmp = MapsManager.FromId(MapId); tmp.Cells.ForEachWithIndex((cellData, index) => { var cell = GetCell(index); cell.Text = cell.Id.ToString(); if (cellData.Los) { cell.State = CellState.NonWalkable; } if (cellData.Mov) { cell.State = CellState.Walkable; } }); Invalidate(); }
public void Init(int mapId) { MapId = mapId; var tmp = MapsManager.FromId(MapId); tmp.Cells.ForEachWithIndex((cellData, index) => { var cell = GetCell(index); cell.Text = cell.Id.ToString(); if (cellData.Los) { cell.State = CellState.NonWalkable; } if (cellData.Mov) { cell.State = CellState.Walkable; } }); Invalidate(); WPath = new WorldPathfinder(MapsManager.FromId(MapId), this); }