示例#1
0
        public EntityData(Surface surface, Colour fontColor, Colour backgroundColor)
        {
            _table = surface.NewTable();
            _table.Background.Colour = backgroundColor;
            _name = surface.NewLabel();
            var n = surface.NewLabel();

            n.Text = "Name:  ";

            _health    = surface.NewLabel();
            _maxHealth = surface.NewLabel();
            var h = surface.NewLabel();

            h.Text = "Health:  ";
            var divider = surface.NewLabel();

            divider.Text = " / ";
            var healthPanel = surface.NewHorizontalStack();

            healthPanel.AddPanel(h);
            healthPanel.AddPanel(_health);
            var maxHealthPanel = surface.NewHorizontalStack();

            maxHealthPanel.AddPanel(divider);
            maxHealthPanel.AddPanel(_maxHealth);

            _attack = surface.NewLabel();
            var at = surface.NewLabel();

            at.Text = "Attack:  ";

            _accuracy = surface.NewLabel();
            var ac = surface.NewLabel();

            ac.Text = "Accuracy:  ";

            _defense = surface.NewLabel();
            var def = surface.NewLabel();

            def.Text = "Defense:  ";

            _speed = surface.NewLabel();
            var s = surface.NewLabel();

            s.Text = "Speed:  ";

            _gold = surface.NewLabel();
            var gl = surface.NewLabel();

            gl.Text = "Gold:  ";

            _table = surface.NewTable();
            _table.Compose(
                new Panel[, ]
            {
                { n, _name },
                { healthPanel, maxHealthPanel },
                { at, _attack },
                { ac, _accuracy },
                { def, _defense },
                { s, _speed },
                { gl, _gold }
            });

            SetFontInfo(fontColor, backgroundColor);
            _gold.Font.Colour = Colour.Gold;
            var padding = _table.AddAutoRow();

            padding.Star();
        }