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. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
@ -15,15 +14,16 @@ namespace osu.Game.Overlays.Profile.Sections
this.beatmap = beatmap; this.beatmap = beatmap;
} }
[BackgroundDependencyLoader(true)] protected override void LoadComplete()
private void load(BeatmapSetOverlay beatmapSetOverlay)
{ {
base.LoadComplete();
ClickAction = () => ClickAction = () =>
{ {
if (beatmap.OnlineBeatmapID != null) var beatmapId = beatmap.OnlineBeatmapID;
beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value);
else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) if (beatmapId.HasValue)
beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); Game?.ShowBeatmap(beatmapId.Value);
}; };
} }
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -17,6 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections
private readonly Container underscore; private readonly Container underscore;
private readonly FillFlowContainer<OsuSpriteText> textContent; private readonly FillFlowContainer<OsuSpriteText> textContent;
protected OsuGame Game;
protected Action ClickAction; protected Action ClickAction;
public IReadOnlyList<OsuSpriteText> Text 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) protected override bool OnHover(HoverEvent e)
{ {
underscore.FadeIn(duration, Easing.OutQuint); underscore.FadeIn(duration, Easing.OutQuint);

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
{ {
public class UnderscoredUserLink : UnderscoredLinkContainer public class UnderscoredUserLink : UnderscoredLinkContainer
@ -14,10 +12,11 @@ namespace osu.Game.Overlays.Profile.Sections
this.userId = userId; this.userId = userId;
} }
[BackgroundDependencyLoader(true)] protected override void LoadComplete()
private void load(UserProfileOverlay userProfileOverlay)
{ {
ClickAction = () => userProfileOverlay?.ShowUser(userId); base.LoadComplete();
ClickAction = () => Game?.ShowUser(userId);
} }
} }
} }