Example #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);
                    }
                }
            }
        }
Example #2
0
        public override void Populate()
        {
            var          txtFileLines = File.ReadAllLines(Install.GetPath("misc.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]));
                    category.Name = infos.Last();
                    Categories.Add(category);
                }
                var style = new TileStyle();
                category.AddStyle(style);
                style.Name  = infos.Last();
                style.Index = Int32.Parse(infos[1]);
                for (int j = 3; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileMisc {
                            Id = short.Parse(infos[j])
                        };
                        style.AddTile(tile);
                    }
                }
            }
            TilesCategorySDKModule.Supp.PositionCheck(Categories);
        }
Example #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);
            }
        }
Example #4
0
        public override void Populate()
        {
            var txtFileLines = File.ReadAllLines(DataManager.Location.LocalPath + "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 = uint.Parse(infos[j])
                        };
                        style.AddTile(tile);
                        tile.Position = j;
                    }
                }
                Categories.Add(category);
            }
        }
Example #5
0
        private void AddTiles_Click_1(object sender, RoutedEventArgs e)
        {
            var media = SuperGridTiles.DataGridCategories as System.Windows.Media.Visual;

            if (media == null)
            {
                return;
            }
            var foundList = Globals.Helpers.FindElementsOfType(media, typeof(DataGrid));

            if (foundList == null)
            {
                return;
            }

            List <DataGrid> dataList = foundList.OfType <DataGrid>().Select(frameworkElement => frameworkElement).ToList();

            media = null;
            if (dataList.Count == 0)
            {
                return;
            }
            TileStyle style = null;
            var       found = false;

            foreach (var dataGrid in dataList)
            {
                foreach (TileStyle obj in dataGrid.SelectedItems.OfType <TileStyle>())
                {
                    style = obj as TileStyle;
                    found = true;
                }
                if (found)
                {
                    break;
                }
            }
            if (style == null)
            {
                return;
            }
            foreach (var tile in Globals.Globals.SdkTiles.TmpTileList)
            {
                style.AddTile(tile);
            }
            Globals.Globals.SdkTiles.TmpTileList.Clear();
            AllGridRefresh();
        }
Example #6
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);
        }