コード例 #1
0
        private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
        {
            // Don't display the attribute if its maximum is 0
            // For example, flashlight bonus would be zero if flashlight mod isn't on
            if (Precision.AlmostEquals(perfectAttribute.Value, 0f))
            {
                return(null);
            }

            float percentage = (float)(attribute.Value / perfectAttribute.Value);

            return(new Drawable[]
            {
                new OsuSpriteText
                {
                    Origin = Anchor.CentreLeft,
                    Anchor = Anchor.CentreLeft,
                    Font = OsuFont.GetFont(weight: FontWeight.Regular),
                    Text = attribute.DisplayName,
                    Colour = Colour4.White
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding = new MarginPadding {
                        Left = 10, Right = 10
                    },
                    Child = new Bar
                    {
                        RelativeSizeAxes = Axes.X,
                        Origin = Anchor.Centre,
                        Anchor = Anchor.Centre,
                        CornerRadius = 2.5f,
                        Masking = true,
                        Height = 5,
                        BackgroundColour = Color4.White.Opacity(0.5f),
                        AccentColour = Color4Extensions.FromHex("#66FFCC"),
                        Length = percentage
                    }
                },
                new OsuSpriteText
                {
                    Origin = Anchor.CentreRight,
                    Anchor = Anchor.CentreRight,
                    Font = OsuFont.GetFont(weight: FontWeight.SemiBold),
                    Text = percentage.ToLocalisableString("0%"),
                    Colour = Colour4.White
                }
            });
        }
コード例 #2
0
 private void setTotalValues(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
 {
     achievedPerformance.Text = Math.Round(attribute.Value, MidpointRounding.AwayFromZero).ToLocalisableString();
     maximumPerformance.Text  = Math.Round(perfectAttribute.Value, MidpointRounding.AwayFromZero).ToLocalisableString();
 }