1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Only create drawables for storyboard elements that will be visible.

This commit is contained in:
Damnae 2017-09-15 13:35:41 +02:00
parent 757a159516
commit 291486a4d1
4 changed files with 10 additions and 20 deletions

View File

@ -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]

View File

@ -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());
}
}
}

View File

@ -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]

View File

@ -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();
}
}
}