mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Fix storyboard UseSkinSprites
being implemented incorrectly
This was implemented as a "fallback", but it's actually intended to be an "override". As in it allows storyboarders to *prefer* a skin sprite before falling back to a local version contained within the storyboard. Can be tested with https://osu.ppy.sh/beatmapsets/832364#osu/1743837. Closes https://github.com/ppy/osu/issues/24813.
This commit is contained in:
parent
2f020f8682
commit
4a7dc4d792
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -74,6 +75,15 @@ namespace osu.Game.Storyboards.Drawables
|
||||
public override bool IsPresent
|
||||
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
||||
|
||||
[Resolved]
|
||||
private ISkinSource skin { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private Storyboard storyboard { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private TextureStore textureStore { get; set; } = null!;
|
||||
|
||||
public DrawableStoryboardSprite(StoryboardSprite sprite)
|
||||
{
|
||||
Sprite = sprite;
|
||||
@ -84,24 +94,21 @@ namespace osu.Game.Storyboards.Drawables
|
||||
LifetimeEnd = sprite.EndTimeForDisplay;
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private ISkinSource skin { get; set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textureStore, Storyboard storyboard)
|
||||
private void load()
|
||||
{
|
||||
Texture = textureStore.Get(Sprite.Path);
|
||||
|
||||
if (Texture == null && storyboard.UseSkinSprites)
|
||||
if (storyboard.UseSkinSprites)
|
||||
{
|
||||
skin.SourceChanged += skinSourceChanged;
|
||||
skinSourceChanged();
|
||||
}
|
||||
else
|
||||
Texture = textureStore.Get(Sprite.Path);
|
||||
|
||||
Sprite.ApplyTransforms(this);
|
||||
}
|
||||
|
||||
private void skinSourceChanged() => Texture = skin.GetTexture(Sprite.Path);
|
||||
private void skinSourceChanged() => Texture = skin.GetTexture(Sprite.Path) ?? textureStore.Get(Sprite.Path);
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Storyboards
|
||||
public BeatmapInfo BeatmapInfo = new BeatmapInfo();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the storyboard can fall back to skin sprites in case no matching storyboard sprites are found.
|
||||
/// Whether the storyboard should prefer textures from the current skin before using local storyboard textures.
|
||||
/// </summary>
|
||||
public bool UseSkinSprites { get; set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user