osukey/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs
smoogipoo 30c6a7c3c5 Merge remote-tracking branch 'nekodex/master' into update-beatmap-scores-design
# Conflicts:
#	osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs
#	osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs
#	osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs
#	osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
2019-03-07 18:48:23 +09:00

52 lines
1.2 KiB
C#

// 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;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Users;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
public abstract class ClickableUserContainer : Container
{
private UserProfileOverlay profile;
private User user;
public User User
{
get => user;
set
{
if (user == value) return;
user = value;
OnUserChange(user);
}
}
protected ClickableUserContainer()
{
AutoSizeAxes = Axes.Both;
}
protected abstract void OnUserChange(User user);
[BackgroundDependencyLoader(true)]
private void load(UserProfileOverlay profile)
{
this.profile = profile;
}
protected override bool OnClick(ClickEvent e)
{
profile?.ShowUser(user);
return true;
}
}
}