예제 #1
0
        private void FullEmptyCategoriesTxTChecked(IEnumerable <TileCategory> list, IEnumerable <ItemData> datalist, TileCategory tileCategory)
        {
            var style = new TileStyle();

            foreach (ItemData itemData in datalist)
            {
                Tile tile   = null;
                int  number = itemData.Id;

                var tiles = from cat in list
                            let t = cat.FindTile(number)
                                    where t != null
                                    select t;
                tile = tiles.FirstOrDefault();
                if (tile == null)
                {
                    string name = string.Format("{0}-{1}", tileCategory.Name,
                                                itemData.Name.Replace(tileCategory.Name, "").Split(separator2,
                                                                                                   StringSplitOptions
                                                                                                   .
                                                                                                   RemoveEmptyEntries)
                                                .FirstOrDefault());

                    if (string.IsNullOrEmpty(style.Name) || style.Name != name)
                    {
                        if (style.Tiles.Count > 0 && tileCategory.FindStyleByName(style.Name) == null)
                        {
                            tileCategory.AddStyle(style);
                        }


                        var st2 = tileCategory.FindStyleByName(name);
                        if (st2 == null)
                        {
                            style = new TileStyle {
                                Name = name
                            }
                        }
                        ;
                        else
                        {
                            style = st2;
                        }
                    }
                    style.AddTile(new Tile()
                    {
                        Id = number, Name = itemData.Name
                    });
                }
            }
            tileCategory.AddStyle(style);
        }
예제 #2
0
        public override void Populate()
        {
            var txtFileLines = File.ReadAllLines(DataManager.Location.LocalPath + "doors.txt");
            var typeNames    = txtFileLines[1].Split(Separators);

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos    = txtFileLines[i].Split('\t');
                var category = new TileCategory();
                category.Name = infos.Last();

                var style = new TileStyle();
                category.AddStyle(style);

                for (int j = 1; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileDoor {
                            Id = uint.Parse(infos[j])
                        };
                        style.List.Add(tile);
                    }
                }
                Categories.Add(category);
            }
            TilesCategorySDKModule.Supp.PositionCheck(Categories);
        }
예제 #3
0
        public override void Populate()
        {
            var txtFileLines = File.ReadAllLines(Install.GetPath("floors.txt"));
            var typeNames    = txtFileLines[1].Split(Separators);

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos    = txtFileLines[i].Split('\t');
                var category = new TileCategory();
                category.Name = infos.Last();

                var style = new TileStyle();
                category.AddStyle(style);

                for (int j = 1; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileFloor {
                            Id = short.Parse(infos[j])
                        };
                        style.AddTile(tile);
                        tile.ChangeFloorPosition(j);
                    }
                }
                Categories.Add(category);
            }
        }
예제 #4
0
        private void FullEmptyCategoriesTxTChecked(IEnumerable <TileCategory> list, IEnumerable <ModelItemData> datalist, TileCategory tileCategory)
        {
            var style = new TileStyle();

            foreach (var itemData in datalist)
            {
                Tile tile;
                uint number = itemData.EntryId;

                var tiles = from cat in list
                            let t = cat.FindTile(number)
                                    where t != null
                                    select t;
                tile = tiles.FirstOrDefault();
                if (tile == null)
                {
                    string name = string.Format("{0}-{1}", tileCategory.Name,
                                                itemData.Name.Replace(tileCategory.Name, "").Split(Separator2,
                                                                                                   StringSplitOptions
                                                                                                   .
                                                                                                   RemoveEmptyEntries)
                                                .FirstOrDefault());

                    if (string.IsNullOrEmpty(style.Name) || style.Name != name)
                    {
                        if (style.List.Count > 0 && tileCategory.FindStyleByName(style.Name) == null)
                        {
                            tileCategory.AddStyle(style);
                        }


                        var st2 = tileCategory.FindStyleByName(name);
                        style = st2 ?? new TileStyle {
                            Name = name
                        };
                    }
                    switch (tileCategory.TypeTile)
                    {
                    case TypeTile.Wall:
                    {
                        style.AddTile(new TileWall()
                            {
                                Id = number, Name = itemData.Name
                            });
                        break;
                    }

                    case TypeTile.Roofs:
                    {
                        style.AddTile(new TileRoof()
                            {
                                Id = number, Name = itemData.Name
                            });
                        break;
                    }

                    case TypeTile.Floor:
                    {
                        style.AddTile(new TileFloor()
                            {
                                Id = number, Name = itemData.Name
                            });
                        break;
                    }

                    default:
                    {
                        style.AddTile(new Tile {
                                Id = number, Name = itemData.Name
                            });
                        break;
                    }
                    }
                }
            }
            tileCategory.AddStyle(style);
        }
예제 #5
0
        public void Populate()
        {
            if (CheckFromTxt)
            {
                foreach (var factory in Factories)
                {
                    factory.Populate();
                }
            }
            foreach (var fact in Factories)
            {
                Categories.Add(fact.Categories);
            }


            var walls        = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 15 && !itemData.Name.Contains("arc") && !itemData.Flags.HasFlag(TileFlag.Window) && !itemData.Flags.HasFlag(TileFlag.Door)).ToList();
            var windows      = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 15 && itemData.Flags.HasFlag(TileFlag.Window)).ToList();
            var halfWalls    = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 10 && itemData.Height < 15 && !itemData.Flags.HasFlag(TileFlag.Window)).ToList();
            var quarterWalls = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 5 && itemData.Height < 10 && !itemData.Flags.HasFlag(TileFlag.Window)).ToList();
            var archs        = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Name.Contains("arc")).ToList();
            var roof         = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Roof)).ToList();
            var floors       = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Surface)).ToList();

            var wallCategory = new TileCategory()
            {
                Name = "wall", TypeTile = TypeTile.Wall
            };
            var windowCategory = new TileCategory()
            {
                Name = "window", TypeTile = TypeTile.Wall
            };
            var halfCategory = new TileCategory()
            {
                Name = "half", TypeTile = TypeTile.Wall
            };
            var quarterCategory = new TileCategory()
            {
                Name = "quarter", TypeTile = TypeTile.Wall
            };
            var arcsCategory = new TileCategory()
            {
                Name = "arch", TypeTile = TypeTile.Wall
            };
            var roofCategory = new TileCategory()
            {
                Name = "roof", TypeTile = TypeTile.Roofs
            };
            var floorcategory = new TileCategory()
            {
                Name = "floor", TypeTile = TypeTile.Floor
            };

            var lists = Misc.Categories.Union(Walls.Categories).Union(Roofs.Categories).Union(Floors.Categories).ToList();

            if (!CheckFromTxt)
            {
                lists.Clear();
            }

            var listcat = new ObservableCollection <TileCategory>();

            FullEmptyCategoriesTxTChecked(lists, walls, wallCategory);
            FullEmptyCategoriesTxTChecked(lists, quarterWalls, quarterCategory);
            FullEmptyCategoriesTxTChecked(lists, halfWalls, halfCategory);
            FullEmptyCategoriesTxTChecked(lists, windows, windowCategory);
            FullEmptyCategoriesTxTChecked(lists, archs, arcsCategory);
            FullEmptyCategoriesTxTChecked(lists, roof, roofCategory);
            FullEmptyCategoriesTxTChecked(lists, floors, floorcategory);

            foreach (var s in wallCategory.List)
            {
                var category = new TileCategory()
                {
                    Name = s.Name
                };
                category.AddStyle(s);

                var half    = Selector(halfCategory, s);
                var quarter = Selector(quarterCategory, s);
                var window  = Selector(windowCategory, s);
                var arch    = Selector(arcsCategory, s);
                var r       = Selector(roofCategory, s);

                if (half != null)
                {
                    category.AddStyle(half);
                }
                if (quarter != null)
                {
                    category.AddStyle(quarter);
                }
                if (window != null)
                {
                    category.AddStyle(window);
                }
                if (arch != null)
                {
                    category.AddStyle(arch);
                }
                if (r != null)
                {
                    category.AddStyle(r);
                }

                listcat.Add(category);
            }

            listcat.Add(RemoveDuplicates(listcat, windowCategory));
            listcat.Add(RemoveDuplicates(listcat, roofCategory));
            listcat.Add(RemoveDuplicates(listcat, halfCategory));
            listcat.Add(RemoveDuplicates(listcat, quarterCategory));
            listcat.Add(RemoveDuplicates(listcat, arcsCategory));

            Categories.Add(listcat);
        }
예제 #6
0
        public void Populate()
        {
            if (CheckFromTxt)
            {
                foreach (var factory in Factories)
                {
                    factory.Populate();
                }
            }
            foreach (var fact in Factories)
            {
                Categories.Add(fact.Categories);
            }


            var walls        = TileData.ItemTable.Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height == 20 && !itemData.Name.Contains("arc") && !itemData.Flags.HasFlag(TileFlag.Window) && !itemData.Flags.HasFlag(TileFlag.Door)).ToList();
            var windows      = TileData.ItemTable.Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height == 20 && itemData.Flags.HasFlag(TileFlag.Window)).ToList();
            var halfWalls    = TileData.ItemTable.Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height == 10 && !itemData.Flags.HasFlag(TileFlag.Window)).ToList();
            var quarterWalls = TileData.ItemTable.Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height == 5 && !itemData.Flags.HasFlag(TileFlag.Window)).ToList();
            var archs        = TileData.ItemTable.Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Name.Contains("arc")).ToList();
            var roof         = TileData.ItemTable.Where(itemData => itemData.Flags.HasFlag(TileFlag.Roof)).ToList();

            var wallCategory = new TileCategory()
            {
                Name = "wall"
            };
            var windowCategory = new TileCategory()
            {
                Name = "window"
            };
            var halfCategory = new TileCategory()
            {
                Name = "half"
            };
            var quarterCategory = new TileCategory()
            {
                Name = "quarter"
            };
            var arcsCategory = new TileCategory()
            {
                Name = "arch"
            };
            var roofCategory = new TileCategory()
            {
                Name = "roof"
            };

            var style = new TileStyle();

            var lists = Misc.Categories.Union(Walls.Categories).ToList();

            if (!CheckFromTxt)
            {
                lists.Clear();
            }

            var listcat = new List <TileCategory>();


            FullEmptyCategoriesTxTChecked(lists, walls, wallCategory);
            FullEmptyCategoriesTxTChecked(lists, quarterWalls, quarterCategory);
            FullEmptyCategoriesTxTChecked(lists, halfWalls, halfCategory);
            FullEmptyCategoriesTxTChecked(lists, windows, windowCategory);
            FullEmptyCategoriesTxTChecked(lists, archs, arcsCategory);
            FullEmptyCategoriesTxTChecked(lists, roof, roofCategory);

            foreach (var s in wallCategory.Styles)
            {
                var category = new TileCategory()
                {
                    Name = s.Name
                };
                category.AddStyle(s);

                var half    = Selector(halfCategory, s);
                var quarter = Selector(quarterCategory, s);
                var window  = Selector(windowCategory, s);
                var arch    = Selector(arcsCategory, s);
                var r       = Selector(roofCategory, s);

                if (half != null)
                {
                    category.AddStyle(half);
                }
                if (quarter != null)
                {
                    category.AddStyle(quarter);
                }
                if (window != null)
                {
                    category.AddStyle(window);
                }
                if (arch != null)
                {
                    category.AddStyle(arch);
                }
                if (r != null)
                {
                    category.AddStyle(r);
                }

                listcat.Add(category);
            }

            listcat.Add(RemoveDuplicates(listcat, windowCategory));
            listcat.Add(RemoveDuplicates(listcat, roofCategory));
            listcat.Add(RemoveDuplicates(listcat, halfCategory));
            listcat.Add(RemoveDuplicates(listcat, quarterCategory));
            listcat.Add(RemoveDuplicates(listcat, arcsCategory));

            Categories.Add(listcat);
        }