mirror of
https://github.com/ppy/osu.git
synced 2025-03-23 02:57:25 +08:00
Retrieve separated skin instance from working beatmap for editing
This commit is contained in:
parent
81280dfd25
commit
6108451449
@ -169,7 +169,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
|
||||
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
|
||||
|
||||
protected override ISkin GetSkin() => throw new NotImplementedException();
|
||||
protected internal override ISkin GetSkin() => throw new NotImplementedException();
|
||||
|
||||
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ namespace osu.Game.Tests.Gameplay
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
protected override ISkin GetSkin() => new TestSkin("test-sample", resources);
|
||||
protected internal override ISkin GetSkin() => new TestSkin("test-sample", resources);
|
||||
}
|
||||
|
||||
private class TestDrawableStoryboardSample : DrawableStoryboardSample
|
||||
|
@ -111,7 +111,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
this.beatmapSkin = beatmapSkin;
|
||||
}
|
||||
|
||||
protected override ISkin GetSkin() => beatmapSkin;
|
||||
protected internal override ISkin GetSkin() => beatmapSkin;
|
||||
}
|
||||
|
||||
private class TestOsuRuleset : OsuRuleset
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Tests
|
||||
|
||||
protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile));
|
||||
|
||||
protected override ISkin GetSkin() => null;
|
||||
protected internal override ISkin GetSkin() => null;
|
||||
|
||||
public override Stream GetStream(string storagePath) => null;
|
||||
|
||||
|
@ -534,7 +534,7 @@ namespace osu.Game.Beatmaps
|
||||
protected override IBeatmap GetBeatmap() => beatmap;
|
||||
protected override Texture GetBackground() => null;
|
||||
protected override Track GetBeatmapTrack() => null;
|
||||
protected override ISkin GetSkin() => null;
|
||||
protected internal override ISkin GetSkin() => null;
|
||||
public override Stream GetStream(string storagePath) => null;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ namespace osu.Game.Beatmaps
|
||||
return storyboard;
|
||||
}
|
||||
|
||||
protected override ISkin GetSkin()
|
||||
protected internal override ISkin GetSkin()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
protected override Track GetBeatmapTrack() => GetVirtualTrack();
|
||||
|
||||
protected override ISkin GetSkin() => null;
|
||||
protected internal override ISkin GetSkin() => null;
|
||||
|
||||
public override Stream GetStream(string storagePath) => null;
|
||||
|
||||
|
@ -327,7 +327,15 @@ namespace osu.Game.Beatmaps
|
||||
public bool SkinLoaded => skin.IsResultAvailable;
|
||||
public ISkin Skin => skin.Value;
|
||||
|
||||
protected abstract ISkin GetSkin();
|
||||
/// <summary>
|
||||
/// Creates a new skin instance for this beatmap.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should only be called externally in scenarios where it is explicitly desired to get a new instance of a skin
|
||||
/// (e.g. for editing purposes, to avoid state pollution).
|
||||
/// For standard reading purposes, <see cref="Skin"/> should always be used directly.
|
||||
/// </remarks>
|
||||
protected internal abstract ISkin GetSkin();
|
||||
|
||||
private readonly RecyclableLazy<ISkin> skin;
|
||||
|
||||
|
@ -153,7 +153,7 @@ namespace osu.Game.Screens.Edit
|
||||
// todo: remove caching of this and consume via editorBeatmap?
|
||||
dependencies.Cache(beatDivisor);
|
||||
|
||||
AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap, loadableBeatmap.Skin));
|
||||
AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap, loadableBeatmap.GetSkin()));
|
||||
dependencies.CacheAs(editorBeatmap);
|
||||
changeHandler = new EditorChangeHandler(editorBeatmap);
|
||||
dependencies.CacheAs<IEditorChangeHandler>(changeHandler);
|
||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
|
||||
|
||||
protected override ISkin GetSkin() => throw new NotImplementedException();
|
||||
protected internal override ISkin GetSkin() => throw new NotImplementedException();
|
||||
|
||||
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
|
||||
|
||||
protected override ISkin GetSkin() => throw new NotImplementedException();
|
||||
protected internal override ISkin GetSkin() => throw new NotImplementedException();
|
||||
|
||||
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
|
||||
|
||||
|
@ -211,7 +211,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
protected override ISkin GetSkin() => new LegacyBeatmapSkin(skinBeatmapInfo, resourceStore, resources);
|
||||
protected internal override ISkin GetSkin() => new LegacyBeatmapSkin(skinBeatmapInfo, resourceStore, resources);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
HasColours = hasColours;
|
||||
}
|
||||
|
||||
protected override ISkin GetSkin() => new TestBeatmapSkin(BeatmapInfo, HasColours);
|
||||
protected internal override ISkin GetSkin() => new TestBeatmapSkin(BeatmapInfo, HasColours);
|
||||
}
|
||||
|
||||
protected class TestBeatmapSkin : LegacyBeatmapSkin
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();
|
||||
|
||||
protected override ISkin GetSkin() => null;
|
||||
protected internal override ISkin GetSkin() => null;
|
||||
|
||||
public override Stream GetStream(string storagePath) => null;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user