mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Rename storyboard classes.
This commit is contained in:
@ -10,9 +10,9 @@ using osu.Game.IO;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public class Storyboard : Container<StoryboardLayer>
|
||||
public class DrawableStoryboard : Container<DrawableStoryboardLayer>
|
||||
{
|
||||
public StoryboardDefinition Definition { get; private set; }
|
||||
public Storyboard Storyboard { get; private set; }
|
||||
|
||||
protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480);
|
||||
public override bool HandleInput => false;
|
||||
@ -33,9 +33,9 @@ namespace osu.Game.Storyboards.Drawables
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
||||
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
public Storyboard(StoryboardDefinition definition)
|
||||
public DrawableStoryboard(Storyboard storyboard)
|
||||
{
|
||||
Definition = definition;
|
||||
Storyboard = storyboard;
|
||||
Size = new Vector2(640, 480);
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
@ -46,14 +46,14 @@ namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
dependencies.Cache(new TextureStore(new RawTextureLoaderStore(fileStore.Store), false) { ScaleAdjust = 1, });
|
||||
|
||||
foreach (var layerDefinition in Definition.Layers)
|
||||
Add(layerDefinition.CreateDrawable());
|
||||
foreach (var layer in Storyboard.Layers)
|
||||
Add(layer.CreateDrawable());
|
||||
}
|
||||
|
||||
private void updateLayerVisibility()
|
||||
{
|
||||
foreach (var layer in Children)
|
||||
layer.Enabled = passing ? layer.Definition.EnabledWhenPassing : layer.Definition.EnabledWhenFailing;
|
||||
layer.Enabled = passing ? layer.Layer.EnabledWhenPassing : layer.Layer.EnabledWhenFailing;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,12 +10,12 @@ using System.Linq;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public class StoryboardAnimation : TextureAnimation, IFlippable
|
||||
public class DrawableStoryboardAnimation : TextureAnimation, IFlippable
|
||||
{
|
||||
public AnimationDefinition Definition { get; private set; }
|
||||
public StoryboardAnimation Animation { get; private set; }
|
||||
|
||||
protected override bool ShouldBeAlive => Definition.HasCommands && base.ShouldBeAlive;
|
||||
public override bool RemoveWhenNotAlive => !Definition.HasCommands || base.RemoveWhenNotAlive;
|
||||
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; }
|
||||
@ -52,25 +52,25 @@ namespace osu.Game.Storyboards.Drawables
|
||||
public override bool IsPresent
|
||||
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
||||
|
||||
public StoryboardAnimation(AnimationDefinition definition)
|
||||
public DrawableStoryboardAnimation(StoryboardAnimation animation)
|
||||
{
|
||||
Definition = definition;
|
||||
Origin = definition.Origin;
|
||||
Position = definition.InitialPosition;
|
||||
Repeat = definition.LoopType == AnimationLoopType.LoopForever;
|
||||
Animation = animation;
|
||||
Origin = animation.Origin;
|
||||
Position = animation.InitialPosition;
|
||||
Repeat = animation.LoopType == AnimationLoopType.LoopForever;
|
||||
|
||||
if (definition.HasCommands)
|
||||
if (animation.HasCommands)
|
||||
{
|
||||
LifetimeStart = definition.StartTime;
|
||||
LifetimeEnd = definition.EndTime;
|
||||
LifetimeStart = animation.StartTime;
|
||||
LifetimeEnd = animation.EndTime;
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game, TextureStore textureStore)
|
||||
{
|
||||
var basePath = Definition.Path.ToLowerInvariant();
|
||||
for (var frame = 0; frame < Definition.FrameCount; frame++)
|
||||
var basePath = Animation.Path.ToLowerInvariant();
|
||||
for (var frame = 0; frame < Animation.FrameCount; frame++)
|
||||
{
|
||||
var framePath = basePath.Replace(".", frame + ".");
|
||||
|
||||
@ -79,9 +79,9 @@ namespace osu.Game.Storyboards.Drawables
|
||||
continue;
|
||||
|
||||
var texture = textureStore.Get(path);
|
||||
AddFrame(texture, Definition.FrameDelay);
|
||||
AddFrame(texture, Animation.FrameDelay);
|
||||
}
|
||||
Definition.ApplyTransforms(this);
|
||||
Animation.ApplyTransforms(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,26 +7,26 @@ using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public class StoryboardLayer : Container
|
||||
public class DrawableStoryboardLayer : Container
|
||||
{
|
||||
public LayerDefinition Definition { get; private set; }
|
||||
public StoryboardLayer Layer { get; private set; }
|
||||
public bool Enabled;
|
||||
|
||||
public override bool IsPresent => Enabled && base.IsPresent;
|
||||
|
||||
public StoryboardLayer(LayerDefinition definition)
|
||||
public DrawableStoryboardLayer(StoryboardLayer layer)
|
||||
{
|
||||
Definition = definition;
|
||||
Layer = layer;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
Enabled = definition.EnabledWhenPassing;
|
||||
Enabled = layer.EnabledWhenPassing;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
foreach (var element in Definition.Elements)
|
||||
foreach (var element in Layer.Elements)
|
||||
{
|
||||
var drawable = element.CreateDrawable();
|
||||
if (drawable != null)
|
@ -10,12 +10,12 @@ using System.Linq;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public class StoryboardSprite : Sprite, IFlippable
|
||||
public class DrawableStoryboardSprite : Sprite, IFlippable
|
||||
{
|
||||
public SpriteDefinition Definition { get; private set; }
|
||||
public StoryboardSprite Sprite { get; private set; }
|
||||
|
||||
protected override bool ShouldBeAlive => Definition.HasCommands && base.ShouldBeAlive;
|
||||
public override bool RemoveWhenNotAlive => !Definition.HasCommands || base.RemoveWhenNotAlive;
|
||||
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; }
|
||||
@ -52,29 +52,29 @@ namespace osu.Game.Storyboards.Drawables
|
||||
public override bool IsPresent
|
||||
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
||||
|
||||
public StoryboardSprite(SpriteDefinition definition)
|
||||
public DrawableStoryboardSprite(StoryboardSprite sprite)
|
||||
{
|
||||
Definition = definition;
|
||||
Origin = definition.Origin;
|
||||
Position = definition.InitialPosition;
|
||||
Sprite = sprite;
|
||||
Origin = sprite.Origin;
|
||||
Position = sprite.InitialPosition;
|
||||
|
||||
if (definition.HasCommands)
|
||||
if (sprite.HasCommands)
|
||||
{
|
||||
LifetimeStart = definition.StartTime;
|
||||
LifetimeEnd = definition.EndTime;
|
||||
LifetimeStart = sprite.StartTime;
|
||||
LifetimeEnd = sprite.EndTime;
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game, TextureStore textureStore)
|
||||
{
|
||||
var spritePath = Definition.Path.ToLowerInvariant();
|
||||
var spritePath = Sprite.Path.ToLowerInvariant();
|
||||
var path = game.Beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
|
||||
if (path == null)
|
||||
return;
|
||||
|
||||
Texture = textureStore.Get(path);
|
||||
Definition.ApplyTransforms(this);
|
||||
Sprite.ApplyTransforms(this);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user