Expose some storyboard pieces to allow better testability

This commit is contained in:
Dean Herbert 2023-09-11 23:59:44 +09:00
parent 43ae26b8ef
commit 773ec46989
4 changed files with 9 additions and 4 deletions

View File

@ -23,7 +23,9 @@ namespace osu.Game.Storyboards.Drawables
{
public partial class DrawableStoryboard : Container<DrawableStoryboardLayer>
{
[Cached]
public Vector2 AppliedScale { get; private set; }
[Cached(typeof(Storyboard))]
public Storyboard Storyboard { get; }
/// <summary>

View File

@ -1,6 +1,7 @@
// 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.
using System.Collections.Generic;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -30,10 +31,12 @@ public DrawableStoryboardLayer(StoryboardLayer layer)
InternalChild = ElementContainer = new LayerElementContainer(layer);
}
protected partial class LayerElementContainer : LifetimeManagementContainer
public partial class LayerElementContainer : LifetimeManagementContainer
{
private readonly StoryboardLayer storyboardLayer;
public IEnumerable<Drawable> Elements => InternalChildren;
public LayerElementContainer(StoryboardLayer layer)
{
storyboardLayer = layer;

View File

@ -86,7 +86,7 @@ public bool ReplacesBackground
}
}
public DrawableStoryboard CreateDrawable(IReadOnlyList<Mod>? mods = null) =>
public virtual DrawableStoryboard CreateDrawable(IReadOnlyList<Mod>? mods = null) =>
new DrawableStoryboard(this, mods);
private static readonly string[] image_extensions = { @".png", @".jpg" };

View File

@ -14,7 +14,7 @@ public class StoryboardVideo : IStoryboardElement
public double StartTime { get; }
public StoryboardVideo(string path, int offset)
public StoryboardVideo(string path, double offset)
{
Path = path;
StartTime = offset;