1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 11:42:54 +08:00

add and handle OpenWiki link action

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-05-17 00:43:59 +07:00
parent 463774d4f2
commit f2de28814a
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2
2 changed files with 15 additions and 1 deletions

View File

@ -167,6 +167,9 @@ namespace osu.Game.Online.Chat
case "u":
case "users":
return new LinkDetails(LinkAction.OpenUserProfile, mainArg);
case "wiki":
return new LinkDetails(LinkAction.OpenWiki, string.Join('/', args.Skip(3)));
}
}
@ -311,7 +314,8 @@ namespace osu.Game.Online.Chat
JoinMultiplayerMatch,
Spectate,
OpenUserProfile,
Custom
OpenWiki,
Custom,
}
public class Link : IComparable<Link>

View File

@ -309,6 +309,10 @@ namespace osu.Game
ShowUser(userId);
break;
case LinkAction.OpenWiki:
ShowWiki(link.Argument);
break;
default:
throw new NotImplementedException($"This {nameof(LinkAction)} ({link.Action.ToString()}) is missing an associated action.");
}
@ -356,6 +360,12 @@ namespace osu.Game
/// <param name="beatmapId">The beatmap to show.</param>
public void ShowBeatmap(int beatmapId) => waitForReady(() => beatmapSetOverlay, _ => beatmapSetOverlay.FetchAndShowBeatmap(beatmapId));
/// <summary>
/// Show a wiki's page as an overlay
/// </summary>
/// <param name="path">The wiki page to show</param>
public void ShowWiki(string path) => waitForReady(() => wikiOverlay, _ => wikiOverlay.ShowPage(path));
/// <summary>
/// Present a beatmap at song select immediately.
/// The user should have already requested this interactively.