mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Move grids to inside columns
This commit is contained in:
parent
32dd00cb17
commit
d9bb90078b
@ -7,12 +7,10 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
@ -22,7 +20,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit
|
namespace osu.Game.Rulesets.Mania.Edit
|
||||||
{
|
{
|
||||||
public class ManiaBeatSnapGrid : CompositeDrawable
|
public class ManiaBeatSnapGrid : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The brightness of bar lines one beat around the time range from <see cref="SetRange"/>.
|
/// 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)
|
foreach (var stage in composer.Playfield.Stages)
|
||||||
{
|
{
|
||||||
var grid = new Grid(stage);
|
foreach (var column in stage.Columns)
|
||||||
grids.Add(grid);
|
{
|
||||||
|
var grid = new Grid();
|
||||||
|
|
||||||
AddInternal(grid);
|
grids.Add(grid);
|
||||||
|
column.UnderlayElements.Add(grid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
beatDivisor.BindValueChanged(_ => createLines(), true);
|
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()
|
private void createLines()
|
||||||
{
|
{
|
||||||
foreach (var grid in grids)
|
foreach (var grid in grids)
|
||||||
@ -145,7 +160,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
linesDuring.Clear();
|
linesDuring.Clear();
|
||||||
linesAfter.Clear();
|
linesAfter.Clear();
|
||||||
|
|
||||||
foreach (var line in grid.AliveObjects.OfType<DrawableGridLine>())
|
foreach (var line in grid.Objects.OfType<DrawableGridLine>())
|
||||||
{
|
{
|
||||||
if (line.HitObject.StartTime < minTime)
|
if (line.HitObject.StartTime < minTime)
|
||||||
linesBefore.Add(line);
|
linesBefore.Add(line);
|
||||||
@ -202,30 +217,11 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IManiaHitObjectComposer composer { get; set; }
|
private IManiaHitObjectComposer composer { get; set; }
|
||||||
|
|
||||||
private readonly Stage stage;
|
|
||||||
|
|
||||||
public Grid(Stage stage)
|
|
||||||
{
|
|
||||||
this.stage = stage;
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
Clock = composer.Playfield.Clock;
|
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
|
private class DrawableGridLine : DrawableHitObject
|
||||||
|
@ -37,6 +37,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
internal readonly Container TopLevelContainer;
|
internal readonly Container TopLevelContainer;
|
||||||
|
|
||||||
|
public Container UnderlayElements => hitObjectArea.UnderlayElements;
|
||||||
|
|
||||||
public Column(int index)
|
public Column(int index)
|
||||||
{
|
{
|
||||||
Index = index;
|
Index = index;
|
||||||
|
@ -12,6 +12,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
public class ColumnHitObjectArea : HitObjectArea
|
public class ColumnHitObjectArea : HitObjectArea
|
||||||
{
|
{
|
||||||
public readonly Container Explosions;
|
public readonly Container Explosions;
|
||||||
|
|
||||||
|
public readonly Container UnderlayElements;
|
||||||
|
|
||||||
private readonly Drawable hitTarget;
|
private readonly Drawable hitTarget;
|
||||||
|
|
||||||
public ColumnHitObjectArea(int columnIndex, HitObjectContainer hitObjectContainer)
|
public ColumnHitObjectArea(int columnIndex, HitObjectContainer hitObjectContainer)
|
||||||
@ -19,6 +22,11 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
{
|
{
|
||||||
AddRangeInternal(new[]
|
AddRangeInternal(new[]
|
||||||
{
|
{
|
||||||
|
UnderlayElements = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Depth = 2,
|
||||||
|
},
|
||||||
hitTarget = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitTarget, columnIndex), _ => new DefaultHitTarget())
|
hitTarget = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitTarget, columnIndex), _ => new DefaultHitTarget())
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Loading…
Reference in New Issue
Block a user