예제 #1
0
        public void AddTile(uint id, int x, int y, int z, int flag)
        {
            var multi = new MultiTile()
            {
                Id = id, X = x, Y = y, Z = z, Flag = flag
            };

            SelectTileforMultiTile(multi);
            MultiTiles.Add(multi);
        }
예제 #2
0
        public void GenerateCandidates(MultiTile multiTile, TileCategory category)
        {
            var oldTileDescription = _tileData.GetItemTile(multiTile.Id);
            var tileinfo           = Categories.Select(c => c.FindTile(multiTile.Id)).FirstOrDefault(t => t != null);


            var candidates = category.AllTiles().Where(tile =>
                                                       tileinfo != null && (_tileData.GetItemTile(tile.Id).Height == oldTileDescription.Height &&
                                                                            oldTileDescription.Flags.HasFlag(TileFlag.Window) ==
                                                                            _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Window) &&
                                                                            oldTileDescription.Flags.HasFlag(TileFlag.Wall) ==
                                                                            _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Wall) &&
                                                                            oldTileDescription.Flags.HasFlag(TileFlag.Roof) ==
                                                                            _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Roof) &&
                                                                            oldTileDescription.Flags.HasFlag(TileFlag.Surface) ==
                                                                            _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Surface) &&
                                                                            tile.PositionString == tileinfo.PositionString)
                                                       );

            Candidates = new ObservableCollection <Tile>(candidates);
        }
예제 #3
0
        private void SelectTileforMultiTile(MultiTile multitile)
        {
            var found = false;

            if (Categories.Any(c => c.FindTile(multitile.Id) != null))
            {
                return;
            }

            foreach (var cats in TilesCategorySDKModule.Categories)
            {
                foreach (var tileCategory in cats.Where(tileCategory => tileCategory.FindTile(multitile.Id) != null))
                {
                    var tile = tileCategory.FindTile(multitile.Id);

                    var category = Categories.FirstOrDefault(c => c.Name == tileCategory.Name) ??
                                   new TileCategory()
                    {
                        Name = tileCategory.Name, Id = tileCategory.Id
                    };

                    var style = category.List.FirstOrDefault(st => st.Name == tile.GetStyle().Name)
                                ??
                                new TileStyle()
                    {
                        Name = tile.GetStyle().Name, Id = tile.GetStyle().Id
                    };

                    style.List.Add(tile);


                    if (!category.List.Contains(style))
                    {
                        category.AddStyle(style);
                    }

                    if (!Categories.Contains(category))
                    {
                        Categories.Add(category);
                    }
                    found = true;
                }
            }
            if (found == false)
            {
                if (Categories.First().Name != "Unfound")
                {
                    Categories.Insert(0, new TileCategory()
                    {
                        Name = "Unfound"
                    });
                }

                if (Categories.First().FindTile(multitile.Id) != null)
                {
                    return;
                }
                if (_tileData.GetItemTile(multitile.Id).Flags.HasFlag(TileFlag.Roof))
                {
                    DynamicSelectionTile("Roof", multitile);
                    return;
                }
                if (_tileData.GetItemTile(multitile.Id).Flags.HasFlag(TileFlag.Surface))
                {
                    DynamicSelectionTile("Floor", multitile);
                    return;
                }
                if (_tileData.GetItemTile(multitile.Id).Flags.HasFlag(TileFlag.Wall))
                {
                    DynamicSelectionTile("Wall", multitile);
                    return;
                }
                DynamicSelectionTile("Various", multitile);
            }
        }