mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Rename usages which rely on online backing
This commit is contained in:
parent
0706ad70fb
commit
32d01f022f
@ -23,21 +23,21 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestLocal([Values] BeatmapSetCoverType coverType)
|
public void TestLocal([Values] BeatmapSetCoverType coverType)
|
||||||
{
|
{
|
||||||
AddStep("setup cover", () => Child = new UpdateableBeatmapSetCover(coverType)
|
AddStep("setup cover", () => Child = new UpdateableOnlineBeatmapSetCover(coverType)
|
||||||
{
|
{
|
||||||
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
|
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => this.ChildrenOfType<BeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
|
AddUntilStep("wait for load", () => this.ChildrenOfType<OnlineBeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestUnloadAndReload()
|
public void TestUnloadAndReload()
|
||||||
{
|
{
|
||||||
OsuScrollContainer scroll = null;
|
OsuScrollContainer scroll = null;
|
||||||
List<UpdateableBeatmapSetCover> covers = new List<UpdateableBeatmapSetCover>();
|
List<UpdateableOnlineBeatmapSetCover> covers = new List<UpdateableOnlineBeatmapSetCover>();
|
||||||
|
|
||||||
AddStep("setup covers", () =>
|
AddStep("setup covers", () =>
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
var coverType = coverTypes[i % coverTypes.Count];
|
var coverType = coverTypes[i % coverTypes.Count];
|
||||||
|
|
||||||
var cover = new UpdateableBeatmapSetCover(coverType)
|
var cover = new UpdateableOnlineBeatmapSetCover(coverType)
|
||||||
{
|
{
|
||||||
BeatmapSet = setInfo,
|
BeatmapSet = setInfo,
|
||||||
Height = 100,
|
Height = 100,
|
||||||
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var loadedCovers = covers.Where(c => c.ChildrenOfType<BeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
|
var loadedCovers = covers.Where(c => c.ChildrenOfType<OnlineBeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
|
||||||
|
|
||||||
AddUntilStep("some loaded", () => loadedCovers.Any());
|
AddUntilStep("some loaded", () => loadedCovers.Any());
|
||||||
AddStep("scroll to end", () => scroll.ScrollToEnd());
|
AddStep("scroll to end", () => scroll.ScrollToEnd());
|
||||||
@ -95,9 +95,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestSetNullBeatmapWhileLoading()
|
public void TestSetNullBeatmapWhileLoading()
|
||||||
{
|
{
|
||||||
TestUpdateableBeatmapSetCover updateableCover = null;
|
TestUpdateableOnlineBeatmapSetCover updateableCover = null;
|
||||||
|
|
||||||
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableBeatmapSetCover
|
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
|
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -112,10 +112,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestCoverChangeOnNewBeatmap()
|
public void TestCoverChangeOnNewBeatmap()
|
||||||
{
|
{
|
||||||
TestUpdateableBeatmapSetCover updateableCover = null;
|
TestUpdateableOnlineBeatmapSetCover updateableCover = null;
|
||||||
BeatmapSetCover initialCover = null;
|
OnlineBeatmapSetCover initialCover = null;
|
||||||
|
|
||||||
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableBeatmapSetCover(0)
|
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover(0)
|
||||||
{
|
{
|
||||||
BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1189904/covers/cover.jpg"),
|
BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1189904/covers/cover.jpg"),
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -123,13 +123,13 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Alpha = 0.4f
|
Alpha = 0.4f
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("cover loaded", () => updateableCover.ChildrenOfType<BeatmapSetCover>().Any());
|
AddUntilStep("cover loaded", () => updateableCover.ChildrenOfType<OnlineBeatmapSetCover>().Any());
|
||||||
AddStep("store initial cover", () => initialCover = updateableCover.ChildrenOfType<BeatmapSetCover>().Single());
|
AddStep("store initial cover", () => initialCover = updateableCover.ChildrenOfType<OnlineBeatmapSetCover>().Single());
|
||||||
AddUntilStep("wait for fade complete", () => initialCover.Alpha == 1);
|
AddUntilStep("wait for fade complete", () => initialCover.Alpha == 1);
|
||||||
|
|
||||||
AddStep("switch beatmap",
|
AddStep("switch beatmap",
|
||||||
() => updateableCover.BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1079428/covers/cover.jpg"));
|
() => updateableCover.BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1079428/covers/cover.jpg"));
|
||||||
AddUntilStep("new cover loaded", () => updateableCover.ChildrenOfType<BeatmapSetCover>().Except(new[] { initialCover }).Any());
|
AddUntilStep("new cover loaded", () => updateableCover.ChildrenOfType<OnlineBeatmapSetCover>().Except(new[] { initialCover }).Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BeatmapSetInfo createBeatmapWithCover(string coverUrl) => new BeatmapSetInfo
|
private static BeatmapSetInfo createBeatmapWithCover(string coverUrl) => new BeatmapSetInfo
|
||||||
@ -140,11 +140,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private class TestUpdateableBeatmapSetCover : UpdateableBeatmapSetCover
|
private class TestUpdateableOnlineBeatmapSetCover : UpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
private readonly int loadDelay;
|
private readonly int loadDelay;
|
||||||
|
|
||||||
public TestUpdateableBeatmapSetCover(int loadDelay = 10000)
|
public TestUpdateableOnlineBeatmapSetCover(int loadDelay = 10000)
|
||||||
{
|
{
|
||||||
this.loadDelay = loadDelay;
|
this.loadDelay = loadDelay;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
if (model == null)
|
if (model == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new TestBeatmapSetCover(model, loadDelay)
|
return new TestOnlineBeatmapSetCover(model, loadDelay)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -164,11 +164,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestBeatmapSetCover : BeatmapSetCover
|
private class TestOnlineBeatmapSetCover : OnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
private readonly int loadDelay;
|
private readonly int loadDelay;
|
||||||
|
|
||||||
public TestBeatmapSetCover(IBeatmapSetOnlineInfo set, int loadDelay)
|
public TestOnlineBeatmapSetCover(IBeatmapSetOnlineInfo set, int loadDelay)
|
||||||
: base(set)
|
: base(set)
|
||||||
{
|
{
|
||||||
this.loadDelay = loadDelay;
|
this.loadDelay = loadDelay;
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
new UpdateableBeatmapSetCover
|
new UpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.Gray(0.5f),
|
Colour = OsuColour.Gray(0.5f),
|
||||||
|
@ -9,12 +9,12 @@ using osu.Framework.Graphics.Textures;
|
|||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
[LongRunningLoad]
|
[LongRunningLoad]
|
||||||
public class BeatmapSetCover : Sprite
|
public class OnlineBeatmapSetCover : Sprite
|
||||||
{
|
{
|
||||||
private readonly IBeatmapSetOnlineInfo set;
|
private readonly IBeatmapSetOnlineInfo set;
|
||||||
private readonly BeatmapSetCoverType type;
|
private readonly BeatmapSetCoverType type;
|
||||||
|
|
||||||
public BeatmapSetCover(IBeatmapSetOnlineInfo set, BeatmapSetCoverType type = BeatmapSetCoverType.Cover)
|
public OnlineBeatmapSetCover(IBeatmapSetOnlineInfo set, BeatmapSetCoverType type = BeatmapSetCoverType.Cover)
|
||||||
{
|
{
|
||||||
if (set == null)
|
if (set == null)
|
||||||
throw new ArgumentNullException(nameof(set));
|
throw new ArgumentNullException(nameof(set));
|
@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
// prefer online cover where available.
|
// prefer online cover where available.
|
||||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||||
return new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
return new OnlineBeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||||
|
|
||||||
return model?.ID > 0
|
return model?.ID > 0
|
||||||
? new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model))
|
? new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model))
|
||||||
|
@ -9,7 +9,7 @@ using osu.Game.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
public class UpdateableBeatmapSetCover : ModelBackedDrawable<IBeatmapSetOnlineInfo>
|
public class UpdateableOnlineBeatmapSetCover : ModelBackedDrawable<IBeatmapSetOnlineInfo>
|
||||||
{
|
{
|
||||||
private readonly BeatmapSetCoverType coverType;
|
private readonly BeatmapSetCoverType coverType;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
set => base.Masking = value;
|
set => base.Masking = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateableBeatmapSetCover(BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover)
|
public UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover)
|
||||||
{
|
{
|
||||||
this.coverType = coverType;
|
this.coverType = coverType;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
if (model == null)
|
if (model == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new BeatmapSetCover(model, coverType)
|
return new OnlineBeatmapSetCover(model, coverType)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
@ -76,7 +76,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
private readonly BeatmapSearchFilterRow<SearchExplicit> explicitContentFilter;
|
private readonly BeatmapSearchFilterRow<SearchExplicit> explicitContentFilter;
|
||||||
|
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly UpdateableBeatmapSetCover beatmapCover;
|
private readonly UpdateableOnlineBeatmapSetCover beatmapCover;
|
||||||
|
|
||||||
public BeatmapListingSearchControl()
|
public BeatmapListingSearchControl()
|
||||||
{
|
{
|
||||||
@ -196,7 +196,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TopSearchBeatmapSetCover : UpdateableBeatmapSetCover
|
private class TopSearchBeatmapSetCover : UpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
protected override bool TransformImmediately => true;
|
protected override bool TransformImmediately => true;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
return icons;
|
return icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Drawable CreateBackground() => new UpdateableBeatmapSetCover
|
protected Drawable CreateBackground() => new UpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
BeatmapSet = SetInfo,
|
BeatmapSet = SetInfo,
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
public readonly Details Details;
|
public readonly Details Details;
|
||||||
public readonly BeatmapPicker Picker;
|
public readonly BeatmapPicker Picker;
|
||||||
|
|
||||||
private readonly UpdateableBeatmapSetCover cover;
|
private readonly UpdateableOnlineBeatmapSetCover cover;
|
||||||
private readonly Box coverGradient;
|
private readonly Box coverGradient;
|
||||||
private readonly OsuSpriteText title, artist;
|
private readonly OsuSpriteText title, artist;
|
||||||
private readonly AuthorInfo author;
|
private readonly AuthorInfo author;
|
||||||
@ -68,7 +68,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
cover = new UpdateableBeatmapSetCover
|
cover = new UpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Dashboard.Home
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = 6,
|
CornerRadius = 6,
|
||||||
Child = new UpdateableBeatmapSetCover
|
Child = new UpdateableOnlineBeatmapSetCover
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new UpdateableBeatmapSetCover(BeatmapSetCoverType.List)
|
new UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType.List)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = cover_width,
|
Width = cover_width,
|
||||||
|
Loading…
Reference in New Issue
Block a user