1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 23:02:56 +08:00
osu-lazer/osu.Game/Overlays/BeatmapSet/Scores/ClickableUserContainer.cs

52 lines
1.2 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2019-02-06 00:32:33 +08:00
using osu.Framework.Graphics.Containers;
2018-10-02 11:02:47 +08:00
using osu.Framework.Input.Events;
2018-04-13 17:19:50 +08:00
using osu.Game.Users;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
2019-02-06 00:32:33 +08:00
public abstract class ClickableUserContainer : Container
2018-04-13 17:19:50 +08:00
{
private UserProfileOverlay profile;
2019-04-03 14:20:38 +08:00
protected ClickableUserContainer()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader(true)]
private void load(UserProfileOverlay profile)
{
this.profile = profile;
}
2018-04-13 17:19:50 +08:00
private User user;
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
public User User
{
get => user;
2018-04-13 17:19:50 +08:00
set
{
2019-04-03 14:20:38 +08:00
if (user == value)
return;
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
user = value;
2019-04-03 14:20:38 +08:00
OnUserChanged(user);
2018-04-13 17:19:50 +08:00
}
}
2019-04-03 14:20:38 +08:00
protected abstract void OnUserChanged(User user);
2018-04-13 17:19:50 +08:00
2018-10-02 11:02:47 +08:00
protected override bool OnClick(ClickEvent e)
2018-04-13 17:19:50 +08:00
{
profile?.ShowUser(user);
return true;
}
}
}