mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into underscored_link
This commit is contained in:
commit
e715cc8f6e
@ -3,17 +3,15 @@
|
|||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
||||||
{
|
{
|
||||||
@ -24,46 +22,27 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|||||||
public KudosuInfo(Bindable<User> user)
|
public KudosuInfo(Bindable<User> user)
|
||||||
{
|
{
|
||||||
this.user.BindTo(user);
|
this.user.BindTo(user);
|
||||||
|
|
||||||
CountSection total;
|
CountSection total;
|
||||||
CountSection avaliable;
|
CountSection avaliable;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = 3;
|
CornerRadius = 3;
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Offset = new Vector2(0f, 1f),
|
|
||||||
Radius = 3f,
|
|
||||||
Colour = Color4.Black.Opacity(0.2f),
|
|
||||||
};
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = OsuColour.Gray(0.2f)
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5, 0),
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
total = new CountSection(
|
total = new CountTotal(),
|
||||||
"Total Kudosu Earned",
|
avaliable = new CountAvailable()
|
||||||
"Based on how much of a contribution the user has made to beatmap moderation. See this link for more information."
|
|
||||||
),
|
|
||||||
avaliable = new CountSection(
|
|
||||||
"Kudosu Avaliable",
|
|
||||||
"Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet."
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.user.ValueChanged += u =>
|
this.user.ValueChanged += u =>
|
||||||
{
|
{
|
||||||
total.Count = u.NewValue?.Kudosu.Total ?? 0;
|
total.Count = u.NewValue?.Kudosu.Total ?? 0;
|
||||||
@ -73,21 +52,43 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|||||||
|
|
||||||
protected override bool OnClick(ClickEvent e) => true;
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
|
|
||||||
|
private class CountAvailable : CountSection
|
||||||
|
{
|
||||||
|
public CountAvailable()
|
||||||
|
: base("Kudosu Avaliable")
|
||||||
|
{
|
||||||
|
DescriptionText.Text = "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CountTotal : CountSection
|
||||||
|
{
|
||||||
|
public CountTotal()
|
||||||
|
: base("Total Kudosu Earned")
|
||||||
|
{
|
||||||
|
DescriptionText.AddText("Based on how much of a contribution the user has made to beatmap moderation. See ");
|
||||||
|
DescriptionText.AddLink("this link", "https://osu.ppy.sh/wiki/Kudosu");
|
||||||
|
DescriptionText.AddText(" for more information.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class CountSection : Container
|
private class CountSection : Container
|
||||||
{
|
{
|
||||||
private readonly OsuSpriteText valueText;
|
private readonly OsuSpriteText valueText;
|
||||||
|
protected readonly LinkFlowContainer DescriptionText;
|
||||||
|
private readonly Box lineBackground;
|
||||||
|
|
||||||
public new int Count
|
public new int Count
|
||||||
{
|
{
|
||||||
set => valueText.Text = value.ToString();
|
set => valueText.Text = value.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CountSection(string header, string description)
|
public CountSection(string header)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Width = 0.5f;
|
Width = 0.5f;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
Padding = new MarginPadding { Horizontal = 10, Top = 10, Bottom = 20 };
|
Padding = new MarginPadding { Top = 10, Bottom = 20 };
|
||||||
Child = new FillFlowContainer
|
Child = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
@ -96,39 +97,42 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|||||||
Spacing = new Vector2(0, 5),
|
Spacing = new Vector2(0, 5),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new CircularContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
Masking = true,
|
||||||
Direction = FillDirection.Horizontal,
|
RelativeSizeAxes = Axes.X,
|
||||||
Spacing = new Vector2(5, 0),
|
Height = 5,
|
||||||
Children = new Drawable[]
|
Child = lineBackground = new Box
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Text = header,
|
||||||
Origin = Anchor.BottomLeft,
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold)
|
||||||
Text = header + ":",
|
|
||||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true)
|
|
||||||
},
|
},
|
||||||
valueText = new OsuSpriteText
|
valueText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Text = "0",
|
Text = "0",
|
||||||
Font = OsuFont.GetFont(size: 40, weight: FontWeight.Regular, italics: true),
|
Font = OsuFont.GetFont(size: 40, weight: FontWeight.Light),
|
||||||
UseFullGlyphHeight = false,
|
UseFullGlyphHeight = false,
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 19))
|
DescriptionText = new LinkFlowContainer(t => t.Font = t.Font.With(size: 14))
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Text = description
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
lineBackground.Colour = colours.Yellow;
|
||||||
|
DescriptionText.Colour = colours.GreySeafoamLighter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user