Revert "Add marker interface for beatmap skins"

This commit is contained in:
Craftplacer 2020-08-31 18:29:46 +02:00 committed by GitHub
parent db7497538b
commit 9b3a48ee5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 19 additions and 48 deletions

View File

@ -110,7 +110,7 @@ public CustomSkinWorkingBeatmap(AudioManager audio, bool hasColours)
this.hasColours = hasColours;
}
protected override IBeatmapSkin GetSkin() => new TestBeatmapSkin(BeatmapInfo, hasColours);
protected override ISkin GetSkin() => new TestBeatmapSkin(BeatmapInfo, hasColours);
}
private class TestBeatmapSkin : LegacyBeatmapSkin

View File

@ -29,12 +29,12 @@ namespace osu.Game.Rulesets.Osu.Tests
public class TestSceneSkinFallbacks : TestSceneOsuPlayer
{
private readonly TestSource testUserSkin;
private readonly BeatmapTestSource testBeatmapSkin;
private readonly TestSource testBeatmapSkin;
public TestSceneSkinFallbacks()
{
testUserSkin = new TestSource("user");
testBeatmapSkin = new BeatmapTestSource();
testBeatmapSkin = new TestSource("beatmap");
}
[Test]
@ -80,15 +80,15 @@ private void checkNextHitObject(string skin) =>
public class CustomSkinWorkingBeatmap : ClockBackedTestWorkingBeatmap
{
private readonly IBeatmapSkin skin;
private readonly ISkinSource skin;
public CustomSkinWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock frameBasedClock, AudioManager audio, IBeatmapSkin skin)
public CustomSkinWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock frameBasedClock, AudioManager audio, ISkinSource skin)
: base(beatmap, storyboard, frameBasedClock, audio)
{
this.skin = skin;
}
protected override IBeatmapSkin GetSkin() => skin;
protected override ISkin GetSkin() => skin;
}
public class SkinProvidingPlayer : TestPlayer
@ -112,14 +112,6 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
}
}
private class BeatmapTestSource : TestSource, IBeatmapSkin
{
public BeatmapTestSource()
: base("beatmap")
{
}
}
public class TestSource : ISkinSource
{
private readonly string identifier;

View File

@ -116,7 +116,7 @@ public void TestSamplePlaybackWithRateMods(Type expectedMod, double expectedRate
AddAssert("sample playback rate matches mod rates", () => sample.Channel.AggregateFrequency.Value == expectedRate);
}
private class TestSkin : LegacySkin, IBeatmapSkin
private class TestSkin : LegacySkin
{
public TestSkin(string resourceName, AudioManager audioManager)
: base(DefaultLegacySkin.Info, new TestResourceStore(resourceName), audioManager, "skin.ini")
@ -156,7 +156,7 @@ public TestCustomSkinWorkingBeatmap(RulesetInfo ruleset, AudioManager audio)
this.audio = audio;
}
protected override IBeatmapSkin GetSkin() => new TestSkin("test-sample", audio);
protected override ISkin GetSkin() => new TestSkin("test-sample", audio);
}
private class TestDrawableStoryboardSample : DrawableStoryboardSample

View File

@ -140,7 +140,7 @@ protected override Storyboard GetStoryboard()
return storyboard;
}
protected override IBeatmapSkin GetSkin()
protected override ISkin GetSkin()
{
try
{

View File

@ -42,9 +42,9 @@ public interface IWorkingBeatmap
Storyboard Storyboard { get; }
/// <summary>
/// Retrieves the <see cref="IBeatmapSkin"/> which this <see cref="WorkingBeatmap"/> provides.
/// Retrieves the <see cref="Skin"/> which this <see cref="WorkingBeatmap"/> provides.
/// </summary>
IBeatmapSkin Skin { get; }
ISkin Skin { get; }
/// <summary>
/// Constructs a playable <see cref="IBeatmap"/> from <see cref="Beatmap"/> using the applicable converters for a specific <see cref="RulesetInfo"/>.

View File

@ -44,7 +44,7 @@ protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
waveform = new RecyclableLazy<Waveform>(GetWaveform);
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
skin = new RecyclableLazy<IBeatmapSkin>(GetSkin);
skin = new RecyclableLazy<ISkin>(GetSkin);
total_count.Value++;
}
@ -275,10 +275,10 @@ public IBeatmap Beatmap
private readonly RecyclableLazy<Storyboard> storyboard;
public bool SkinLoaded => skin.IsResultAvailable;
public IBeatmapSkin Skin => skin.Value;
public ISkin Skin => skin.Value;
protected virtual IBeatmapSkin GetSkin() => new DefaultBeatmapSkin();
private readonly RecyclableLazy<IBeatmapSkin> skin;
protected virtual ISkin GetSkin() => new DefaultSkin();
private readonly RecyclableLazy<ISkin> skin;
/// <summary>
/// Transfer pieces of a beatmap to a new one, where possible, to save on loading.

View File

@ -11,7 +11,7 @@ namespace osu.Game.Skinning
/// <summary>
/// A container which overrides existing skin options with beatmap-local values.
/// </summary>
public class BeatmapSkinProvidingContainer : SkinProvidingContainer, IBeatmapSkin
public class BeatmapSkinProvidingContainer : SkinProvidingContainer
{
private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
private readonly Bindable<bool> beatmapHitsounds = new Bindable<bool>();
@ -21,7 +21,7 @@ public class BeatmapSkinProvidingContainer : SkinProvidingContainer, IBeatmapSki
protected override bool AllowTextureLookup(string componentName) => beatmapSkins.Value;
protected override bool AllowSampleLookup(ISampleInfo componentName) => beatmapHitsounds.Value;
public BeatmapSkinProvidingContainer(IBeatmapSkin skin)
public BeatmapSkinProvidingContainer(ISkin skin)
: base(skin)
{
}

View File

@ -1,9 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Skinning
{
public class DefaultBeatmapSkin : DefaultSkin, IBeatmapSkin
{
}
}

View File

@ -1,12 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Skinning
{
/// <summary>
/// Marker interface for skins that originate from beatmaps.
/// </summary>
public interface IBeatmapSkin : ISkin
{
}
}

View File

@ -11,7 +11,7 @@
namespace osu.Game.Skinning
{
public class LegacyBeatmapSkin : LegacySkin, IBeatmapSkin
public class LegacyBeatmapSkin : LegacySkin
{
protected override bool AllowManiaSkin => false;
protected override bool UseCustomSampleBanks => true;

View File

@ -188,7 +188,7 @@ public TestWorkingBeatmap(BeatmapInfo skinBeatmapInfo, IResourceStore<byte[]> re
this.resourceStore = resourceStore;
}
protected override IBeatmapSkin GetSkin() => new LegacyBeatmapSkin(skinBeatmapInfo, resourceStore, AudioManager);
protected override ISkin GetSkin() => new LegacyBeatmapSkin(skinBeatmapInfo, resourceStore, AudioManager);
}
}
}