mirror of
https://github.com/ppy/osu
synced 2025-02-22 21:47:12 +00:00
Rename storyboard classes.
This commit is contained in:
parent
58e65397b0
commit
bab3ef0669
@ -21,8 +21,8 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private readonly Container<Storyboard> storyboardContainer;
|
private readonly Container<DrawableStoryboard> storyboardContainer;
|
||||||
private Storyboard storyboard;
|
private DrawableStoryboard storyboard;
|
||||||
|
|
||||||
public TestCaseStoryboard()
|
public TestCaseStoryboard()
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
storyboardContainer = new Container<Storyboard>
|
storyboardContainer = new Container<DrawableStoryboard>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Beatmap's Storyboard.
|
/// The Beatmap's Storyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StoryboardDefinition Storyboard = new StoryboardDefinition();
|
public Storyboard Storyboard = new Storyboard();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new beatmap.
|
/// Constructs a new beatmap.
|
||||||
|
@ -242,7 +242,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEvents(Beatmap beatmap, string line, ref SpriteDefinition spriteDefinition, ref CommandTimelineGroup timelineGroup)
|
private void handleEvents(Beatmap beatmap, string line, ref StoryboardSprite storyboardSprite, ref CommandTimelineGroup timelineGroup)
|
||||||
{
|
{
|
||||||
var depth = 0;
|
var depth = 0;
|
||||||
while (line.StartsWith(" ") || line.StartsWith("_"))
|
while (line.StartsWith(" ") || line.StartsWith("_"))
|
||||||
@ -257,7 +257,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
if (depth == 0)
|
if (depth == 0)
|
||||||
{
|
{
|
||||||
spriteDefinition = null;
|
storyboardSprite = null;
|
||||||
|
|
||||||
EventType type;
|
EventType type;
|
||||||
if (!Enum.TryParse(split[0], out type))
|
if (!Enum.TryParse(split[0], out type))
|
||||||
@ -292,8 +292,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var path = cleanFilename(split[3]);
|
var path = cleanFilename(split[3]);
|
||||||
var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo);
|
var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo);
|
||||||
var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo);
|
var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo);
|
||||||
spriteDefinition = new SpriteDefinition(path, origin, new Vector2(x, y));
|
storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y));
|
||||||
beatmap.Storyboard.GetLayer(layer).Add(spriteDefinition);
|
beatmap.Storyboard.GetLayer(layer).Add(storyboardSprite);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.Animation:
|
case EventType.Animation:
|
||||||
@ -306,8 +306,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var frameCount = int.Parse(split[6]);
|
var frameCount = int.Parse(split[6]);
|
||||||
var frameDelay = double.Parse(split[7], NumberFormatInfo.InvariantInfo);
|
var frameDelay = double.Parse(split[7], NumberFormatInfo.InvariantInfo);
|
||||||
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
|
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
|
||||||
spriteDefinition = new AnimationDefinition(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
|
storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
|
||||||
beatmap.Storyboard.GetLayer(layer).Add(spriteDefinition);
|
beatmap.Storyboard.GetLayer(layer).Add(storyboardSprite);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.Sample:
|
case EventType.Sample:
|
||||||
@ -316,7 +316,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var layer = parseLayer(split[2]);
|
var layer = parseLayer(split[2]);
|
||||||
var path = cleanFilename(split[3]);
|
var path = cleanFilename(split[3]);
|
||||||
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100;
|
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100;
|
||||||
beatmap.Storyboard.GetLayer(layer).Add(new SampleDefinition(path, time, volume));
|
beatmap.Storyboard.GetLayer(layer).Add(new StoryboardSample(path, time, volume));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (depth < 2)
|
if (depth < 2)
|
||||||
timelineGroup = spriteDefinition?.TimelineGroup;
|
timelineGroup = storyboardSprite?.TimelineGroup;
|
||||||
|
|
||||||
var commandType = split[0];
|
var commandType = split[0];
|
||||||
switch (commandType)
|
switch (commandType)
|
||||||
@ -335,14 +335,14 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var startTime = split.Length > 2 ? double.Parse(split[2], CultureInfo.InvariantCulture) : double.MinValue;
|
var startTime = split.Length > 2 ? double.Parse(split[2], CultureInfo.InvariantCulture) : double.MinValue;
|
||||||
var endTime = split.Length > 3 ? double.Parse(split[3], CultureInfo.InvariantCulture) : double.MaxValue;
|
var endTime = split.Length > 3 ? double.Parse(split[3], CultureInfo.InvariantCulture) : double.MaxValue;
|
||||||
var groupNumber = split.Length > 4 ? int.Parse(split[4]) : 0;
|
var groupNumber = split.Length > 4 ? int.Parse(split[4]) : 0;
|
||||||
timelineGroup = spriteDefinition?.AddTrigger(triggerName, startTime, endTime, groupNumber);
|
timelineGroup = storyboardSprite?.AddTrigger(triggerName, startTime, endTime, groupNumber);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "L":
|
case "L":
|
||||||
{
|
{
|
||||||
var startTime = double.Parse(split[1], CultureInfo.InvariantCulture);
|
var startTime = double.Parse(split[1], CultureInfo.InvariantCulture);
|
||||||
var loopCount = int.Parse(split[2]);
|
var loopCount = int.Parse(split[2]);
|
||||||
timelineGroup = spriteDefinition?.AddLoop(startTime, loopCount);
|
timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -607,7 +607,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
Section section = Section.None;
|
Section section = Section.None;
|
||||||
bool hasCustomColours = false;
|
bool hasCustomColours = false;
|
||||||
SpriteDefinition spriteDefinition = null;
|
StoryboardSprite storyboardSprite = null;
|
||||||
CommandTimelineGroup timelineGroup = null;
|
CommandTimelineGroup timelineGroup = null;
|
||||||
|
|
||||||
string line;
|
string line;
|
||||||
@ -647,7 +647,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
handleDifficulty(beatmap, line);
|
handleDifficulty(beatmap, line);
|
||||||
break;
|
break;
|
||||||
case Section.Events:
|
case Section.Events:
|
||||||
handleEvents(beatmap, line, ref spriteDefinition, ref timelineGroup);
|
handleEvents(beatmap, line, ref storyboardSprite, ref timelineGroup);
|
||||||
break;
|
break;
|
||||||
case Section.TimingPoints:
|
case Section.TimingPoints:
|
||||||
handleTimingPoints(beatmap, line);
|
handleTimingPoints(beatmap, line);
|
||||||
|
@ -10,9 +10,9 @@ using osu.Game.IO;
|
|||||||
|
|
||||||
namespace osu.Game.Storyboards.Drawables
|
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);
|
protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480);
|
||||||
public override bool HandleInput => false;
|
public override bool HandleInput => false;
|
||||||
@ -33,9 +33,9 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||||
|
|
||||||
public Storyboard(StoryboardDefinition definition)
|
public DrawableStoryboard(Storyboard storyboard)
|
||||||
{
|
{
|
||||||
Definition = definition;
|
Storyboard = storyboard;
|
||||||
Size = new Vector2(640, 480);
|
Size = new Vector2(640, 480);
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = 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, });
|
dependencies.Cache(new TextureStore(new RawTextureLoaderStore(fileStore.Store), false) { ScaleAdjust = 1, });
|
||||||
|
|
||||||
foreach (var layerDefinition in Definition.Layers)
|
foreach (var layer in Storyboard.Layers)
|
||||||
Add(layerDefinition.CreateDrawable());
|
Add(layer.CreateDrawable());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLayerVisibility()
|
private void updateLayerVisibility()
|
||||||
{
|
{
|
||||||
foreach (var layer in Children)
|
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
|
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;
|
protected override bool ShouldBeAlive => Animation.HasCommands && base.ShouldBeAlive;
|
||||||
public override bool RemoveWhenNotAlive => !Definition.HasCommands || base.RemoveWhenNotAlive;
|
public override bool RemoveWhenNotAlive => !Animation.HasCommands || base.RemoveWhenNotAlive;
|
||||||
|
|
||||||
public bool FlipH { get; set; }
|
public bool FlipH { get; set; }
|
||||||
public bool FlipV { get; set; }
|
public bool FlipV { get; set; }
|
||||||
@ -52,25 +52,25 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
public override bool IsPresent
|
public override bool IsPresent
|
||||||
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
||||||
|
|
||||||
public StoryboardAnimation(AnimationDefinition definition)
|
public DrawableStoryboardAnimation(StoryboardAnimation animation)
|
||||||
{
|
{
|
||||||
Definition = definition;
|
Animation = animation;
|
||||||
Origin = definition.Origin;
|
Origin = animation.Origin;
|
||||||
Position = definition.InitialPosition;
|
Position = animation.InitialPosition;
|
||||||
Repeat = definition.LoopType == AnimationLoopType.LoopForever;
|
Repeat = animation.LoopType == AnimationLoopType.LoopForever;
|
||||||
|
|
||||||
if (definition.HasCommands)
|
if (animation.HasCommands)
|
||||||
{
|
{
|
||||||
LifetimeStart = definition.StartTime;
|
LifetimeStart = animation.StartTime;
|
||||||
LifetimeEnd = definition.EndTime;
|
LifetimeEnd = animation.EndTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, TextureStore textureStore)
|
private void load(OsuGameBase game, TextureStore textureStore)
|
||||||
{
|
{
|
||||||
var basePath = Definition.Path.ToLowerInvariant();
|
var basePath = Animation.Path.ToLowerInvariant();
|
||||||
for (var frame = 0; frame < Definition.FrameCount; frame++)
|
for (var frame = 0; frame < Animation.FrameCount; frame++)
|
||||||
{
|
{
|
||||||
var framePath = basePath.Replace(".", frame + ".");
|
var framePath = basePath.Replace(".", frame + ".");
|
||||||
|
|
||||||
@ -79,9 +79,9 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
var texture = textureStore.Get(path);
|
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
|
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 bool Enabled;
|
||||||
|
|
||||||
public override bool IsPresent => Enabled && base.IsPresent;
|
public override bool IsPresent => Enabled && base.IsPresent;
|
||||||
|
|
||||||
public StoryboardLayer(LayerDefinition definition)
|
public DrawableStoryboardLayer(StoryboardLayer layer)
|
||||||
{
|
{
|
||||||
Definition = definition;
|
Layer = layer;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Enabled = definition.EnabledWhenPassing;
|
Enabled = layer.EnabledWhenPassing;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
foreach (var element in Definition.Elements)
|
foreach (var element in Layer.Elements)
|
||||||
{
|
{
|
||||||
var drawable = element.CreateDrawable();
|
var drawable = element.CreateDrawable();
|
||||||
if (drawable != null)
|
if (drawable != null)
|
@ -10,12 +10,12 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Storyboards.Drawables
|
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;
|
protected override bool ShouldBeAlive => Sprite.HasCommands && base.ShouldBeAlive;
|
||||||
public override bool RemoveWhenNotAlive => !Definition.HasCommands || base.RemoveWhenNotAlive;
|
public override bool RemoveWhenNotAlive => !Sprite.HasCommands || base.RemoveWhenNotAlive;
|
||||||
|
|
||||||
public bool FlipH { get; set; }
|
public bool FlipH { get; set; }
|
||||||
public bool FlipV { get; set; }
|
public bool FlipV { get; set; }
|
||||||
@ -52,29 +52,29 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
public override bool IsPresent
|
public override bool IsPresent
|
||||||
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
||||||
|
|
||||||
public StoryboardSprite(SpriteDefinition definition)
|
public DrawableStoryboardSprite(StoryboardSprite sprite)
|
||||||
{
|
{
|
||||||
Definition = definition;
|
Sprite = sprite;
|
||||||
Origin = definition.Origin;
|
Origin = sprite.Origin;
|
||||||
Position = definition.InitialPosition;
|
Position = sprite.InitialPosition;
|
||||||
|
|
||||||
if (definition.HasCommands)
|
if (sprite.HasCommands)
|
||||||
{
|
{
|
||||||
LifetimeStart = definition.StartTime;
|
LifetimeStart = sprite.StartTime;
|
||||||
LifetimeEnd = definition.EndTime;
|
LifetimeEnd = sprite.EndTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, TextureStore textureStore)
|
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;
|
var path = game.Beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
|
||||||
if (path == null)
|
if (path == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Texture = textureStore.Get(path);
|
Texture = textureStore.Get(path);
|
||||||
Definition.ApplyTransforms(this);
|
Sprite.ApplyTransforms(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ using osu.Framework.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Storyboards
|
namespace osu.Game.Storyboards
|
||||||
{
|
{
|
||||||
public interface IElementDefinition
|
public interface IStoryboardElement
|
||||||
{
|
{
|
||||||
string Path { get; }
|
string Path { get; }
|
||||||
Drawable CreateDrawable();
|
Drawable CreateDrawable();
|
35
osu.Game/Storyboards/Storyboard.cs
Normal file
35
osu.Game/Storyboards/Storyboard.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace osu.Game.Storyboards
|
||||||
|
{
|
||||||
|
public class Storyboard
|
||||||
|
{
|
||||||
|
private readonly Dictionary<string, StoryboardLayer> layers = new Dictionary<string, StoryboardLayer>();
|
||||||
|
public IEnumerable<StoryboardLayer> Layers => layers.Values;
|
||||||
|
|
||||||
|
public Storyboard()
|
||||||
|
{
|
||||||
|
layers.Add("Background", new StoryboardLayer("Background", 3));
|
||||||
|
layers.Add("Fail", new StoryboardLayer("Fail", 2) { EnabledWhenPassing = false, });
|
||||||
|
layers.Add("Pass", new StoryboardLayer("Pass", 1) { EnabledWhenFailing = false, });
|
||||||
|
layers.Add("Foreground", new StoryboardLayer("Foreground", 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public StoryboardLayer GetLayer(string name)
|
||||||
|
{
|
||||||
|
StoryboardLayer layer;
|
||||||
|
if (!layers.TryGetValue(name, out layer))
|
||||||
|
layers[name] = layer = new StoryboardLayer(name, layers.Values.Min(l => l.Depth) - 1);
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawableStoryboard CreateDrawable()
|
||||||
|
=> new DrawableStoryboard(this);
|
||||||
|
}
|
||||||
|
}
|
@ -7,13 +7,13 @@ using osu.Game.Storyboards.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Storyboards
|
namespace osu.Game.Storyboards
|
||||||
{
|
{
|
||||||
public class AnimationDefinition : SpriteDefinition
|
public class StoryboardAnimation : StoryboardSprite
|
||||||
{
|
{
|
||||||
public int FrameCount;
|
public int FrameCount;
|
||||||
public double FrameDelay;
|
public double FrameDelay;
|
||||||
public AnimationLoopType LoopType;
|
public AnimationLoopType LoopType;
|
||||||
|
|
||||||
public AnimationDefinition(string path, Anchor origin, Vector2 initialPosition, int frameCount, double frameDelay, AnimationLoopType loopType)
|
public StoryboardAnimation(string path, Anchor origin, Vector2 initialPosition, int frameCount, double frameDelay, AnimationLoopType loopType)
|
||||||
: base(path, origin, initialPosition)
|
: base(path, origin, initialPosition)
|
||||||
{
|
{
|
||||||
FrameCount = frameCount;
|
FrameCount = frameCount;
|
||||||
@ -22,7 +22,7 @@ namespace osu.Game.Storyboards
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override Drawable CreateDrawable()
|
public override Drawable CreateDrawable()
|
||||||
=> new StoryboardAnimation(this);
|
=> new DrawableStoryboardAnimation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AnimationLoopType
|
public enum AnimationLoopType
|
@ -1,35 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using osu.Game.Storyboards.Drawables;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Storyboards
|
|
||||||
{
|
|
||||||
public class StoryboardDefinition
|
|
||||||
{
|
|
||||||
private readonly Dictionary<string, LayerDefinition> layers = new Dictionary<string, LayerDefinition>();
|
|
||||||
public IEnumerable<LayerDefinition> Layers => layers.Values;
|
|
||||||
|
|
||||||
public StoryboardDefinition()
|
|
||||||
{
|
|
||||||
layers.Add("Background", new LayerDefinition("Background", 3));
|
|
||||||
layers.Add("Fail", new LayerDefinition("Fail", 2) { EnabledWhenPassing = false, });
|
|
||||||
layers.Add("Pass", new LayerDefinition("Pass", 1) { EnabledWhenFailing = false, });
|
|
||||||
layers.Add("Foreground", new LayerDefinition("Foreground", 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public LayerDefinition GetLayer(string name)
|
|
||||||
{
|
|
||||||
LayerDefinition layer;
|
|
||||||
if (!layers.TryGetValue(name, out layer))
|
|
||||||
layers[name] = layer = new LayerDefinition(name, layers.Values.Min(l => l.Depth) - 1);
|
|
||||||
|
|
||||||
return layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Storyboard CreateDrawable()
|
|
||||||
=> new Storyboard(this);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,28 +6,28 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace osu.Game.Storyboards
|
namespace osu.Game.Storyboards
|
||||||
{
|
{
|
||||||
public class LayerDefinition
|
public class StoryboardLayer
|
||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
public int Depth;
|
public int Depth;
|
||||||
public bool EnabledWhenPassing = true;
|
public bool EnabledWhenPassing = true;
|
||||||
public bool EnabledWhenFailing = true;
|
public bool EnabledWhenFailing = true;
|
||||||
|
|
||||||
private readonly List<IElementDefinition> elements = new List<IElementDefinition>();
|
private readonly List<IStoryboardElement> elements = new List<IStoryboardElement>();
|
||||||
public IEnumerable<IElementDefinition> Elements => elements;
|
public IEnumerable<IStoryboardElement> Elements => elements;
|
||||||
|
|
||||||
public LayerDefinition(string name, int depth)
|
public StoryboardLayer(string name, int depth)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Depth = depth;
|
Depth = depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(IElementDefinition element)
|
public void Add(IStoryboardElement element)
|
||||||
{
|
{
|
||||||
elements.Add(element);
|
elements.Add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoryboardLayer CreateDrawable()
|
public DrawableStoryboardLayer CreateDrawable()
|
||||||
=> new StoryboardLayer(this) { Depth = Depth, };
|
=> new DrawableStoryboardLayer(this) { Depth = Depth, };
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,13 +5,13 @@ using osu.Framework.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Storyboards
|
namespace osu.Game.Storyboards
|
||||||
{
|
{
|
||||||
public class SampleDefinition : IElementDefinition
|
public class StoryboardSample : IStoryboardElement
|
||||||
{
|
{
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public double Time;
|
public double Time;
|
||||||
public float Volume;
|
public float Volume;
|
||||||
|
|
||||||
public SampleDefinition(string path, double time, float volume)
|
public StoryboardSample(string path, double time, float volume)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
Time = time;
|
Time = time;
|
@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Storyboards
|
namespace osu.Game.Storyboards
|
||||||
{
|
{
|
||||||
public class SpriteDefinition : IElementDefinition
|
public class StoryboardSprite : IStoryboardElement
|
||||||
{
|
{
|
||||||
private readonly List<CommandLoop> loops = new List<CommandLoop>();
|
private readonly List<CommandLoop> loops = new List<CommandLoop>();
|
||||||
private readonly List<CommandTrigger> triggers = new List<CommandTrigger>();
|
private readonly List<CommandTrigger> triggers = new List<CommandTrigger>();
|
||||||
@ -34,7 +34,7 @@ namespace osu.Game.Storyboards
|
|||||||
private delegate void DrawablePropertyInitializer<in T>(Drawable drawable, T value);
|
private delegate void DrawablePropertyInitializer<in T>(Drawable drawable, T value);
|
||||||
private delegate void DrawableTransformer<in T>(Drawable drawable, T value, double duration, Easing easing);
|
private delegate void DrawableTransformer<in T>(Drawable drawable, T value, double duration, Easing easing);
|
||||||
|
|
||||||
public SpriteDefinition(string path, Anchor origin, Vector2 initialPosition)
|
public StoryboardSprite(string path, Anchor origin, Vector2 initialPosition)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
Origin = origin;
|
Origin = origin;
|
||||||
@ -56,7 +56,7 @@ namespace osu.Game.Storyboards
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual Drawable CreateDrawable()
|
public virtual Drawable CreateDrawable()
|
||||||
=> new StoryboardSprite(this);
|
=> new DrawableStoryboardSprite(this);
|
||||||
|
|
||||||
public void ApplyTransforms(Drawable drawable, IEnumerable<Tuple<CommandTimelineGroup, double>> triggeredGroups = null)
|
public void ApplyTransforms(Drawable drawable, IEnumerable<Tuple<CommandTimelineGroup, double>> triggeredGroups = null)
|
||||||
{
|
{
|
@ -81,21 +81,21 @@
|
|||||||
<Compile Include="Beatmaps\DummyWorkingBeatmap.cs" />
|
<Compile Include="Beatmaps\DummyWorkingBeatmap.cs" />
|
||||||
<Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" />
|
<Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" />
|
||||||
<Compile Include="Storyboards\Drawables\IFlippable.cs" />
|
<Compile Include="Storyboards\Drawables\IFlippable.cs" />
|
||||||
<Compile Include="Storyboards\Drawables\StoryboardLayer.cs" />
|
<Compile Include="Storyboards\Drawables\DrawableStoryboardLayer.cs" />
|
||||||
<Compile Include="Storyboards\Drawables\Storyboard.cs" />
|
<Compile Include="Storyboards\Drawables\DrawableStoryboard.cs" />
|
||||||
<Compile Include="Storyboards\Drawables\StoryboardAnimation.cs" />
|
<Compile Include="Storyboards\Drawables\DrawableStoryboardAnimation.cs" />
|
||||||
<Compile Include="Storyboards\Drawables\StoryboardSprite.cs" />
|
<Compile Include="Storyboards\Drawables\DrawableStoryboardSprite.cs" />
|
||||||
<Compile Include="Storyboards\AnimationDefinition.cs" />
|
<Compile Include="Storyboards\StoryboardAnimation.cs" />
|
||||||
<Compile Include="Storyboards\Drawables\DrawablesExtensions.cs" />
|
<Compile Include="Storyboards\Drawables\DrawablesExtensions.cs" />
|
||||||
<Compile Include="Storyboards\IElementDefinition.cs" />
|
<Compile Include="Storyboards\IStoryboardElement.cs" />
|
||||||
<Compile Include="Storyboards\CommandTimeline.cs" />
|
<Compile Include="Storyboards\CommandTimeline.cs" />
|
||||||
<Compile Include="Storyboards\CommandTimelineGroup.cs" />
|
<Compile Include="Storyboards\CommandTimelineGroup.cs" />
|
||||||
<Compile Include="Storyboards\CommandTrigger.cs" />
|
<Compile Include="Storyboards\CommandTrigger.cs" />
|
||||||
<Compile Include="Storyboards\CommandLoop.cs" />
|
<Compile Include="Storyboards\CommandLoop.cs" />
|
||||||
<Compile Include="Storyboards\SampleDefinition.cs" />
|
<Compile Include="Storyboards\StoryboardSample.cs" />
|
||||||
<Compile Include="Storyboards\SpriteDefinition.cs" />
|
<Compile Include="Storyboards\StoryboardSprite.cs" />
|
||||||
<Compile Include="Storyboards\LayerDefinition.cs" />
|
<Compile Include="Storyboards\StoryboardLayer.cs" />
|
||||||
<Compile Include="Storyboards\StoryboardDefinition.cs" />
|
<Compile Include="Storyboards\Storyboard.cs" />
|
||||||
<Compile Include="Database\StoreVersion.cs" />
|
<Compile Include="Database\StoreVersion.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user