mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 10:33:07 +08:00
Only create drawables for storyboard elements that will be visible.
This commit is contained in:
parent
757a159516
commit
291486a4d1
@ -14,9 +14,6 @@ namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public StoryboardAnimation Animation { get; private set; }
|
||||
|
||||
protected override bool ShouldBeAlive => Animation.HasCommands && base.ShouldBeAlive;
|
||||
public override bool RemoveWhenNotAlive => !Animation.HasCommands || base.RemoveWhenNotAlive;
|
||||
|
||||
public bool FlipH { get; set; }
|
||||
public bool FlipV { get; set; }
|
||||
|
||||
@ -59,11 +56,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
Position = animation.InitialPosition;
|
||||
Repeat = animation.LoopType == AnimationLoopType.LoopForever;
|
||||
|
||||
if (animation.HasCommands)
|
||||
{
|
||||
LifetimeStart = animation.StartTime;
|
||||
LifetimeEnd = animation.EndTime;
|
||||
}
|
||||
LifetimeStart = animation.StartTime;
|
||||
LifetimeEnd = animation.EndTime;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -28,9 +28,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
foreach (var element in Layer.Elements)
|
||||
{
|
||||
var drawable = element.CreateDrawable();
|
||||
if (drawable != null)
|
||||
Add(drawable);
|
||||
if (element.IsDrawable)
|
||||
Add(element.CreateDrawable());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,6 @@ namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public StoryboardSprite Sprite { get; private set; }
|
||||
|
||||
protected override bool ShouldBeAlive => Sprite.HasCommands && base.ShouldBeAlive;
|
||||
public override bool RemoveWhenNotAlive => !Sprite.HasCommands || base.RemoveWhenNotAlive;
|
||||
|
||||
public bool FlipH { get; set; }
|
||||
public bool FlipV { get; set; }
|
||||
|
||||
@ -58,11 +55,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
Origin = sprite.Origin;
|
||||
Position = sprite.InitialPosition;
|
||||
|
||||
if (sprite.HasCommands)
|
||||
{
|
||||
LifetimeStart = sprite.StartTime;
|
||||
LifetimeEnd = sprite.EndTime;
|
||||
}
|
||||
LifetimeStart = sprite.StartTime;
|
||||
LifetimeEnd = sprite.EndTime;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Storyboards
|
||||
{
|
||||
@ -21,6 +22,8 @@ namespace osu.Game.Storyboards
|
||||
}
|
||||
|
||||
public Drawable CreateDrawable()
|
||||
=> null;
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user