Пример #1
0
        public void MassSubstitue(TileCategory categoryContained, TileCategory categoryOutside)
        {
            var oldTiles = MultiTiles.Select(tile => categoryContained.FindTile(tile.Id)).Where(t => t != null);

            foreach (var oldtile in oldTiles)
            {
                var oldIdDescription = _tileData.GetItemTile(oldtile.Id);
                var tiles            = categoryOutside.FindByPosition(oldtile.PositionString);
                var tileDataTiles    =
                    tiles.Where(
                        tile =>
                        _tileData.GetItemTile(tile.Id).Height == oldIdDescription.Height &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Window) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Window) &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Wall) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Wall) &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Roof) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Roof) &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Surface) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Surface));
                var tmp = tileDataTiles.FirstOrDefault();
                if (tmp != null)
                {
                    MassSet(oldtile.Id, tmp);
                }
            }
            Categories.Remove(categoryContained);
            Categories.Add(categoryOutside);
            UpdateCategories();

            RaisePropertyChanged(() => Categories);
            RaisePropertyChanged(() => MultiTiles);
            RaisePropertyChanged(() => Text);
        }
Пример #2
0
        public void MassSubstitue(TileCategory categoryContained, TileCategory categoryOutside)
        {
            var oldTiles = MultiTiles.Select(tile => categoryContained.FindTile(tile.Id)).Where(t => t != null);

            foreach (var oldtile in oldTiles)
            {
                var oldIdDescription = _tileData.GetItemTile(oldtile.Id);
                var tiles = categoryOutside.FindByPosition(oldtile.PositionString);
                var tileDataTiles =
                    tiles.Where(
                        tile =>
                        _tileData.GetItemTile(tile.Id).Height == oldIdDescription.Height &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Window) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Window) &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Wall) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Wall) &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Roof) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Roof) &&
                        oldIdDescription.Flags.HasFlag(TileFlag.Surface) ==
                        _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Surface));
                var tmp = tileDataTiles.FirstOrDefault();
                if(tmp!= null)
                MassSet(oldtile.Id,tmp);
            }
            Categories.Remove(categoryContained);
            Categories.Add(categoryOutside);
            UpdateCategories();

            RaisePropertyChanged(() => Categories);
            RaisePropertyChanged(() => MultiTiles);
            RaisePropertyChanged(()=>Text);

        }
Пример #3
0
        public void MassRemove(TileCategory categoryToRemove)
        {
            var tiletoremove = new List <MultiTile>(MultiTiles.Where(t => categoryToRemove.FindTile(t.Id) != null));

            foreach (var multiTile in tiletoremove)
            {
                _multiTiles.Remove(multiTile);
            }
            RaisePropertyChanged(() => Text);
            UpdateCategories();
        }
Пример #4
0
        public void SubStitueWallCat(TileCategory wallIn, TileCategory WallOut)
        {
            List <MultiTile> multi = new List <MultiTile>();

            foreach (var multiTile in MultiTiles.Where(multiTile => WallOut.FindTile(multiTile.ID) != null))
            {
                multi.Add(multiTile);
            }

            var tiles = wallIn.AllTiles();

            foreach (var multitile in multi)
            {
                foreach (var tIn in from tile in tiles select tile as TileWall into tIn let tOut = multitile.Tile as TileWall where tIn.Position == tOut.Position && tIn.PositionW == tOut.PositionW select tIn)
                {
                    multitile.SetTile(tIn);
                }
            }
        }
Пример #5
0
        public void SubStitueWallCat(TileCategory wallIn, TileCategory WallOut)
        {
            List<MultiTile> multi = new List<MultiTile>();
            foreach (var multiTile in MultiTiles.Where(multiTile => WallOut.FindTile(multiTile.ID)!=null))
            {
                multi.Add(multiTile);
            }

            var tiles = wallIn.AllTiles();

            foreach (var multitile in multi)
            {
                foreach (var tIn in from tile in tiles select tile as TileWall into tIn let tOut = multitile.Tile as TileWall where tIn.Position == tOut.Position && tIn.PositionW == tOut.PositionW select tIn)
                {
                    multitile.SetTile(tIn);
                }
            }

        }
Пример #6
0
 public void MassRemove(TileCategory categoryToRemove)
 {
     var tiletoremove = new List<MultiTile>(MultiTiles.Where(t => categoryToRemove.FindTile(t.Id) != null));
     foreach (var multiTile in tiletoremove)
     {
         _multiTiles.Remove(multiTile);
     }
     RaisePropertyChanged(()=>Text);
     UpdateCategories();
 }