private void AddStellars(Location location, int x, int y)
 {
     foreach (Eidos stellar in location.Stellars)
     {
         Grid.SetRow(stellar.Image, x);
         Grid.SetColumn(stellar.Image, y);
         if (stellar.Image.Parent != null)
         {
             Panel parent = (Panel)stellar.Image.Parent;
             parent.Children.Remove(stellar.Image);
         }
         grdLocalSystem.Children.Add(stellar.Image);
         TextBlock tb = new TextBlock();
         tb.Text = stellar.Name;
         tb.Foreground = Brushes.Yellow;
         tb.FontSize = 8;
         tb.VerticalAlignment = VerticalAlignment.Bottom;
         tb.HorizontalAlignment = HorizontalAlignment.Center;
         tb.SetValue(Panel.ZIndexProperty, 900);
         Grid.SetRow(tb, x);
         Grid.SetColumn(tb, y);
         grdLocalSystem.Children.Add(tb);
     }
 }
Exemple #2
0
 void initLocations()
 {
     try
     {
         Location newLoc;
         for (int x = 0; x < GridDimensionX; x++)
         {
             for (int y = 0; y < GridDimensionY; y++)
             {
                 using (RNG rng = new RNG())
                 {
                     newLoc = new Location();
                     if (rng.d100() > 95)
                         newLoc.IsBlocked = true;
                     newLoc.Name = string.Format("Loc {0},{1}{2}",
                         x.ToString(),
                         y.ToString(),
                         (newLoc.IsBlocked ? Environment.NewLine + " (Blocked)" : string.Empty));
                     GameState.CombatLocations[x, y] = newLoc;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         if (LogEverything)
             Logger(ex);
     }
 }