1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 10:57:26 +08:00
osu-lazer/osu.Game/Overlays/Profile/Header/Components/ProfileValueDisplay.cs

61 lines
1.9 KiB
C#
Raw Normal View History

2019-03-10 06:58:14 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
2019-03-10 06:58:14 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2021-07-17 21:18:45 +08:00
using osu.Framework.Localisation;
2019-03-10 06:58:14 +08:00
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
2019-04-26 12:49:44 +08:00
namespace osu.Game.Overlays.Profile.Header.Components
2019-03-10 06:58:14 +08:00
{
public partial class ProfileValueDisplay : CompositeDrawable
2019-03-10 06:58:14 +08:00
{
2019-04-25 19:05:59 +08:00
private readonly OsuSpriteText title;
private readonly OsuSpriteText content;
2019-03-10 06:58:14 +08:00
2021-07-17 21:18:45 +08:00
public LocalisableString Title
2019-03-10 06:58:14 +08:00
{
set => title.Text = value;
}
2021-07-24 05:12:22 +08:00
public LocalisableString Content
2019-03-10 06:58:14 +08:00
{
set => content.Text = value;
}
public ProfileValueDisplay(bool big = false, int minimumWidth = 60)
2019-03-10 06:58:14 +08:00
{
AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
title = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 12)
2019-03-10 06:58:14 +08:00
},
content = new OsuSpriteText
{
Font = OsuFont.GetFont(size: big ? 30 : 20, weight: FontWeight.Light)
2019-03-10 06:58:14 +08:00
},
2020-05-05 09:31:11 +08:00
new Container // Add a minimum size to the FillFlowContainer
2019-03-10 06:58:14 +08:00
{
Width = minimumWidth,
}
}
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
title.Colour = colourProvider.Content1;
content.Colour = colourProvider.Content2;
}
2019-03-10 06:58:14 +08:00
}
}