예제 #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;
 }
예제 #2
0
 public MRectangle(MPoint _leftTopCorner, MPoint _rightBottomCorner)
 {
     leftTopX     = _leftTopCorner.x;
     leftTopY     = _leftTopCorner.y;
     rightBottomX = _rightBottomCorner.x;
     rightBottomY = _rightBottomCorner.y;
 }
예제 #3
0
 public static MEvent RedrawEvent(MPoint where, MWidget sender)
 {
     return(new MEvent(MEventType.Redraw, new List <int>()
     {
         where.x, where.y
     }, sender));
 }
예제 #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));
 }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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");
     }
 }
예제 #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);
        }
예제 #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;
            }
        }
예제 #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;
            }
        }
예제 #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);
        }
예제 #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);
        }
예제 #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;
        }
예제 #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);
 }
예제 #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();
                }
            }
        }
예제 #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);
 }
예제 #17
0
 public static void DrawRectangle(MPoint where, int width, int height, CColor color)
 {
     DrawRectangle(new MRectangle(where, width, height), color);
 }
예제 #18
0
 private static void MoveCursor(MPoint where)
 {
     Console.SetCursorPosition(where.x, where.y);
 }
예제 #19
0
 private static void SetCursor(MPoint where)
 {
     Console.SetCursorPosition(where.x, where.y);
     pointStack.Push(where);
 }
예제 #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));
 }
예제 #21
0
 public static void DrawStringInPoint(MPoint where, CColor c, String S)
 {
     SetCursor(where.x, where.y);
     c.Apply();
     Console.Write(S);
 }
예제 #22
0
 public static void DrawRectangle(MPoint from, MPoint to, CColor color)
 {
     DrawRectangle(new MRectangle(from, to), color);
 }
예제 #23
0
 public static void DrawLine(MPoint from, MPoint to, CColor color)
 {
     DrawLine(from.x, from.y, to.x, to.y, color);
 }
예제 #24
0
 public override void Redraw(MPoint leftUpCorner)
 {
     base.Redraw(leftUpCorner);
     MDrawHandlerMTG.DrawManaCostAtCardHeader(leftUpCorner, mana);
 }
예제 #25
0
 public virtual void DrawHeader(MPoint where, int maxWidth)
 {
     MDrawHandler.DrawStringInPoint(where, MDrawHandlerMTG.ColorOf(color), name, maxWidth);
 }
예제 #26
0
 public override void Redraw(MPoint leftUpCorner)
 {
     base.Redraw(leftUpCorner);
     MDrawHandler.DrawStringInPoint(leftUpCorner, Color, DrawText, Width);
 }