1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:43:00 +08:00

Move grids to inside columns

This commit is contained in:
Dean Herbert 2020-05-18 17:47:47 +09:00
parent 32dd00cb17
commit d9bb90078b
3 changed files with 32 additions and 26 deletions

View File

@ -7,12 +7,10 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
@ -22,7 +20,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Edit
{
public class ManiaBeatSnapGrid : CompositeDrawable
public class ManiaBeatSnapGrid : Component
{
/// <summary>
/// The brightness of bar lines one beat around the time range from <see cref="SetRange"/>.
@ -54,15 +52,32 @@ namespace osu.Game.Rulesets.Mania.Edit
{
foreach (var stage in composer.Playfield.Stages)
{
var grid = new Grid(stage);
grids.Add(grid);
foreach (var column in stage.Columns)
{
var grid = new Grid();
AddInternal(grid);
grids.Add(grid);
column.UnderlayElements.Add(grid);
}
}
beatDivisor.BindValueChanged(_ => createLines(), true);
}
public override void Hide()
{
base.Hide();
foreach (var grid in grids)
grid.Hide();
}
public override void Show()
{
base.Show();
foreach (var grid in grids)
grid.Show();
}
private void createLines()
{
foreach (var grid in grids)
@ -145,7 +160,7 @@ namespace osu.Game.Rulesets.Mania.Edit
linesDuring.Clear();
linesAfter.Clear();
foreach (var line in grid.AliveObjects.OfType<DrawableGridLine>())
foreach (var line in grid.Objects.OfType<DrawableGridLine>())
{
if (line.HitObject.StartTime < minTime)
linesBefore.Add(line);
@ -202,30 +217,11 @@ namespace osu.Game.Rulesets.Mania.Edit
[Resolved]
private IManiaHitObjectComposer composer { get; set; }
private readonly Stage stage;
public Grid(Stage stage)
{
this.stage = stage;
RelativeSizeAxes = Axes.None;
}
protected override void LoadComplete()
{
base.LoadComplete();
Clock = composer.Playfield.Clock;
}
protected override void Update()
{
base.Update();
var parentQuad = Parent.ToLocalSpace(stage.HitObjectContainer.ScreenSpaceDrawQuad);
Position = parentQuad.TopLeft;
Size = parentQuad.Size;
}
}
private class DrawableGridLine : DrawableHitObject

View File

@ -37,6 +37,8 @@ namespace osu.Game.Rulesets.Mania.UI
internal readonly Container TopLevelContainer;
public Container UnderlayElements => hitObjectArea.UnderlayElements;
public Column(int index)
{
Index = index;

View File

@ -12,6 +12,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components
public class ColumnHitObjectArea : HitObjectArea
{
public readonly Container Explosions;
public readonly Container UnderlayElements;
private readonly Drawable hitTarget;
public ColumnHitObjectArea(int columnIndex, HitObjectContainer hitObjectContainer)
@ -19,6 +22,11 @@ namespace osu.Game.Rulesets.Mania.UI.Components
{
AddRangeInternal(new[]
{
UnderlayElements = new Container
{
RelativeSizeAxes = Axes.Both,
Depth = 2,
},
hitTarget = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitTarget, columnIndex), _ => new DefaultHitTarget())
{
RelativeSizeAxes = Axes.X,