Ejemplo n.º 1
0
        /////////////////////////////////////////

        protected override void OnRenderProgress(UIProgress control, CanvasRenderer renderer)
        {
            control.GetScreenRectangle(out var rect);

            //back
            {
                var color = DarkTheme ? new ColorByte(40, 40, 40) : new ColorByte(230, 230, 230);
                renderer.AddQuad(rect, color.ToColorValue());
            }

            //border
            {
                var color = DarkTheme ? new ColorByte(80, 80, 80) : new ColorByte(188, 188, 188);
                renderer.AddRectangle(rect, color.ToColorValue());
            }

            //progress
            if (control.Maximum.Value != 0)
            {
                double progress = control.Value.Value / control.Maximum.Value;
                if (progress > 0)
                {
                    var color = DarkTheme ? new ColorByte(0, 150, 0) : new ColorByte(0, 190, 0);

                    var rect2 = rect;
                    //!!!!Pixels?
                    rect2.Expand(-control.GetScreenOffsetByValue(new UIMeasureValueVector2(UIMeasure.Units, 2, 2)));
                    rect2.Right = MathEx.Lerp(rect2.Left, rect2.Right, progress);

                    renderer.AddQuad(rect2, color.ToColorValue());
                }
            }
        }
Ejemplo n.º 2
0
        /////////////////////////////////////////

        protected override void OnRenderProgress(UIProgress control, CanvasRenderer renderer)
        {
            var rect = control.GetScreenRectangle();

            renderer.AddQuad(rect, new ColorValue(0.05, 0.05, 0.3));

            if (control.Maximum.Value != 0)
            {
                double progress = control.Value.Value / control.Maximum.Value;
                if (progress > 0)
                {
                    var rect2 = rect;
                    rect2.Expand(-control.GetScreenOffsetByValue(new UIMeasureValueVector2(UIMeasure.Units, 4, 4)));
                    rect2.Right = MathEx.Lerp(rect2.Left, rect2.Right, progress);

                    renderer.AddQuad(rect2, new ColorValue(1, 1, 1));
                }
            }
        }