1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 05:57:29 +08:00
osu-lazer/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs

63 lines
1.6 KiB
C#
Raw Normal View History

2017-11-11 11:54:52 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using osu.Framework.Input;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
public class ClickableUsername : OsuHoverContainer
{
private readonly OsuSpriteText text;
private UserProfileOverlay profile;
private User user;
public User User
{
2017-11-15 15:21:07 +08:00
get { return user; }
2017-11-11 11:54:52 +08:00
set
{
if (user == value) return;
user = value;
text.Text = user.Username;
}
}
public float TextSize
{
set
{
if (text.TextSize == value) return;
text.TextSize = value;
}
get { return text.TextSize; }
}
public ClickableUsername()
{
AutoSizeAxes = Axes.Both;
Child = text = new OsuSpriteText
{
Font = @"Exo2.0-BoldItalic",
};
}
2017-11-11 12:50:40 +08:00
[BackgroundDependencyLoader(true)]
2017-11-11 11:54:52 +08:00
private void load(UserProfileOverlay profile)
{
this.profile = profile;
}
protected override bool OnClick(InputState state)
{
profile?.ShowUser(user);
2017-11-15 15:21:07 +08:00
return true;
2017-11-11 11:54:52 +08:00
}
}
}