Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Update()
- {
- int colLength = Core.MapGrid.GetLength(0);
- int rowLength = Core.MapGrid.GetLength(1);
- this.ContentPanel.Children.Clear();
- if(Core.City.Warehouses[0].X == colLength)
- {
- Core.City.Warehouses[0].X = colLength;
- }
- else
- {
- Core.City.Warehouses[0].X += 1;
- }
- Console.WriteLine(Core.City.Warehouses[0].X);
- for (int i = 0; i < rowLength; i++)
- {
- for (int j = 0; j < colLength; j++)
- {
- Core.MapGrid[i, j] = "0";
- }
- }
- for (int i = 0; i < Core.City.Warehouses.Count; i++)
- {
- Core.MapGrid[Core.City.Warehouses[i].Y, Core.City.Warehouses[i].X] = "W";
- }
- Grid grid = new Grid();
- for (int i = 0; i < rowLength; i++)
- {
- RowDefinition gridRow1 = new RowDefinition();
- gridRow1.Height = new GridLength(1, GridUnitType.Star);
- grid.RowDefinitions.Add(gridRow1);
- }
- for (int j = 0; j < colLength; j++)
- {
- ColumnDefinition gridCol1 = new ColumnDefinition();
- gridCol1.Width = new GridLength(1, GridUnitType.Star);
- grid.ColumnDefinitions.Add(gridCol1);
- }
- for (int i = 0; i < rowLength; i++)
- {
- for (int j = 0; j < colLength; j++)
- {
- TextBlock textBlock = new TextBlock();
- textBlock.Text = Core.MapGrid[i, j];
- textBlock.SetValue(Grid.RowProperty, i);
- textBlock.SetValue(Grid.ColumnProperty, j);
- grid.Children.Add(textBlock);
- }
- }
- this.ContentPanel.Children.Add(grid);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement