Exemplo n.º 1
0
 public MRectangle(MPoint _leftTopCorner, int width, int height)
 {
     leftTopX     = _leftTopCorner.x;
     leftTopY     = _leftTopCorner.y;
     rightBottomX = _leftTopCorner.x + width - 1;
     rightBottomY = _leftTopCorner.y + height - 1;
 }
Exemplo n.º 2
0
 public MRectangle(MPoint _leftTopCorner, MPoint _rightBottomCorner)
 {
     leftTopX     = _leftTopCorner.x;
     leftTopY     = _leftTopCorner.y;
     rightBottomX = _rightBottomCorner.x;
     rightBottomY = _rightBottomCorner.y;
 }
Exemplo n.º 3
0
 public static MEvent RedrawEvent(MPoint where, MWidget sender)
 {
     return(new MEvent(MEventType.Redraw, new List <int>()
     {
         where.x, where.y
     }, sender));
 }
Exemplo n.º 4
0
 public override void Redraw(MPoint leftUpCorner)
 {
     base.Redraw(leftUpCorner);
     Header.Redraw(leftUpCorner);
     Text.Redraw(leftUpCorner.Add(1, 1));
     OkButton.Redraw(leftUpCorner.AddX(GetWidth / 2 - 3).AddY(GetHeight - 1));
 }
Exemplo n.º 5
0
 public override void Redraw(MPoint leftUpCorner)
 {
     base.Redraw(leftUpCorner);
     for (int i = 0; i < Text.Count; ++i)
     {
         MDrawHandler.DrawStringInPoint(leftUpCorner.AddY(i), Color, Text[i], Width);
     }
 }
Exemplo n.º 6
0
 public virtual void RedrawFull(MPoint where, int maxWidth)
 {
     MDrawHandler.DrawStringInPoint(where, MDrawHandlerMTG.DefaultColor, String.Format("{0}'s {1}", host.PlayerName, name), maxWidth);
     for (int i = 0; i < list.Count; ++i)
     {
         list[i].DrawHeader(where.Add(i + 1, 2), maxWidth - 2);
     }
 }
Exemplo n.º 7
0
 public override void Redraw(MPoint leftUpCorner)
 {
     base.Redraw(leftUpCorner);
     for (int i = 0; i < 4; ++i)
     {
         MDrawHandler.DrawStringInPoint(leftUpCorner.Add(1, 1 + i), Color, "TEST");
     }
 }
Exemplo n.º 8
0
        public static void DrawRectangleBorder(MRectangle rec, CColor color)
        {
            SetCursor(rec.From);
            MPoint leftBottom = MoveCursorFromLastY(rec.Height);
            MPoint rightTop   = MoveCursorFromLastX(rec.Width);

            DrawStringInPoint(rec.From, color, "".PadLeft(rec.Width));
            DrawStringInPoint(leftBottom, color, "".PadLeft(rec.Width));
            DrawLine(rec.From, leftBottom, color);
            DrawLine(rec.To, rightTop, color);
        }
Exemplo n.º 9
0
        public override void Redraw(MPoint leftUpCorner)
        {
            base.Redraw(leftUpCorner);
            int yOffset = 0;
            int width   = GetWidth;

            foreach (MWidget w in Children)
            {
                MPoint where = new MPoint(leftUpCorner.x + width / 2 - w.GetWidth / 2, leftUpCorner.y + yOffset);
                w.Redraw(where);
                yOffset += spaceHeight + w.GetHeight;
            }
        }
Exemplo n.º 10
0
        public override void Redraw(MPoint leftUpCorner)
        {
            base.Redraw(leftUpCorner);
            int xOffset = 0;
            int height  = GetHeight;

            foreach (MWidget w in Children)
            {
                MPoint where = new MPoint(leftUpCorner.x + xOffset, leftUpCorner.y + height / 2 - w.GetHeight / 2);
                w.Redraw(where);
                xOffset += spaceWidth + w.GetWidth;
            }
        }
Exemplo n.º 11
0
        public virtual void Redraw(MPoint leftUpCorner)
        {
            //Logs.Trace(String.Format("{0} was redrawn at ({1};{2})", name, leftUpCorner.x, leftUpCorner.y));
            //if (LastRedrawPoint.isEmpty)
            {
                MDrawHandler.DrawRectangle(leftUpCorner, GetWidth, GetHeight, Color);
                //MDrawHandler.DrawRectangleBorder(new MRectangle(leftUpCorner, GetWidth, GetHeight), new CColor(ConsoleColor.Gray));
            }
            LastRedrawPoint = leftUpCorner;


            //MDrawHandler.DrawStringInPoint(leftUpCorner, Color, String.Format("{0} -- ({1};{2})", name, GetWidth, GetHeight), GetWidth);
        }
Exemplo n.º 12
0
        public static void DrawPlayer(MPoint where, Player who, int Width)
        {
            int maxWidth = Width / 2;
            int ostWidth = Width - maxWidth;

            MDrawHandler.DrawStringInPoint(where, MDrawHandlerMTG.DefaultColor, who.PlayerName, maxWidth);
            int offset = 1;

            who.hand.RedrawFull(where.AddY(offset), maxWidth); offset      += who.hand.Count + 1;
            who.deck.RedrawFull(where.AddY(offset), maxWidth); offset      += who.deck.Count + 1;
            who.graveyard.RedrawFull(where.AddY(offset), maxWidth); offset += who.graveyard.Count + 1;
            who.exile.RedrawFull(where.AddY(offset), maxWidth); offset     += who.exile.Count + 1;
            who.field.RedrawFull(where.Add(maxWidth, 1), ostWidth);
        }
Exemplo n.º 13
0
        public static void DrawManaCostAtCardHeader(MPoint where, ManaCost mc)
        {
            int offset = 0;

            if (mc.Any != 0 || mc.ConvertedManaCost == 0)
            {
                MDrawHandler.DrawStringInPoint(where.AddX(offset), anyManaColor, mc.Any.ToString());
                offset += mc.Any.ToString().Length;
            }
            MDrawHandler.DrawStringInPoint(where.AddX(offset), whiteManaColor, "".PadLeft(mc.White, whiteColorManaSymbol)); offset += mc.White;
            MDrawHandler.DrawStringInPoint(where.AddX(offset), blueManaColor, "".PadLeft(mc.Blue, blueColorManaSymbol)); offset    += mc.Blue;
            MDrawHandler.DrawStringInPoint(where.AddX(offset), blackManaColor, "".PadLeft(mc.Black, blackColorManaSymbol)); offset += mc.Black;
            MDrawHandler.DrawStringInPoint(where.AddX(offset), redManaColor, "".PadLeft(mc.Red, redColorManaSymbol)); offset       += mc.Red;
            MDrawHandler.DrawStringInPoint(where.AddX(offset), greenManaColor, "".PadLeft(mc.Green, greenColorManaSymbol)); offset += mc.Green;
        }
Exemplo n.º 14
0
 public static MPoint Trace(String S)
 {
     if (!Write)
     {
         return(new MPoint(-1, -1));
     }
     logs.Add(S);
     // clear all
     if (logs.Count % height == 0)
     {
         MDrawHandler.DrawRectangle(new MRectangle(leftTopCorner, width, height), new CColor(ConsoleColor.Black));
     }
     MPoint where = leftTopCorner.AddY(logs.Count % height);
     MDrawHandler.DrawStringInPoint(where, logColor, S, width);
     return(where);
 }
Exemplo n.º 15
0
        public override void Redraw(MPoint leftUpCorner)
        {
            base.Redraw(leftUpCorner);

            for (int i = 0; i < ((height < 0) ? LineCount : (height - 2)); ++i)
            {
                if (i == selectedIndex)
                {
                    lines[i].setMainColor(selectedColor);
                }
                lines[i].Redraw(leftUpCorner.Add(1, 1 + i));
                if (i == selectedIndex)
                {
                    lines[i].setDefaultColors();
                }
            }
        }
Exemplo n.º 16
0
 public static MPoint TraceMarked(String S, List <String> Events)
 {
     if (!Write)
     {
         return(new MPoint(-1, -1));
     }
     MPoint where = Trace(S);
     foreach (String e in Events)
     {
         int offset = S.IndexOf(e);
         if (offset >= 0)
         {
             MDrawHandler.DrawStringInPoint(where.AddX(offset), markedColor, e, e.Length);
         }
     }
     return(where);
 }
Exemplo n.º 17
0
 public static void DrawRectangle(MPoint where, int width, int height, CColor color)
 {
     DrawRectangle(new MRectangle(where, width, height), color);
 }
Exemplo n.º 18
0
 private static void MoveCursor(MPoint where)
 {
     Console.SetCursorPosition(where.x, where.y);
 }
Exemplo n.º 19
0
 private static void SetCursor(MPoint where)
 {
     Console.SetCursorPosition(where.x, where.y);
     pointStack.Push(where);
 }
Exemplo n.º 20
0
 public static void DrawStringInPoint(MPoint where, CColor c, String S, int maxSymbols)
 {
     SetCursor(where.x, where.y);
     c.Apply();
     Console.Write(Short(S, maxSymbols));
 }
Exemplo n.º 21
0
 public static void DrawStringInPoint(MPoint where, CColor c, String S)
 {
     SetCursor(where.x, where.y);
     c.Apply();
     Console.Write(S);
 }
Exemplo n.º 22
0
 public static void DrawRectangle(MPoint from, MPoint to, CColor color)
 {
     DrawRectangle(new MRectangle(from, to), color);
 }
Exemplo n.º 23
0
 public static void DrawLine(MPoint from, MPoint to, CColor color)
 {
     DrawLine(from.x, from.y, to.x, to.y, color);
 }
Exemplo n.º 24
0
 public override void Redraw(MPoint leftUpCorner)
 {
     base.Redraw(leftUpCorner);
     MDrawHandlerMTG.DrawManaCostAtCardHeader(leftUpCorner, mana);
 }
Exemplo n.º 25
0
 public virtual void DrawHeader(MPoint where, int maxWidth)
 {
     MDrawHandler.DrawStringInPoint(where, MDrawHandlerMTG.ColorOf(color), name, maxWidth);
 }
Exemplo n.º 26
0
 public override void Redraw(MPoint leftUpCorner)
 {
     base.Redraw(leftUpCorner);
     MDrawHandler.DrawStringInPoint(leftUpCorner, Color, DrawText, Width);
 }