1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Fix link formatting

This commit is contained in:
Andrei Zavatski 2019-07-14 19:38:46 +03:00
parent c8192d6f3a
commit b93b26a036
3 changed files with 20 additions and 12 deletions

View File

@ -1,7 +1,6 @@
// 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.Game.Beatmaps;
namespace osu.Game.Overlays.Profile.Sections
@ -15,15 +14,16 @@ namespace osu.Game.Overlays.Profile.Sections
this.beatmap = beatmap;
}
[BackgroundDependencyLoader(true)]
private void load(BeatmapSetOverlay beatmapSetOverlay)
protected override void LoadComplete()
{
base.LoadComplete();
ClickAction = () =>
{
if (beatmap.OnlineBeatmapID != null)
beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value);
else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null)
beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value);
var beatmapId = beatmap.OnlineBeatmapID;
if (beatmapId.HasValue)
Game?.ShowBeatmap(beatmapId.Value);
};
}
}

View File

@ -1,6 +1,7 @@
// 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.Graphics.Shapes;
@ -17,6 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections
private readonly Container underscore;
private readonly FillFlowContainer<OsuSpriteText> textContent;
protected OsuGame Game;
protected Action ClickAction;
public IReadOnlyList<OsuSpriteText> Text
@ -59,6 +62,12 @@ namespace osu.Game.Overlays.Profile.Sections
};
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame game)
{
Game = game;
}
protected override bool OnHover(HoverEvent e)
{
underscore.FadeIn(duration, Easing.OutQuint);

View File

@ -1,8 +1,6 @@
// 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;
namespace osu.Game.Overlays.Profile.Sections
{
public class UnderscoredUserLink : UnderscoredLinkContainer
@ -14,10 +12,11 @@ namespace osu.Game.Overlays.Profile.Sections
this.userId = userId;
}
[BackgroundDependencyLoader(true)]
private void load(UserProfileOverlay userProfileOverlay)
protected override void LoadComplete()
{
ClickAction = () => userProfileOverlay?.ShowUser(userId);
base.LoadComplete();
ClickAction = () => Game?.ShowUser(userId);
}
}
}