Пример #1
0
 public static void DrawBox(Drawing.Canvas canvas, Char[] bs, int x, int y, int sx, int sy, bool fill)
 {
     if (bs == null)
     {
         throw new ArgumentNullException();
     }
     canvas.DrawOnCanvas($"{bs[3]}{"".PadLeft(sx - 2, bs[2])}{bs[0]}", x, y);
     if (fill)
     {
         string midBorder = $"{bs[7]}{"".PadLeft(sx - 2)}{bs[7]}";
         for (int i = 1; i < sy - 1; i++)
         {
             canvas.DrawOnCanvas(midBorder, x, y + i);
         }
     }
     else
     {
         for (int i = 1; i < sy - 1; i++)
         {
             canvas.DrawOnCanvas(bs[7], x, y + i);
             canvas.DrawOnCanvas(bs[7], x + sx - 1, y + i);
         }
     }
     canvas.DrawOnCanvas($"{bs[9]}{"".PadLeft(sx - 2, bs[2])}{bs[6]}", x, y + sy - 1);
 }
Пример #2
0
 /// <summary>
 /// Creates and instance of Container class.
 /// </summary>
 /// <param name="position"></param>
 /// <param name="size"></param>
 /// <param name="name"></param>
 /// <param name="boxType"></param>
 public Container(Int2 position, Int2 size, string name, Misc.Boxes.BoxType boxType)
 {
     this.boxType  = boxType;
     Position      = position;
     canvas        = new Drawing.Canvas(size);
     Size          = size;
     Name          = name;
     boxCharacters = Misc.Boxes.GetBoxArray(boxType);
     Registered    = false;
     children      = new List <UIElement>();
     visable       = true;
 }
Пример #3
0
 /// <summary>
 /// Prints this UI element on a given canvas.
 /// </summary>
 abstract public void PrintOnCanvas(Drawing.Canvas canvas);
Пример #4
0
 public static void DrawBox(Drawing.Canvas canvas, BoxType boxType, int x, int y, int sx, int sy, bool fill)
 {
     DrawBox(canvas, GetBoxArray(boxType), x, y, sx, sy, fill);
 }