Пример #1
0
        public override void Populate()
        {
            var txtFileLines = File.ReadAllLines(DataManager.Location.LocalPath + "roofs.txt");
            var typeNames = txtFileLines[1].Split(Separators);
            TileCategory category = null;
            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos = txtFileLines[i].Split('\t');

                if (infos[1] == "0")
                {
                    category = new TileCategory(Int32.Parse(infos[2]), TypeTile.Roofs) {Name = infos.Last()};
                    Categories.Add(category);
                }
                var style = new TileStyle();
                category.AddStyle(style);
                style.Name = infos.Last();
                style.Id = Int32.Parse(infos[1]);
                for (int j = 3; j < typeNames.Length - 3; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileRoof { Id = uint.Parse(infos[j]) };
                        style.AddTile(tile);
                       tile.Position = (j-2);
                    }
                }
                
            }
        }
Пример #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 void AddStyle(TileStyle style)
 {
     if (!List.Contains(style))
     {
         List.Add(style);
     }
     style.SetCategory(this);
 }
Пример #4
0
 public void SetStyle(TileStyle style)
 {
     _myStyle = style;
 }
Пример #5
0
 public Tile(TileStyle style)
     : this()
 {
     _myStyle = style;
 }
Пример #6
0
 public void AddStyle(TileStyle style)
 {
     if(!List.Contains(style))
     List.Add(style);
     style.SetCategory(this);
 }
 private TileStyle Selector(TileCategory tileCategory, TileStyle s)
 {
     var style = from sh in tileCategory.List
                 where sh.Name.Split(Separator, StringSplitOptions.RemoveEmptyEntries).Last() == s.Name.Split(Separator, StringSplitOptions.RemoveEmptyEntries).Last()
                 select sh;
     return style.FirstOrDefault();
 }
        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);
        }