mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add word wrap support
This commit is contained in:
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -17,6 +19,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Description("PlaySongSelect leaderboard")]
|
[Description("PlaySongSelect leaderboard")]
|
||||||
public class TestCaseLeaderboard : OsuTestCase
|
public class TestCaseLeaderboard : OsuTestCase
|
||||||
{
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[] {
|
||||||
|
typeof(Placeholder),
|
||||||
|
typeof(MessagePlaceholder),
|
||||||
|
typeof(RetrievalFailurePlaceholder),
|
||||||
|
};
|
||||||
|
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly FailableLeaderboard leaderboard;
|
private readonly FailableLeaderboard leaderboard;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -16,6 +17,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override SpriteText CreateSpriteText() => new OsuSpriteText();
|
protected override SpriteText CreateSpriteText() => new OsuSpriteText();
|
||||||
|
|
||||||
|
public void AddArbitraryDrawable(Drawable drawable) => AddInternal(drawable);
|
||||||
|
|
||||||
public void AddIcon(FontAwesome icon, Action<SpriteText> creationParameters = null) => AddText(((char)icon).ToString(), creationParameters);
|
public void AddIcon(FontAwesome icon, Action<SpriteText> creationParameters = null) => AddText(((char)icon).ToString(), creationParameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,23 +331,4 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum LeaderboardScope
|
|
||||||
{
|
|
||||||
Local,
|
|
||||||
Country,
|
|
||||||
Global,
|
|
||||||
Friend,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum PlaceholderState
|
|
||||||
{
|
|
||||||
Successful,
|
|
||||||
Retrieving,
|
|
||||||
NetworkFailure,
|
|
||||||
Unavailable,
|
|
||||||
NoScores,
|
|
||||||
NotLoggedIn,
|
|
||||||
NotSupporter,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
10
osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs
Normal file
10
osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
|
{
|
||||||
|
public enum LeaderboardScope
|
||||||
|
{
|
||||||
|
Local,
|
||||||
|
Country,
|
||||||
|
Global,
|
||||||
|
Friend,
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
{
|
{
|
||||||
@ -15,22 +12,13 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
public MessagePlaceholder(string message)
|
public MessagePlaceholder(string message)
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Horizontal;
|
AddIcon(FontAwesome.fa_exclamation_circle, cp =>
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new SpriteIcon
|
cp.TextSize = TEXT_SIZE;
|
||||||
{
|
cp.Padding = new MarginPadding { Right = 10 };
|
||||||
Icon = FontAwesome.fa_exclamation_circle,
|
});
|
||||||
Size = new Vector2(26),
|
|
||||||
Margin = new MarginPadding { Right = 10 },
|
AddText(this.message = message);
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = this.message = message,
|
|
||||||
TextSize = 22,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(Placeholder other) => (other as MessagePlaceholder)?.message == message;
|
public override bool Equals(Placeholder other) => (other as MessagePlaceholder)?.message == message;
|
||||||
|
@ -3,16 +3,27 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
{
|
{
|
||||||
public abstract class Placeholder : FillFlowContainer, IEquatable<Placeholder>
|
public abstract class Placeholder : OsuTextFlowContainer, IEquatable<Placeholder>
|
||||||
{
|
{
|
||||||
|
protected const float TEXT_SIZE = 22;
|
||||||
|
|
||||||
|
public override bool HandleMouseInput => true;
|
||||||
|
|
||||||
protected Placeholder()
|
protected Placeholder()
|
||||||
|
: base(cp => cp.TextSize = TEXT_SIZE)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
TextAnchor = Anchor.TopCentre;
|
||||||
|
|
||||||
|
Padding = new MarginPadding(20);
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Equals(Placeholder other) => GetType() == other?.GetType();
|
public virtual bool Equals(Placeholder other) => GetType() == other?.GetType();
|
||||||
|
13
osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs
Normal file
13
osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
|
{
|
||||||
|
public enum PlaceholderState
|
||||||
|
{
|
||||||
|
Successful,
|
||||||
|
Retrieving,
|
||||||
|
NetworkFailure,
|
||||||
|
Unavailable,
|
||||||
|
NoScores,
|
||||||
|
NotLoggedIn,
|
||||||
|
NotSupporter,
|
||||||
|
}
|
||||||
|
}
|
@ -3,11 +3,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
@ -18,22 +16,13 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
public RetrievalFailurePlaceholder()
|
public RetrievalFailurePlaceholder()
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Horizontal;
|
AddArbitraryDrawable(new RetryButton
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new RetryButton
|
|
||||||
{
|
{
|
||||||
Action = () => OnRetry?.Invoke(),
|
Action = () => OnRetry?.Invoke(),
|
||||||
Margin = new MarginPadding { Right = 10 },
|
Padding = new MarginPadding { Right = 10 }
|
||||||
},
|
});
|
||||||
new OsuSpriteText
|
|
||||||
{
|
AddText(@"Couldn't retrieve scores!");
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
Text = @"Couldn't retrieve scores!",
|
|
||||||
TextSize = 22,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RetryButton : OsuHoverContainer
|
public class RetryButton : OsuHoverContainer
|
||||||
@ -44,18 +33,16 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
public RetryButton()
|
public RetryButton()
|
||||||
{
|
{
|
||||||
Height = 26;
|
AutoSizeAxes = Axes.Both;
|
||||||
Width = 26;
|
|
||||||
Child = new OsuClickableContainer
|
Child = new OsuClickableContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Action = () => Action?.Invoke(),
|
Action = () => Action?.Invoke(),
|
||||||
Child = icon = new SpriteIcon
|
Child = icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_refresh,
|
Icon = FontAwesome.fa_refresh,
|
||||||
Size = new Vector2(26),
|
Size = new Vector2(TEXT_SIZE),
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user