mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Merge pull request #8426 from voidedWarranties/storyboard-masking
Allow individual storyboard layers to disable masking
This commit is contained in:
commit
cf890efa42
@ -31,29 +31,29 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
StoryboardLayer background = storyboard.Layers.FirstOrDefault(l => l.Depth == 3);
|
StoryboardLayer background = storyboard.Layers.FirstOrDefault(l => l.Depth == 3);
|
||||||
Assert.IsNotNull(background);
|
Assert.IsNotNull(background);
|
||||||
Assert.AreEqual(16, background.Elements.Count);
|
Assert.AreEqual(16, background.Elements.Count);
|
||||||
Assert.IsTrue(background.EnabledWhenFailing);
|
Assert.IsTrue(background.VisibleWhenFailing);
|
||||||
Assert.IsTrue(background.EnabledWhenPassing);
|
Assert.IsTrue(background.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Background", background.Name);
|
Assert.AreEqual("Background", background.Name);
|
||||||
|
|
||||||
StoryboardLayer fail = storyboard.Layers.FirstOrDefault(l => l.Depth == 2);
|
StoryboardLayer fail = storyboard.Layers.FirstOrDefault(l => l.Depth == 2);
|
||||||
Assert.IsNotNull(fail);
|
Assert.IsNotNull(fail);
|
||||||
Assert.AreEqual(0, fail.Elements.Count);
|
Assert.AreEqual(0, fail.Elements.Count);
|
||||||
Assert.IsTrue(fail.EnabledWhenFailing);
|
Assert.IsTrue(fail.VisibleWhenFailing);
|
||||||
Assert.IsFalse(fail.EnabledWhenPassing);
|
Assert.IsFalse(fail.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Fail", fail.Name);
|
Assert.AreEqual("Fail", fail.Name);
|
||||||
|
|
||||||
StoryboardLayer pass = storyboard.Layers.FirstOrDefault(l => l.Depth == 1);
|
StoryboardLayer pass = storyboard.Layers.FirstOrDefault(l => l.Depth == 1);
|
||||||
Assert.IsNotNull(pass);
|
Assert.IsNotNull(pass);
|
||||||
Assert.AreEqual(0, pass.Elements.Count);
|
Assert.AreEqual(0, pass.Elements.Count);
|
||||||
Assert.IsFalse(pass.EnabledWhenFailing);
|
Assert.IsFalse(pass.VisibleWhenFailing);
|
||||||
Assert.IsTrue(pass.EnabledWhenPassing);
|
Assert.IsTrue(pass.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Pass", pass.Name);
|
Assert.AreEqual("Pass", pass.Name);
|
||||||
|
|
||||||
StoryboardLayer foreground = storyboard.Layers.FirstOrDefault(l => l.Depth == 0);
|
StoryboardLayer foreground = storyboard.Layers.FirstOrDefault(l => l.Depth == 0);
|
||||||
Assert.IsNotNull(foreground);
|
Assert.IsNotNull(foreground);
|
||||||
Assert.AreEqual(151, foreground.Elements.Count);
|
Assert.AreEqual(151, foreground.Elements.Count);
|
||||||
Assert.IsTrue(foreground.EnabledWhenFailing);
|
Assert.IsTrue(foreground.VisibleWhenFailing);
|
||||||
Assert.IsTrue(foreground.EnabledWhenPassing);
|
Assert.IsTrue(foreground.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Foreground", foreground.Name);
|
Assert.AreEqual("Foreground", foreground.Name);
|
||||||
|
|
||||||
int spriteCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
|
int spriteCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
|
||||||
|
@ -44,7 +44,6 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
drawableStoryboard = storyboard.CreateDrawable();
|
drawableStoryboard = storyboard.CreateDrawable();
|
||||||
drawableStoryboard.Masking = true;
|
|
||||||
|
|
||||||
if (async)
|
if (async)
|
||||||
LoadComponentAsync(drawableStoryboard, Add);
|
LoadComponentAsync(drawableStoryboard, Add);
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
private void updateLayerVisibility()
|
private void updateLayerVisibility()
|
||||||
{
|
{
|
||||||
foreach (var layer in Children)
|
foreach (var layer in Children)
|
||||||
layer.Enabled = passing ? layer.Layer.EnabledWhenPassing : layer.Layer.EnabledWhenFailing;
|
layer.Enabled = passing ? layer.Layer.VisibleWhenPassing : layer.Layer.VisibleWhenFailing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Enabled = layer.EnabledWhenPassing;
|
Enabled = layer.VisibleWhenPassing;
|
||||||
|
Masking = layer.Masking;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -22,8 +22,8 @@ namespace osu.Game.Storyboards
|
|||||||
public Storyboard()
|
public Storyboard()
|
||||||
{
|
{
|
||||||
layers.Add("Background", new StoryboardLayer("Background", 3));
|
layers.Add("Background", new StoryboardLayer("Background", 3));
|
||||||
layers.Add("Fail", new StoryboardLayer("Fail", 2) { EnabledWhenPassing = false, });
|
layers.Add("Fail", new StoryboardLayer("Fail", 2) { VisibleWhenPassing = false, });
|
||||||
layers.Add("Pass", new StoryboardLayer("Pass", 1) { EnabledWhenFailing = false, });
|
layers.Add("Pass", new StoryboardLayer("Pass", 1) { VisibleWhenFailing = false, });
|
||||||
layers.Add("Foreground", new StoryboardLayer("Foreground", 0));
|
layers.Add("Foreground", new StoryboardLayer("Foreground", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,17 +8,23 @@ namespace osu.Game.Storyboards
|
|||||||
{
|
{
|
||||||
public class StoryboardLayer
|
public class StoryboardLayer
|
||||||
{
|
{
|
||||||
public string Name;
|
public readonly string Name;
|
||||||
public int Depth;
|
|
||||||
public bool EnabledWhenPassing = true;
|
public readonly int Depth;
|
||||||
public bool EnabledWhenFailing = true;
|
|
||||||
|
public readonly bool Masking;
|
||||||
|
|
||||||
|
public bool VisibleWhenPassing = true;
|
||||||
|
|
||||||
|
public bool VisibleWhenFailing = true;
|
||||||
|
|
||||||
public List<IStoryboardElement> Elements = new List<IStoryboardElement>();
|
public List<IStoryboardElement> Elements = new List<IStoryboardElement>();
|
||||||
|
|
||||||
public StoryboardLayer(string name, int depth)
|
public StoryboardLayer(string name, int depth, bool masking = true)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Depth = depth;
|
Depth = depth;
|
||||||
|
Masking = masking;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(IStoryboardElement element)
|
public void Add(IStoryboardElement element)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user