1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 22:47:25 +08:00
osu-lazer/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs

37 lines
1.1 KiB
C#
Raw Normal View History

2018-01-05 19:21:19 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
2017-09-08 05:55:05 +08:00
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Storyboards.Drawables
{
2017-09-13 17:22:24 +08:00
public class DrawableStoryboardLayer : Container
2017-09-08 05:55:05 +08:00
{
2017-09-13 17:22:24 +08:00
public StoryboardLayer Layer { get; private set; }
2017-09-08 05:55:05 +08:00
public bool Enabled;
public override bool IsPresent => Enabled && base.IsPresent;
2017-09-13 17:22:24 +08:00
public DrawableStoryboardLayer(StoryboardLayer layer)
2017-09-08 05:55:05 +08:00
{
2017-09-13 17:22:24 +08:00
Layer = layer;
2017-09-08 05:55:05 +08:00
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
2017-09-13 17:22:24 +08:00
Enabled = layer.EnabledWhenPassing;
2017-09-08 05:55:05 +08:00
}
[BackgroundDependencyLoader]
private void load()
{
2017-09-13 17:22:24 +08:00
foreach (var element in Layer.Elements)
2017-09-08 05:55:05 +08:00
{
if (element.IsDrawable)
Add(element.CreateDrawable());
2017-09-08 05:55:05 +08:00
}
}
}
}