Esempio n. 1
0
        public override void DrawStep()
        {
            GraphicConsole.SetCursor(this.Position.X, this.Position.Y);

            if (this.isHover) //Mouse is hovering
            {
                GraphicConsole.SetColor(this.foregroundColorHover, this.backgroundColorHover);
            }
            else if (this.enabled) //Check box is checked
            {
                GraphicConsole.SetColor(this.foregroundColorEnabled, this.backgroundColorEnabled);
            }
            else //Check box isn't checked
            {
                GraphicConsole.SetColor(this.foregroundColorDisabled, this.backgroundColorDisabled);
            }


            if (this.enabled)
            {
                GraphicConsole.Write(this.enabledToken);
            }
            else
            {
                GraphicConsole.Write(this.disabledToken);
            }

            base.DrawStep();
        }
Esempio n. 2
0
        public override void DrawStep()
        {
            if (this.visible)
            {
                GraphicConsole.SetColor(Color.Transparent, this.fillColor);
                GraphicConsole.Draw.Rect(this.position.X, this.position.Y, this.size.X, this.size.Y, ' ', true);

                GraphicConsole.SetColor(this.borderColor, this.fillColor);
                GraphicConsole.Draw.Rect(this.position.X, this.position.Y, this.size.X, this.size.Y, this.borderToken, false);

                if (this.isMultilined)
                {
                    for (int i = 0; i < this.lines.Length; i++)
                    {
                        GraphicConsole.SetColor(this.textColor, this.fillColor);
                        GraphicConsole.SetCursor((GraphicConsole.BufferWidth / 2) - (this.size.X - 4) / 2, this.position.Y + 2 + i);
                        GraphicConsole.Write(this.lines[i]);
                    }
                }
                else
                {
                    GraphicConsole.SetColor(this.textColor, this.fillColor);
                    GraphicConsole.SetCursor((GraphicConsole.BufferWidth / 2) - (this.size.X - 4) / 2, GraphicConsole.BufferHeight / 2);
                    GraphicConsole.Write(this.message);
                }
            }

            base.DrawStep();
        }
Esempio n. 3
0
        public override void DrawStep()
        {
            GraphicConsole.SetColor(this.textColor, this.fillColor);

            if (this.textAlignMode == TextAlignModes.Center)
            {
                int x = this.Position.X - this.text.Length / 2;

                GraphicConsole.SetCursor(x, this.Position.Y);
                GraphicConsole.Write(this.text);
            }
            else if (this.textAlignMode == TextAlignModes.Left)
            {
                GraphicConsole.SetCursor(this.Position.X, this.Position.Y);
                GraphicConsole.Write(this.text);
            }
            else if (this.textAlignMode == TextAlignModes.Right)
            {
                int x = this.Position.X - this.text.Length;

                GraphicConsole.SetCursor(x, this.Position.Y);
                GraphicConsole.Write(this.text);
            }

            base.DrawStep();
        }
Esempio n. 4
0
        public override void DrawStep()
        {
            this.clearArea();
            GraphicConsole.SetCursor(this.Position.X, this.Position.Y);
            GraphicConsole.Write(this.animationFrames[this.currentFrame]);

            base.DrawStep();
        }
Esempio n. 5
0
        public override void DrawStep()
        {
            GraphicConsole.SetColor(this.textColor, this.fillColor);
            GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);

            if (!string.IsNullOrEmpty(this.text))
            {
                if (this.scroll)
                {
                    //Scroll Bar Rail
                    GraphicConsole.SetColor(this.scrollRailColor, this.fillColor);
                    for (int h = this.Position.Y; h < this.Size.Y + this.Position.Y; h++)
                    {
                        GraphicConsole.SetCursor(this.Position.X + this.Size.X, h);
                        GraphicConsole.Write(this.scrollRail);
                    }

                    //Scroll Bar
                    GraphicConsole.SetColor(this.scrollBarColor, this.fillColor);
                    GraphicConsole.SetCursor(this.Position.X + this.Size.X, (int)(this.scrollValue / 100f * this.Size.Y) + this.Position.Y);
                    GraphicConsole.Write(this.scrollBar);

                    string[] lines = this.text.Split('\n');
                    this.lineCount = lines.Length;

                    int line = (int)(this.scrollValue / 100f * (lines.Length - this.Size.Y + 1));
                    if (line < 0)
                    {
                        line = 0;
                    }

                    GraphicConsole.SetColor(this.textColor, this.fillColor);
                    for (int y = 0; y < this.Size.Y && y < lines.Length; y++)
                    {
                        if (line < lines.Length)
                        {
                            this.writeLine(lines[line], this.Position.X, this.Position.Y + y);
                        }

                        line++;
                    }
                }
                else
                {
                    string[] lines = this.text.Split('\n');
                    for (int line = 0; line < lines.Length && line < this.Size.Y; line++)
                    {
                        this.writeLine(lines[line], this.Position.X, this.Position.Y + line);
                    }
                }

                base.DrawStep();
            }
        }
Esempio n. 6
0
        public override void DrawStep()
        {
            GraphicConsole.SetColor(ForeColor, FillColor);

            GraphicConsole.SetCursor(this.Position);
            GraphicConsole.Write(new string('░', Size.X));

            GraphicConsole.SetCursor(this.Position);
            GraphicConsole.Write(new string('█', fill));

            base.DrawStep();
        }
Esempio n. 7
0
        public override void DrawStep()
        {
            this.clearArea();

            GraphicConsole.SetColor(Color.Transparent, this.fillColor);
            GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);

            if (this.text != string.Empty)
            {
                GraphicConsole.SetColor(this.textColor, this.fillColor);
                GraphicConsole.SetCursor(this.Position);
                GraphicConsole.Write(this.text);
            }

            base.DrawStep();
        }
Esempio n. 8
0
        public override void DrawStep()
        {
            GraphicConsole.SetColor(Color.Transparent, this.fillColor);
            GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);

            if (!scroll)
            {
                for (int i = 0; i < this.objectList.Count; i++)
                {
                    this.setConsoleColors(i);
                    GraphicConsole.SetCursor(this.Position.X, this.Position.Y + i);

                    this.writeLine(this.objectList[i].ListText);
                }
            }
            else
            {
                //Scroll Bar Rail
                GraphicConsole.SetColor(this.scrollRailColor, this.fillColor);
                GraphicConsole.Draw.Line(this.Position.X + this.Size.X, this.Position.Y, this.Position.X + this.Size.X, this.Position.Y + this.Size.Y - 1, this.scrollRail);

                //Scroll Bar
                GraphicConsole.SetColor(this.scrollBarColor, this.fillColor);
                GraphicConsole.SetCursor(this.Position.X + this.Size.X, (int)(this.scrollValue / 100f * this.Size.Y) + this.Position.Y);
                GraphicConsole.Write(this.scrollBar);

                int line = (int)(this.scrollValue / 100f * (this.objectList.Count - this.Size.Y + 1));
                if (line < 0)
                {
                    line = 0;
                }

                for (int y = 0; y < this.Size.Y; y++)
                {
                    if (line < objectList.Count)
                    {
                        this.setConsoleColors(line);
                        GraphicConsole.SetCursor(this.Position.X, this.Position.Y + y);
                        this.writeLine(this.objectList[line].ListText);
                    }
                    line++;
                }
            }

            base.DrawStep();
        }
Esempio n. 9
0
        public override void DrawStep()
        {
            this.clearArea();

            if (this.mode == ButtonModes.Normal)
            {
                //Fill Area
                GraphicConsole.SetColor(Color.Transparent, this.fillColor);
                GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);

                //Write Text
                GraphicConsole.SetColor(this.textColor, this.fillColor);
                GraphicConsole.SetCursor(this.textPosition);
                GraphicConsole.Write(this.text);
            }
            else if (this.mode == ButtonModes.Hover)
            {
                //Fill Area
                GraphicConsole.SetColor(Color.Transparent, this.fillColorHover);
                GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);

                //Write Text
                GraphicConsole.SetColor(this.textColorHover, this.fillColorHover);
                GraphicConsole.SetCursor(this.textPosition);
                GraphicConsole.Write(this.text);
            }
            else if (this.mode == ButtonModes.Pressed)
            {
                //Fill Area
                GraphicConsole.SetColor(Color.Transparent, this.fillColorPressed);
                GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);

                //Write Text
                GraphicConsole.SetColor(this.textColorPressed, this.fillColorPressed);
                GraphicConsole.SetCursor(this.textPosition);
                GraphicConsole.Write(this.text);
            }

            base.DrawStep();
        }
Esempio n. 10
0
        private void writeLine(string line, int x, int y)
        {
            GraphicConsole.SetCursor(x, y);
            for (int i = 0; i < line.Length; i++)
            {
                if (line[i] == '<')
                {
                    int    k         = i;
                    string formatTag = "";
                    while (k < line.Length && line[k] != '>')
                    {
                        formatTag += line[k];
                        k++;
                    }
                    formatTag += ">";

                    line = line.Remove(i, formatTag.Length);

                    if (formatTag.Contains("<color ")) //Start Custom Color
                    {
                        //Get the color specified
                        formatTag = formatTag.Remove(0, 7);
                        formatTag = formatTag.Remove(formatTag.Length - 1);

                        //Retrieve the color and apply it
                        GraphicConsole.SetColor(TextUtilities.GetColor(formatTag), this.fillColor);
                    }
                    else if (formatTag == "<color>") //End Custom Color
                    {
                        //Reset colors back to normal
                        GraphicConsole.SetColor(this.textColor, this.fillColor);
                    }
                }
                GraphicConsole.Write(line[i]);
            }

            GraphicConsole.Write('\n');
        }
Esempio n. 11
0
 private void writeLine(string line)
 {
     if (!string.IsNullOrEmpty(line))
     {
         //Ensure text doesn't go past the size of the list
         int i = 0;
         for (i = 0; i < line.Length && i < this.Size.X; i++)
         {
             GraphicConsole.Write(line[i]);
         }
         for (; i < this.Size.X; i++)
         {
             GraphicConsole.Write(' ');
         }
     }
     else
     {
         for (int i = 0; i < this.Size.X; i++)
         {
             GraphicConsole.Write(' ');
         }
     }
 }
Esempio n. 12
0
        public override void UpdateFrame(GameTime gameTime)
        {
            if (this.hasFocus)
            {
                this.cursorCounter += gameTime.ElapsedTime.TotalMilliseconds;

                if (this.cursorCounter >= cursorFlickerRate * 2)
                {
                    this.cursorCounter = 0.0;
                }
                if (this.cursorCounter > cursorFlickerRate)
                {
                    GraphicConsole.SetColor(this.textColor, this.fillColor);
                    GraphicConsole.SetCursor(this.Position.X + this.text.Length, this.Position.Y);
                    GraphicConsole.Write(this.cursor);
                }
                else
                {
                    GraphicConsole.SetColor(this.textColor, this.fillColor);
                    GraphicConsole.SetCursor(this.Position.X + this.text.Length, this.Position.Y);
                    GraphicConsole.Write(' ');
                }
            }
        }