Exemplo n.º 1
0
        public void Resize(int width, int height)                       // editor magic.
        {
            var oldMapTiles     = MapTiles.Value;
            var oldMapResources = MapResources.Value;
            var newSize         = new Size(width, height);

            MapTiles     = Exts.Lazy(() => CellLayer.Resize(oldMapTiles, newSize, oldMapTiles[0, 0]));
            MapResources = Exts.Lazy(() => CellLayer.Resize(oldMapResources, newSize, oldMapResources[0, 0]));
            MapSize      = new int2(newSize);
        }
Exemplo n.º 2
0
        public void Resize(int width, int height)                       // editor magic.
        {
            var oldMapTiles     = MapTiles.Value;
            var oldMapResources = MapResources.Value;
            var oldMapHeight    = MapHeight.Value;
            var newSize         = new Size(width, height);

            MapTiles     = Exts.Lazy(() => CellLayer.Resize(oldMapTiles, newSize, oldMapTiles[MPos.Zero]));
            MapResources = Exts.Lazy(() => CellLayer.Resize(oldMapResources, newSize, oldMapResources[MPos.Zero]));
            MapHeight    = Exts.Lazy(() => CellLayer.Resize(oldMapHeight, newSize, oldMapHeight[MPos.Zero]));
            MapSize      = new int2(newSize);

            var tl = new MPos(0, 0).ToCPos(this);
            var br = new MPos(MapSize.X - 1, MapSize.Y - 1).ToCPos(this);

            AllCells = new CellRegion(Grid.Type, tl, br);
        }
Exemplo n.º 3
0
        public void Resize(int width, int height)
        {
            var oldMapTiles     = Tiles;
            var oldMapResources = Resources;
            var oldMapHeight    = Height;
            var newSize         = new Size(width, height);

            Tiles     = CellLayer.Resize(oldMapTiles, newSize, oldMapTiles[MPos.Zero]);
            Resources = CellLayer.Resize(oldMapResources, newSize, oldMapResources[MPos.Zero]);
            Height    = CellLayer.Resize(oldMapHeight, newSize, oldMapHeight[MPos.Zero]);
            MapSize   = new int2(newSize);

            var tl = new MPos(0, 0);
            var br = new MPos(MapSize.X - 1, MapSize.Y - 1);

            AllCells = new CellRegion(Grid.Type, tl.ToCPos(this), br.ToCPos(this));
            SetBounds(new PPos(tl.U + 1, tl.V + 1), new PPos(br.U - 1, br.V - 1));
        }