1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 16:03:01 +08:00

Renamed ChatLinkSpriteText to ChatLink for convenience

This commit is contained in:
FreezyLemon 2017-12-07 10:28:12 +01:00
parent 7bf25bdd4d
commit 541c25e995
3 changed files with 9 additions and 9 deletions

View File

@ -12,7 +12,7 @@ using System.Linq;
namespace osu.Game.Online.Chat namespace osu.Game.Online.Chat
{ {
public class ChatLinkSpriteText : OsuLinkSpriteText public class ChatLink : OsuLinkSpriteText
{ {
public int LinkId = -1; public int LinkId = -1;
@ -22,12 +22,12 @@ namespace osu.Game.Online.Chat
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
{ {
// Every word is one sprite in chat (for word wrap) so we need to find all other sprites that display the same link // Every word is one sprite in chat (for word wrap) so we need to find all other sprites that display the same link
var otherSpritesWithSameLink = ((Container<Drawable>)Parent).Children.Where(child => (child as ChatLinkSpriteText)?.LinkId == LinkId && !Equals(child)); var otherSpritesWithSameLink = ((Container<Drawable>)Parent).Children.Where(child => (child as ChatLink)?.LinkId == LinkId && !Equals(child));
var hoverResult = base.OnHover(state); var hoverResult = base.OnHover(state);
if (!otherSpritesWithSameLink.Any(sprite => sprite.IsHovered)) if (!otherSpritesWithSameLink.Any(sprite => sprite.IsHovered))
foreach (ChatLinkSpriteText sprite in otherSpritesWithSameLink) foreach (ChatLink sprite in otherSpritesWithSameLink)
sprite.TriggerOnHover(state); sprite.TriggerOnHover(state);
Content.FadeColour(hoverColour, 500, Easing.OutQuint); Content.FadeColour(hoverColour, 500, Easing.OutQuint);
@ -37,7 +37,7 @@ namespace osu.Game.Online.Chat
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(InputState state)
{ {
var spritesWithSameLink = ((Container<Drawable>)Parent).Children.Where(child => (child as ChatLinkSpriteText)?.LinkId == LinkId); var spritesWithSameLink = ((Container<Drawable>)Parent).Children.Where(child => (child as ChatLink)?.LinkId == LinkId);
if (spritesWithSameLink.Any(sprite => sprite.IsHovered)) if (spritesWithSameLink.Any(sprite => sprite.IsHovered))
{ {
@ -46,7 +46,7 @@ namespace osu.Game.Online.Chat
return; return;
} }
foreach (ChatLinkSpriteText sprite in spritesWithSameLink) foreach (ChatLink sprite in spritesWithSameLink)
sprite.Content.FadeColour(urlColour, 500, Easing.OutQuint); sprite.Content.FadeColour(urlColour, 500, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(state);

View File

@ -83,7 +83,7 @@ namespace osu.Game.Overlays.Chat
private Message message; private Message message;
private OsuSpriteText username; private OsuSpriteText username;
private OsuLinkTextFlowContainer<ChatLinkSpriteText> contentFlow; private OsuLinkTextFlowContainer<ChatLink> contentFlow;
public Message Message public Message Message
{ {
@ -189,7 +189,7 @@ namespace osu.Game.Overlays.Chat
Padding = new MarginPadding { Left = message_padding + padding }, Padding = new MarginPadding { Left = message_padding + padding },
Children = new Drawable[] Children = new Drawable[]
{ {
contentFlow = new OsuLinkTextFlowContainer<ChatLinkSpriteText>(t => { t.TextSize = text_size; }) contentFlow = new OsuLinkTextFlowContainer<ChatLink>(t => { t.TextSize = text_size; })
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -238,7 +238,7 @@ namespace osu.Game.Overlays.Chat
sprite.Font = @"Exo2.0-MediumItalic"; sprite.Font = @"Exo2.0-MediumItalic";
// We want to use something that is unique to every formatted link PER MESSAGE // We want to use something that is unique to every formatted link PER MESSAGE
((ChatLinkSpriteText)sprite).LinkId = link.Index; ((ChatLink)sprite).LinkId = link.Index;
}); });
} }

View File

@ -289,7 +289,7 @@
<Compile Include="Online\API\Requests\GetBeatmapRequest.cs" /> <Compile Include="Online\API\Requests\GetBeatmapRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" />
<Compile Include="Online\Chat\ChatLinkSpriteText.cs" /> <Compile Include="Online\Chat\ChatLink.cs" />
<Compile Include="Online\Chat\MessageFormatter.cs" /> <Compile Include="Online\Chat\MessageFormatter.cs" />
<Compile Include="Overlays\BeatmapSet\Scores\ClickableUsername.cs" /> <Compile Include="Overlays\BeatmapSet\Scores\ClickableUsername.cs" />
<Compile Include="Overlays\BeatmapSet\Scores\DrawableScore.cs" /> <Compile Include="Overlays\BeatmapSet\Scores\DrawableScore.cs" />