Esempio n. 1
0
        public override bool Draw(Rect rect)
        {
            if (_value < 0f)
            {
                return(false);
            }

            var percentage = _value / _max;

            var showLabel = Label != null;

            var grid = rect.GetHGrid(GUIPlus.TinyPadding, showLabel ? Theme.LabelWidth.Value : 0f, -1f, _valueStyle == ValueStyle.Hidden ? 0f : Theme.ValueWidth.Value);

            DrawText(grid[1], Label);
            GUIPlus.DrawBar(grid[2], percentage, GetBarColor(percentage));
            DrawThresholds(grid[2]);
            DrawValue(grid[3], _value, _max);

            if (Hud.IsMouseOverConfigButton)
            {
                return(true);
            }

            if (Widgets.ButtonInvisible(rect.ExpandedBy(GUIPlus.TinyPadding)))
            {
                _onClick?.Invoke();
            }
            if (Mouse.IsOver(rect))
            {
                GUIPlus.DrawTooltip(grid[0], Tooltip, false);
            }

            return(true);
        }
Esempio n. 2
0
        public override bool Draw(Rect rect)
        {
            if (_value < 0f)
            {
                return(false);
            }

            var percentage = _value / _max;

            var showLabel = Label != null;

            var grid = rect.GetHGrid(GUIPlus.TinyPadding, showLabel ? Theme.LabelWidth.Value : 0f, -1f, _valueStyle == ValueStyle.Hidden ? 0f : Theme.ValueWidth.Value);

            DrawText(grid[1], Label);
            GUIPlus.DrawBar(grid[2], percentage, GetBarColor(percentage));
            DrawThresholds(grid[2]);
            DrawValue(grid[3], _value, _max);

            GUIPlus.DrawTooltip(grid[0], Tooltip, false);
            return(true);
        }