1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 10:22:56 +08:00

Merge pull request #10023 from Craftplacer/revert-10003-beatmapskin-interface

Revert "Add marker interface for beatmap skins"
This commit is contained in:
Dan Balasescu 2020-09-01 14:26:49 +09:00 committed by GitHub
commit bb97e9632c
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 @@ namespace osu.Game.Rulesets.Osu.Tests
this.hasColours = hasColours; this.hasColours = hasColours;
} }
protected override IBeatmapSkin GetSkin() => new TestBeatmapSkin(BeatmapInfo, hasColours); protected override ISkin GetSkin() => new TestBeatmapSkin(BeatmapInfo, hasColours);
} }
private class TestBeatmapSkin : LegacyBeatmapSkin private class TestBeatmapSkin : LegacyBeatmapSkin

View File

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

View File

@ -116,7 +116,7 @@ namespace osu.Game.Tests.Gameplay
AddAssert("sample playback rate matches mod rates", () => sample.Channel.AggregateFrequency.Value == 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) public TestSkin(string resourceName, AudioManager audioManager)
: base(DefaultLegacySkin.Info, new TestResourceStore(resourceName), audioManager, "skin.ini") : base(DefaultLegacySkin.Info, new TestResourceStore(resourceName), audioManager, "skin.ini")
@ -156,7 +156,7 @@ namespace osu.Game.Tests.Gameplay
this.audio = 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 private class TestDrawableStoryboardSample : DrawableStoryboardSample

View File

@ -140,7 +140,7 @@ namespace osu.Game.Beatmaps
return storyboard; return storyboard;
} }
protected override IBeatmapSkin GetSkin() protected override ISkin GetSkin()
{ {
try try
{ {

View File

@ -42,9 +42,9 @@ namespace osu.Game.Beatmaps
Storyboard Storyboard { get; } Storyboard Storyboard { get; }
/// <summary> /// <summary>
/// Retrieves the <see cref="IBeatmapSkin"/> which this <see cref="WorkingBeatmap"/> provides. /// Retrieves the <see cref="Skin"/> which this <see cref="WorkingBeatmap"/> provides.
/// </summary> /// </summary>
IBeatmapSkin Skin { get; } ISkin Skin { get; }
/// <summary> /// <summary>
/// Constructs a playable <see cref="IBeatmap"/> from <see cref="Beatmap"/> using the applicable converters for a specific <see cref="RulesetInfo"/>. /// 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 @@ namespace osu.Game.Beatmaps
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid); background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
waveform = new RecyclableLazy<Waveform>(GetWaveform); waveform = new RecyclableLazy<Waveform>(GetWaveform);
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard); storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
skin = new RecyclableLazy<IBeatmapSkin>(GetSkin); skin = new RecyclableLazy<ISkin>(GetSkin);
total_count.Value++; total_count.Value++;
} }
@ -275,10 +275,10 @@ namespace osu.Game.Beatmaps
private readonly RecyclableLazy<Storyboard> storyboard; private readonly RecyclableLazy<Storyboard> storyboard;
public bool SkinLoaded => skin.IsResultAvailable; public bool SkinLoaded => skin.IsResultAvailable;
public IBeatmapSkin Skin => skin.Value; public ISkin Skin => skin.Value;
protected virtual IBeatmapSkin GetSkin() => new DefaultBeatmapSkin(); protected virtual ISkin GetSkin() => new DefaultSkin();
private readonly RecyclableLazy<IBeatmapSkin> skin; private readonly RecyclableLazy<ISkin> skin;
/// <summary> /// <summary>
/// Transfer pieces of a beatmap to a new one, where possible, to save on loading. /// 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> /// <summary>
/// A container which overrides existing skin options with beatmap-local values. /// A container which overrides existing skin options with beatmap-local values.
/// </summary> /// </summary>
public class BeatmapSkinProvidingContainer : SkinProvidingContainer, IBeatmapSkin public class BeatmapSkinProvidingContainer : SkinProvidingContainer
{ {
private readonly Bindable<bool> beatmapSkins = new Bindable<bool>(); private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
private readonly Bindable<bool> beatmapHitsounds = new Bindable<bool>(); private readonly Bindable<bool> beatmapHitsounds = new Bindable<bool>();
@ -21,7 +21,7 @@ namespace osu.Game.Skinning
protected override bool AllowTextureLookup(string componentName) => beatmapSkins.Value; protected override bool AllowTextureLookup(string componentName) => beatmapSkins.Value;
protected override bool AllowSampleLookup(ISampleInfo componentName) => beatmapHitsounds.Value; protected override bool AllowSampleLookup(ISampleInfo componentName) => beatmapHitsounds.Value;
public BeatmapSkinProvidingContainer(IBeatmapSkin skin) public BeatmapSkinProvidingContainer(ISkin skin)
: base(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 @@ using osu.Game.Rulesets.Objects.Legacy;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public class LegacyBeatmapSkin : LegacySkin, IBeatmapSkin public class LegacyBeatmapSkin : LegacySkin
{ {
protected override bool AllowManiaSkin => false; protected override bool AllowManiaSkin => false;
protected override bool UseCustomSampleBanks => true; protected override bool UseCustomSampleBanks => true;

View File

@ -188,7 +188,7 @@ namespace osu.Game.Tests.Beatmaps
this.resourceStore = resourceStore; this.resourceStore = resourceStore;
} }
protected override IBeatmapSkin GetSkin() => new LegacyBeatmapSkin(skinBeatmapInfo, resourceStore, AudioManager); protected override ISkin GetSkin() => new LegacyBeatmapSkin(skinBeatmapInfo, resourceStore, AudioManager);
} }
} }
} }