mirror of
https://github.com/ppy/osu
synced 2025-02-07 13:51:59 +00:00
Pass in content
This commit is contained in:
parent
967238e269
commit
18d3685023
@ -24,14 +24,13 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(300, 500),
|
||||
Child = cover = new PlayfieldCoveringContainer
|
||||
Child = cover = new PlayfieldCoveringContainer(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Orange
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Orange
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
@ -14,6 +15,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public override IconUsage? Icon => OsuIcon.ModHidden;
|
||||
public override string Description => @"Keys appear out of nowhere!";
|
||||
|
||||
protected override PlayfieldCoveringContainer CreateCover() => new PlayfieldCoveringContainer();
|
||||
protected override PlayfieldCoveringContainer CreateCover(Drawable content) => new PlayfieldCoveringContainer(content);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
Container hocParent = (Container)hoc.Parent;
|
||||
|
||||
hocParent.Remove(hoc);
|
||||
hocParent.Add(CreateCover().WithChild(hoc).With(c =>
|
||||
hocParent.Add(CreateCover(hoc).With(c =>
|
||||
{
|
||||
c.RelativeSizeAxes = Axes.Both;
|
||||
c.Coverage = 0.5f;
|
||||
@ -37,11 +37,12 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual PlayfieldCoveringContainer CreateCover() => new ModHiddenCoveringContainer();
|
||||
protected virtual PlayfieldCoveringContainer CreateCover(Drawable content) => new ModHiddenCoveringContainer(content);
|
||||
|
||||
private class ModHiddenCoveringContainer : PlayfieldCoveringContainer
|
||||
{
|
||||
public ModHiddenCoveringContainer()
|
||||
public ModHiddenCoveringContainer(Drawable content)
|
||||
: base(content)
|
||||
{
|
||||
// This cover extends outwards from the hit position.
|
||||
Cover.Scale = new Vector2(1, -1);
|
||||
|
@ -19,12 +19,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// <remarks>
|
||||
/// The covered area extends in the scrolling direction, with its size depending on <see cref="Coverage"/>.
|
||||
/// </remarks>
|
||||
public class PlayfieldCoveringContainer : Container
|
||||
public class PlayfieldCoveringContainer : CompositeDrawable
|
||||
{
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private readonly Container content;
|
||||
|
||||
/// <summary>
|
||||
/// The complete cover, including gradient and fill.
|
||||
/// </summary>
|
||||
@ -42,14 +38,14 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
private readonly IBindable<ScrollingDirection> scrollDirection = new Bindable<ScrollingDirection>();
|
||||
|
||||
public PlayfieldCoveringContainer()
|
||||
public PlayfieldCoveringContainer(Drawable content)
|
||||
{
|
||||
InternalChild = new BufferedContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
content = new Container { RelativeSizeAxes = Axes.Both },
|
||||
content,
|
||||
Cover = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
|
Loading…
Reference in New Issue
Block a user