コード例 #1
0
ファイル: Hud.cs プロジェクト: ChrisLR/HiveRL
        public Hud(Character player, int width, int height) : base(width, height)
        {
            this.player = player;
            var borderSurface = new SadConsole.Surfaces.Basic(width + 1, height, base.Font);

            borderSurface.DrawBox(new Rectangle(0, 0, borderSurface.Width, borderSurface.Height),
                                  new Cell(Color.White, Color.Black), null, SadConsole.Surfaces.SurfaceBase.ConnectedLineThick);
            this.Children.Add(borderSurface);
            this.Print(2, 2, "Name:");
            this.Print(7, 2, player.Name);
        }
コード例 #2
0
 public MessageLog(Character player, Game game, int width, int height) : base(width, height)
 {
     this.player = player;
     this.game   = game;
     logBox      = new SadConsole.Surfaces.Basic(width + 1, height, base.Font);
     logBox.DrawBox(new Rectangle(0, height - 10, logBox.Width, 10),
                    new Cell(Color.White, Color.Black), null, SadConsole.Surfaces.SurfaceBase.ConnectedLineThick);
     originX = 1;
     originY = height - 9;
     this.Children.Add(logBox);
 }
コード例 #3
0
        private MogwaiChooseButton CreateChoice(int index, int row, string name, string description, string pathIcon, AdventureType adventureType)
        {
            var choiceConsole = new Console(32, 7)
            {
                Position = new Point(13 + row * 45, 0 + index * 7)
            };

            choiceConsole.Fill(Color.TransparentBlack, Color.Black, null);
            choiceConsole.Print(0, 0, name, Color.White);
            choiceConsole.Print(0, 1, $"[c:g b:darkred:black:black:{description.Length}]" + description, Color.DarkGray);
            Children.Add(choiceConsole);

            var controls = new ControlsConsole(10, 5)
            {
                Position = new Point(-12, 1)
            };

            controls.Fill(Color.Transparent, Color.DarkGray, null);
            choiceConsole.Children.Add(controls);
            var button = new MogwaiChooseButton(10, 5)
            {
                Position = new Point(0, 0)
            };

            button.Click += (btn, args) => { DoAction(adventureType); };
            controls.Add(button);
            button.Unselect();

            // Load the logo
            System.IO.Stream imageStream = TitleContainer.OpenStream(pathIcon);
            var image = Texture2D.FromStream(Global.GraphicsDevice, imageStream);

            imageStream.Dispose();

            Font pictureFont = Global.LoadFont("Cheepicus12.font").GetFont(Font.FontSizes.Quarter);

            // Configure the logo
            SadConsole.Surfaces.Basic consoleImage = image.ToSurface(pictureFont, true);
            consoleImage.Position = new Point(85 + row * 75, 12 + 30 * index);
            //consoleImage.Tint = Color.DarkSlateBlue;
            controls.Children.Add(consoleImage);

            return(button);
        }