1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Revert some changes + simplify BeatmapNotAvailable

This commit is contained in:
KingLuigi4932 2019-06-19 01:43:28 +03:00
parent 5278c5f365
commit a0609f28d7
2 changed files with 27 additions and 35 deletions

View File

@ -473,9 +473,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
new BeatmapInfo
@ -500,9 +499,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
new BeatmapInfo
@ -527,9 +525,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
new BeatmapInfo
@ -554,9 +551,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
},
@ -623,9 +619,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
new BeatmapInfo
@ -650,9 +645,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
new BeatmapInfo
@ -677,9 +671,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
new BeatmapInfo
@ -704,9 +697,8 @@ namespace osu.Game.Tests.Visual.Online
},
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 11),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
},
},

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
@ -25,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet
beatmapSet = value;
removeLinks();
link?.Clear();
if (beatmapSet?.OnlineInfo.Availability != null)
Show();
@ -34,9 +35,11 @@ namespace osu.Game.Overlays.BeatmapSet
}
}
private readonly OsuTextFlowContainer text;
private readonly OsuSpriteText text;
private readonly LinkFlowContainer link;
private BeatmapSetOnlineAvailability availability => BeatmapSet?.OnlineInfo.Availability;
public BeatmapNotAvailable()
{
RelativeSizeAxes = Axes.X;
@ -56,14 +59,14 @@ namespace osu.Game.Overlays.BeatmapSet
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 10, Left = 5, Right = 20 },
Children = new Drawable[]
{
text = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium))
text = new OsuSpriteText
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
AllowMultiline = true,
Margin = new MarginPadding { Bottom = 10, Horizontal = 5 },
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium),
Colour = Color4.Orange,
},
link = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14))
@ -76,21 +79,18 @@ namespace osu.Game.Overlays.BeatmapSet
},
},
};
Hide();
}
public override void Show()
{
text.Text = BeatmapSet.OnlineInfo.Availability.DownloadDisabled
text.Text = availability.DownloadDisabled
? "This beatmap is currently not available for download."
: "Portions of this beatmap have been removed at the request of the creator or a third-party rights holder.";
link.AddLink("Check here for more information.", BeatmapSet.OnlineInfo.Availability.ExternalLink);
if (!string.IsNullOrEmpty(availability.ExternalLink))
link.AddLink("Check here for more information.", availability.ExternalLink);
base.Show();
}
private void removeLinks() => link?.RemoveAll(x => true);
}
}