mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 06:52:53 +08:00
Made the style a bit better, fixed a bug or two
This commit is contained in:
parent
2d270a1cfe
commit
3f336b8e61
@ -81,17 +81,18 @@ namespace osu.Game.Graphics.Sprites
|
|||||||
if (firstPath == "chan/")
|
if (firstPath == "chan/")
|
||||||
{
|
{
|
||||||
var nextSlashIndex = url.IndexOf('/');
|
var nextSlashIndex = url.IndexOf('/');
|
||||||
var channelName = url.Substring(0, nextSlashIndex != -1 ? nextSlashIndex - 1 : url.Length - 1);
|
var channelName = nextSlashIndex != -1 ? url.Remove(nextSlashIndex) : url;
|
||||||
|
|
||||||
var foundChannel = chat.AvailableChannels.Find(channel => channel.Name == channelName);
|
var foundChannel = chat.AvailableChannels.Find(channel => channel.Name == channelName);
|
||||||
|
|
||||||
if (foundChannel != null)
|
if (foundChannel != null)
|
||||||
chat.OpenChannel(foundChannel);
|
content.Action = () => chat.OpenChannel(foundChannel);
|
||||||
}
|
}
|
||||||
else if (firstPath == "edit/")
|
else if (firstPath == "edit/")
|
||||||
{
|
{
|
||||||
// Open editor here, then goto specified time
|
// Open editor here, then goto specified time
|
||||||
// how to push new screen from here? we'll see
|
// how to push new screen from here? we'll see
|
||||||
|
content.Action = () => new Framework.Screens.Screen().Push(new Screens.Edit.Editor());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new ArgumentException($"Unknown osu:// link at {nameof(OsuLinkSpriteText)} ({firstPath}).");
|
throw new ArgumentException($"Unknown osu:// link at {nameof(OsuLinkSpriteText)} ({firstPath}).");
|
||||||
@ -121,14 +122,14 @@ namespace osu.Game.Graphics.Sprites
|
|||||||
// Remove possible trailing slash
|
// Remove possible trailing slash
|
||||||
if (lastSlashIndex == url.Length)
|
if (lastSlashIndex == url.Length)
|
||||||
{
|
{
|
||||||
url = url.Substring(0, url.Length - 1);
|
url = url.Remove(url.Length - 1);
|
||||||
lastSlashIndex = url.LastIndexOf('/');
|
lastSlashIndex = url.LastIndexOf('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastQuestionMarkIndex = url.LastIndexOf('?');
|
var lastQuestionMarkIndex = url.LastIndexOf('?');
|
||||||
// Filter out possible queries like mode specifications (e.g. /b/252238?m=0)
|
// Filter out possible queries like mode specifications (e.g. /b/252238?m=0)
|
||||||
if (lastQuestionMarkIndex > lastSlashIndex)
|
if (lastQuestionMarkIndex > lastSlashIndex)
|
||||||
url = url.Substring(0, lastQuestionMarkIndex);
|
url = url.Remove(lastQuestionMarkIndex);
|
||||||
|
|
||||||
return int.Parse(url.Substring(lastSlashIndex + 1));
|
return int.Parse(url.Substring(lastSlashIndex + 1));
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,8 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
if (message.IsAction)
|
if (message.IsAction)
|
||||||
sprite.Font = @"Exo2.0-MediumItalic";
|
sprite.Font = @"Exo2.0-MediumItalic";
|
||||||
|
|
||||||
|
// TODO: Somehow check (if channel link) that this is a real channel
|
||||||
sprite.Colour = urlColour;
|
sprite.Colour = urlColour;
|
||||||
// We want to use something that is unique to every formatted link, so I just use the position of the link
|
// We want to use something that is unique to every formatted link, so I just use the position of the link
|
||||||
((ChatLinkSpriteText)sprite).LinkId = link.Index;
|
((ChatLinkSpriteText)sprite).LinkId = link.Index;
|
||||||
|
Loading…
Reference in New Issue
Block a user