コード例 #1
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();
        }
コード例 #2
0
ファイル: Title.cs プロジェクト: minalear/DauntlessTrading
        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();
        }
コード例 #3
0
        public override void DrawStep()
        {
            GraphicConsole.SetColor(Color4.Black, FillColor);
            GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);

            base.DrawStep();
        }
コード例 #4
0
        public InterfaceManager(TradingGame game)
        {
            this.game    = game;
            this.console = new GraphicConsole(game, 100, 37);

            this.interfaces = new Dictionary <string, Interface>();

            CurrentCursorPosition  = Point.Empty;
            PreviousCursorPosition = Point.Empty;

            this.game.MouseDown  += Game_MouseDown;
            this.game.MouseUp    += Game_MouseUp;
            this.game.MouseEnter += Game_MouseEnter;
            this.game.MouseLeave += Game_MouseLeave;
            this.game.MouseMove  += Game_MouseMove;
            this.game.MouseWheel += Game_MouseWheel;
            this.game.KeyPress   += Game_KeyPress;
            this.game.KeyUp      += Game_KeyUp;
            this.game.KeyDown    += Game_KeyDown;

            this.interfaces.Add("Start", new StartScreen(this));
            this.interfaces.Add("NewGame", new NewGameScreen(this));
            this.interfaces.Add("Ship", new ShipScreen(this));
            this.interfaces.Add("Travel", new TravelScreen(this));
            this.interfaces.Add("System", new SystemScreen(this));
            this.interfaces.Add("Trading", new TradingScreen(this));
            this.interfaces.Add("Build", new BuildScreen(this));
            this.interfaces.Add("Stock", new StockMarketScreen(this));
            this.interfaces.Add("Combat", new CombatScreen(this));
            this.interfaces.Add("Final", new FinalScreen(this));

            ChangeInterface("Start");
        }
コード例 #5
0
ファイル: CheckBox.cs プロジェクト: minalear/DauntlessTrading
        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();
        }
コード例 #6
0
ファイル: StarMap.cs プロジェクト: minalear/DauntlessTrading
        private void drawSystems()
        {
            //Draw every system
            foreach (StarSystem point in Interface.GameManager.Systems)
            {
                Point relativePos = point.MapCoord;
                relativePos.X += (int)(mapOffset.X / GraphicConsole.BufferWidth);
                relativePos.Y += (int)(mapOffset.Y / GraphicConsole.BufferWidth);

                GraphicConsole.SetColor(point.StarColor, Color4.Black);
                GraphicConsole.Put('☼', relativePos.X + Position.X, relativePos.Y + Position.Y);
            }

            //Draw current system
            Point systemPos = currentSystem.MapCoord;

            systemPos.X += (int)(mapOffset.X / GraphicConsole.BufferWidth);
            systemPos.Y += (int)(mapOffset.Y / GraphicConsole.BufferWidth);

            GraphicConsole.SetColor(Color4.Black, currentSystem.StarColor);
            GraphicConsole.Put('☼', systemPos.X + Position.X, systemPos.Y + Position.Y);

            if (drawSelectedSystem)
            {
                Point relativePos = selectedSystem.MapCoord;
                relativePos.X += (int)(mapOffset.X / GraphicConsole.BufferWidth);
                relativePos.Y += (int)(mapOffset.Y / GraphicConsole.BufferWidth);

                GraphicConsole.SetColor(Color4.Black, selectedSystem.StarColor);
                GraphicConsole.Put('☼', relativePos.X + Position.X, relativePos.Y + Position.Y);
            }

            GraphicConsole.ClearColor();
        }
コード例 #7
0
ファイル: AnimBox.cs プロジェクト: minalear/DauntlessTrading
        public override void DrawStep()
        {
            this.clearArea();
            GraphicConsole.SetCursor(this.Position.X, this.Position.Y);
            GraphicConsole.Write(this.animationFrames[this.currentFrame]);

            base.DrawStep();
        }
コード例 #8
0
ファイル: Slider.cs プロジェクト: minalear/DauntlessTrading
        public override void DrawStep()
        {
            this.drawRail();

            GraphicConsole.SetColor(this.barColor, this.fillColor);
            GraphicConsole.Put(this.barToken, this.barPosition.X, this.barPosition.Y);

            base.DrawStep();
        }
コード例 #9
0
        public override void DrawStep()
        {
            for (int i = 0; i < stars.Count; i++)
            {
                GraphicConsole.SetColor(stars[i].Color, Color4.Black);
                GraphicConsole.Put('.', stars[i].X, stars[i].Y);
            }
            GraphicConsole.ClearColor();

            base.DrawStep();
        }
コード例 #10
0
ファイル: TextBox.cs プロジェクト: minalear/DauntlessTrading
        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();
            }
        }
コード例 #11
0
ファイル: StarMap.cs プロジェクト: minalear/DauntlessTrading
        private void drawBorder(Rectangle mapBounds)
        {
            GraphicConsole.Draw.Line(mapBounds.Left, mapBounds.Top, mapBounds.Left, mapBounds.Bottom, '│');
            GraphicConsole.Draw.Line(mapBounds.Right, mapBounds.Top, mapBounds.Right, mapBounds.Bottom, '│');
            GraphicConsole.Draw.Line(mapBounds.Left, mapBounds.Top, mapBounds.Right, mapBounds.Top, '─');
            GraphicConsole.Draw.Line(mapBounds.Left, mapBounds.Bottom, mapBounds.Right, mapBounds.Bottom, '─');

            GraphicConsole.Put('┌', mapBounds.Left, mapBounds.Top);
            GraphicConsole.Put('┐', mapBounds.Right, mapBounds.Top);
            GraphicConsole.Put('└', mapBounds.Left, mapBounds.Bottom);
            GraphicConsole.Put('┘', mapBounds.Right, mapBounds.Bottom);
        }
コード例 #12
0
ファイル: Slider.cs プロジェクト: minalear/DauntlessTrading
 private void drawRail()
 {
     GraphicConsole.SetColor(this.railColor, this.fillColor);
     if (this.sliderMode == SliderModes.Horizontal)
     {
         GraphicConsole.Draw.Line(this.Position.X, this.Position.Y, this.Position.X + this.Size.X, this.Position.Y, this.railToken);
     }
     else if (this.sliderMode == SliderModes.Vertical)
     {
         GraphicConsole.Draw.Line(this.Position.X, this.Position.Y, this.Position.X, this.Position.Y + this.Size.Y, this.railToken);
     }
 }
コード例 #13
0
        public virtual void DrawStep()
        {
            GraphicConsole.ClearColor();

            for (int i = 0; i < this.children.Count; i++)
            {
                if (this.children[i].IsVisible)
                {
                    this.children[i].DrawStep();
                }
            }
        }
コード例 #14
0
ファイル: Clock.cs プロジェクト: minalear/DauntlessTrading
        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();
        }
コード例 #15
0
ファイル: StarMap.cs プロジェクト: minalear/DauntlessTrading
        private void drawShips()
        {
            List <Ship> shipsInRange = Interface.GameManager.GetShipsInJumpRadius(Interface.GameManager.PlayerShip);

            foreach (Ship ship in shipsInRange)
            {
                Point point = getScreenPosFromCoord(getCoordFromWorldPos(ship.WorldPosition));

                GraphicConsole.SetColor(ship.Faction.RegionColor, Color4.Black);
                GraphicConsole.Put('.', point);
            }
        }
コード例 #16
0
ファイル: StarMap.cs プロジェクト: minalear/DauntlessTrading
        private void drawPaths()
        {
            GraphicConsole.SetColor(Color4.Red, Color4.Black);
            for (int i = 0; i < path.Count - 1; i++)
            {
                Point a = getScreenPosFromCoord(path[i].MapCoord);
                Point b = getScreenPosFromCoord(path[i + 1].MapCoord);

                GraphicConsole.Draw.Line(a.X, a.Y, b.X, b.Y, '∙');
            }
            GraphicConsole.ClearColor();
        }
コード例 #17
0
ファイル: StarMap.cs プロジェクト: minalear/DauntlessTrading
        public override void DrawStep()
        {
            Rectangle mapBounds = new Rectangle(Position, new Size(Size));

            GraphicConsole.SetBounds(mapBounds);

            Vector2 origin = Vector2.Zero;

            origin.X += mapOffset.X / GraphicConsole.BufferWidth;
            origin.Y += mapOffset.Y / GraphicConsole.BufferWidth;

            int x = (int)(origin.X + mapBounds.X);
            int y = (int)(origin.Y + mapBounds.Y);

            GraphicConsole.SetColor(axisColor, Color4.Black);
            GraphicConsole.Draw.Line(x, mapBounds.Top + 1, x, mapBounds.Bottom - 1, '·');
            GraphicConsole.Draw.Line(mapBounds.Left + 1, y, mapBounds.Right - 1, y, '·');
            GraphicConsole.SetCursor(x + 1, y - 1);
            GraphicConsole.ClearColor();

            double travelRadius = Interface.GameManager.PlayerShip.JumpRadius;
            int    r            = (int)(travelRadius / GraphicConsole.BufferWidth);

            Point playerPos = getScreenPosFromCoord(getCoordFromWorldPos(Interface.GameManager.PlayerShip.WorldPosition));

            GraphicConsole.SetColor(Color4.Gray, Color4.Black);
            GraphicConsole.Draw.Circle(playerPos.X, playerPos.Y, r, '·');

            if (drawSelectedSystem)
            {
                drawPaths();
            }
            drawShips();
            drawSystems();
            drawFactions();

            GraphicConsole.ClearBounds();
            GraphicConsole.ClearColor();

            drawBorder(mapBounds);

            if (DrawPlayerPosition)
            {
                GraphicConsole.SetColor(Color4.Red, Color4.Black);
                GraphicConsole.Put('@', playerPos);
            }

            GraphicConsole.ClearColor();
            base.DrawStep();
        }
コード例 #18
0
ファイル: StarMap.cs プロジェクト: minalear/DauntlessTrading
 private void drawFactions()
 {
     GraphicConsole.Draw.PaintMode = Console.PaintModes.Add;
     foreach (Faction faction in Interface.GameManager.Factions)
     {
         foreach (Market market in faction.OwnedMarkets)
         {
             Point relativePos = getScreenPosFromCoord(market.System.MapCoord);
             GraphicConsole.SetColor(Color4.Transparent, faction.RegionColor);
             GraphicConsole.Draw.FillCircle(relativePos.X, relativePos.Y, 8, ' ');
         }
     }
     GraphicConsole.Draw.PaintMode = Console.PaintModes.Default;
 }
コード例 #19
0
 private void setConsoleColors(int index)
 {
     if (index == this.selectedIndex)
     {
         GraphicConsole.SetColor(this.selectedTextColor, this.selectedFillColor);
     }
     else if (index == this.hoverIndex)
     {
         GraphicConsole.SetColor(this.hoverTextColor, this.hoverFillColor);
     }
     else
     {
         GraphicConsole.SetColor(this.objectList[index].TextColor, this.fillColor);
     }
 }
コード例 #20
0
ファイル: InputBox.cs プロジェクト: minalear/DauntlessTrading
        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();
        }
コード例 #21
0
        public override void DrawStep()
        {
            GraphicConsole.SetColor(Color4.Transparent, FillColor);
            GraphicConsole.Draw.Rect(Position.X, Position.Y, Size.X, Size.Y, ' ', true);

            GraphicConsole.SetColor(Color4.Transparent, StripeColor);
            for (int x = Position.X + Size.X - 1; x >= Position.X; x -= 5)
            {
                GraphicConsole.Draw.Line(x, Position.Y, x, Position.Y + Size.Y - 1, ' ');
            }

            if (faction == null)
            {
                return;
            }

            int scaleX = 5;
            int scaleY = max(0, 100) / (Size.Y - 1);

            if (scaleY == 0)
            {
                return;              //Prevent divide by zero exception
            }
            int loop = 0;

            for (int i = faction.StockPrices.Count - 1; i > 0 && loop < Size.X / 5; i--)
            {
                int x0 = (Position.X + Size.X - 1) - loop * scaleX;
                int x1 = (Position.X + Size.X - 1) - (loop + 1) * scaleX;

                int y0 = (Position.Y + Size.Y - 1) - faction.StockPrices[i] / scaleY;
                int y1 = (Position.Y + Size.Y - 1) - faction.StockPrices[i - 1] / scaleY;

                GraphicConsole.SetColor(faction.RegionColor, FillColor);
                GraphicConsole.Draw.Line(x0, y0, x1, y1, '.');

                GraphicConsole.SetColor(faction.RegionColor, StripeColor);
                GraphicConsole.Put('*', x0, y0);
                GraphicConsole.Put('*', x1, y1);

                loop++;
            }

            GraphicConsole.ClearColor();

            base.DrawStep();
        }
コード例 #22
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();
        }
コード例 #23
0
        private void drawBorders()
        {
            GraphicConsole.Draw.Line(0, 0, 0, GraphicConsole.BufferHeight - 1, '║');
            GraphicConsole.Draw.Line(GraphicConsole.BufferWidth - 1, 0, GraphicConsole.BufferWidth - 1, GraphicConsole.BufferHeight - 1, '║');
            GraphicConsole.Draw.Line(0, 0, GraphicConsole.BufferWidth - 1, 0, '═');
            GraphicConsole.Draw.Line(0, GraphicConsole.BufferHeight - 1, GraphicConsole.BufferWidth - 1, GraphicConsole.BufferHeight - 1, '═');

            GraphicConsole.Put('╔', 0, 0);
            GraphicConsole.Put('╗', GraphicConsole.BufferWidth - 1, 0);
            GraphicConsole.Put('╚', 0, GraphicConsole.BufferHeight - 1);
            GraphicConsole.Put('╝', GraphicConsole.BufferWidth - 1, GraphicConsole.BufferHeight - 1);

            GraphicConsole.Draw.Line(1, 3, GraphicConsole.BufferWidth - 2, 3, '-');
            GraphicConsole.Draw.Line(1, 5, GraphicConsole.BufferWidth - 2, 5, '-');
            GraphicConsole.Draw.Line(1, 7, GraphicConsole.BufferWidth - 2, 7, '-');
            GraphicConsole.Draw.Line(1, 28, GraphicConsole.BufferWidth - 2, 28, '-');
        }
コード例 #24
0
ファイル: Button.cs プロジェクト: minalear/DauntlessTrading
        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();
        }
コード例 #25
0
        public override void DrawStep()
        {
            //Draw the star
            int r = 15;

            for (int i = 0; i < r; i++)
            {
                GraphicConsole.SetColor(GameManager.CurrentSystem.StarColor, Color4.Black);
                GraphicConsole.Draw.Circle(0, GraphicConsole.BufferHeight / 2, i, '.');
            }
            GraphicConsole.Draw.Circle(0, GraphicConsole.BufferHeight / 2, r, '*');

            //Draw the planets
            for (int i = 0; i < GameManager.CurrentSystem.Planetoids.Count; i++)
            {
                int x = i % 4;
                int y = i / 4;

                Planetoid planet = GameManager.CurrentSystem.Planetoids[i];

                int planetRadius = 5;

                GraphicConsole.SetColor(Color4.White, Color4.Black);
                GraphicConsole.Draw.Circle(x * 20 + 25, y * 15 + 10, planetRadius, '.');

                for (int moon = 0; moon < planet.Moons.Count; moon++)
                {
                    double angle = OpenTK.MathHelper.DegreesToRadians(moon * 30) - OpenTK.MathHelper.DegreesToRadians(90.0);
                    int    mX    = (int)(Math.Cos(angle) * (planetRadius + 3.1)) + (x * 20 + 25);
                    int    mY    = (int)(Math.Sin(angle) * (planetRadius + 1)) + (y * 15 + 10);

                    GraphicConsole.SetColor(Color4.White, Color4.Black);
                    GraphicConsole.Put('*', mX, mY);
                }
            }

            GraphicConsole.ClearColor();
            base.DrawStep();
        }
コード例 #26
0
ファイル: TextBox.cs プロジェクト: minalear/DauntlessTrading
        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');
        }
コード例 #27
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(' ');
         }
     }
 }
コード例 #28
0
ファイル: InputBox.cs プロジェクト: minalear/DauntlessTrading
        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(' ');
                }
            }
        }
コード例 #29
0
 protected virtual void clearArea()
 {
     GraphicConsole.ClearColor();
     GraphicConsole.Draw.Rect(this.Position.X, this.Position.Y, this.Size.X, this.Size.Y, ' ', true);
 }