mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:02:57 +08:00
Merge pull request #2247 from smoogipoo/beat-snap-divisor
Implement the editor's beat snap divisor
This commit is contained in:
commit
bedb427ceb
28
osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs
Normal file
28
osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseBeatDivisorControl : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(BindableBeatDivisor) };
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Child = new BeatDivisorControl(new BindableBeatDivisor())
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(90, 90)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Timing;
|
||||
@ -13,6 +15,8 @@ namespace osu.Game.Tests.Visual
|
||||
[TestFixture]
|
||||
public class TestCaseEditorCompose : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Compose) };
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
|
@ -18,6 +18,7 @@ using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
@ -31,6 +32,8 @@ namespace osu.Game.Tests.Visual
|
||||
private Track track;
|
||||
private HitObjectComposer composer;
|
||||
|
||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor(4);
|
||||
|
||||
private DecoupleableInterpolatingFramedClock clock;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
@ -44,6 +47,7 @@ namespace osu.Game.Tests.Visual
|
||||
clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
||||
dependencies.CacheAs<IAdjustableClock>(clock);
|
||||
dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||
dependencies.Cache(beatDivisor);
|
||||
|
||||
var testBeatmap = new Beatmap
|
||||
{
|
||||
|
@ -116,6 +116,7 @@
|
||||
<Compile Include="Visual\TestCaseBeatmapOptionsOverlay.cs" />
|
||||
<Compile Include="Visual\TestCaseBeatmapScoresContainer.cs" />
|
||||
<Compile Include="Visual\TestCaseBeatmapSetOverlay.cs" />
|
||||
<Compile Include="Visual\TestCaseBeatDivisorControl.cs" />
|
||||
<Compile Include="Visual\TestCaseBeatSyncedContainer.cs" />
|
||||
<Compile Include="Visual\TestCaseBreadcrumbs.cs" />
|
||||
<Compile Include="Visual\TestCaseBreakOverlay.cs" />
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
@ -16,6 +17,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.RadioButtons;
|
||||
|
||||
@ -31,6 +33,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
private readonly List<Container> layerContainers = new List<Container>();
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
||||
|
||||
private IAdjustableClock adjustableClock;
|
||||
|
||||
@ -41,11 +44,14 @@ namespace osu.Game.Rulesets.Edit
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase osuGame, IAdjustableClock adjustableClock, IFrameBasedClock framedClock)
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load([NotNull] OsuGameBase osuGame, [NotNull] IAdjustableClock adjustableClock, [NotNull] IFrameBasedClock framedClock, [CanBeNull] BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
this.adjustableClock = adjustableClock;
|
||||
|
||||
if (beatDivisor != null)
|
||||
this.beatDivisor.BindTo(beatDivisor);
|
||||
|
||||
beatmap.BindTo(osuGame.Beatmap);
|
||||
|
||||
try
|
||||
@ -167,9 +173,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
private void seek(int direction, bool snapped)
|
||||
{
|
||||
// Todo: This should not be a constant, but feels good for now
|
||||
const int beat_snap_divisor = 4;
|
||||
|
||||
var cpi = beatmap.Value.Beatmap.ControlPointInfo;
|
||||
|
||||
var timingPoint = cpi.TimingPointAt(adjustableClock.CurrentTime);
|
||||
@ -181,7 +184,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
timingPoint = cpi.TimingPoints[--activeIndex];
|
||||
}
|
||||
|
||||
double seekAmount = timingPoint.BeatLength / beat_snap_divisor;
|
||||
double seekAmount = timingPoint.BeatLength / beatDivisor;
|
||||
double seekTime = adjustableClock.CurrentTime + seekAmount * direction;
|
||||
|
||||
if (!snapped || cpi.TimingPoints.Count == 0)
|
||||
@ -222,9 +225,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
public void SeekTo(double seekTime, bool snapped = false)
|
||||
{
|
||||
// Todo: This should not be a constant, but feels good for now
|
||||
const int beat_snap_divisor = 4;
|
||||
|
||||
if (!snapped)
|
||||
{
|
||||
adjustableClock.Seek(seekTime);
|
||||
@ -232,7 +232,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
|
||||
var timingPoint = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(seekTime);
|
||||
double beatSnapLength = timingPoint.BeatLength / beat_snap_divisor;
|
||||
double beatSnapLength = timingPoint.BeatLength / beatDivisor;
|
||||
|
||||
// We will be snapping to beats within the timing point
|
||||
seekTime -= timingPoint.Time;
|
||||
|
398
osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs
Normal file
398
osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs
Normal file
@ -0,0 +1,398 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
{
|
||||
public class BeatDivisorControl : CompositeDrawable
|
||||
{
|
||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
||||
private int currentDivisorIndex;
|
||||
|
||||
public BeatDivisorControl(BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
this.beatDivisor.BindTo(beatDivisor);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Name = "Gray Background",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Gray4
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Name = "Black Background",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black
|
||||
},
|
||||
new TickSliderBar(beatDivisor, BindableBeatDivisor.VALID_DIVISORS)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Gray4
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = 5 },
|
||||
Child = new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new DivisorButton
|
||||
{
|
||||
Icon = FontAwesome.fa_chevron_left,
|
||||
Action = beatDivisor.Previous
|
||||
},
|
||||
new DivisorText(beatDivisor),
|
||||
new DivisorButton
|
||||
{
|
||||
Icon = FontAwesome.fa_chevron_right,
|
||||
Action = beatDivisor.Next
|
||||
}
|
||||
},
|
||||
},
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.Absolute, 20),
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Absolute, 20)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new TextFlowContainer(s => s.TextSize = 14)
|
||||
{
|
||||
Padding = new MarginPadding { Horizontal = 15 },
|
||||
Text = "beat snap divisor",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TextAnchor = Anchor.TopCentre
|
||||
},
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.Absolute, 30),
|
||||
new Dimension(GridSizeMode.Absolute, 25),
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class DivisorText : SpriteText
|
||||
{
|
||||
private readonly Bindable<int> beatDivisor = new Bindable<int>();
|
||||
|
||||
public DivisorText(BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
this.beatDivisor.BindTo(beatDivisor);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
beatDivisor.ValueChanged += v => updateText();
|
||||
updateText();
|
||||
}
|
||||
|
||||
private void updateText() => Text = $"1/{beatDivisor.Value}";
|
||||
}
|
||||
|
||||
private class DivisorButton : IconButton
|
||||
{
|
||||
public DivisorButton()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
// Small offset to look a bit better centered along with the divisor text
|
||||
Y = 1;
|
||||
|
||||
ButtonSize = new Vector2(20);
|
||||
IconScale = new Vector2(0.6f);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
IconColour = Color4.Black;
|
||||
HoverColour = colours.Gray7;
|
||||
FlashColour = colours.Gray9;
|
||||
}
|
||||
}
|
||||
|
||||
private class TickSliderBar : SliderBar<int>
|
||||
{
|
||||
private Marker marker;
|
||||
|
||||
private readonly BindableBeatDivisor beatDivisor;
|
||||
private readonly int[] availableDivisors;
|
||||
|
||||
public TickSliderBar(BindableBeatDivisor beatDivisor, params int[] divisors)
|
||||
{
|
||||
CurrentNumber.BindTo(this.beatDivisor = beatDivisor);
|
||||
availableDivisors = divisors;
|
||||
|
||||
Padding = new MarginPadding { Horizontal = 5 };
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
foreach (var t in availableDivisors)
|
||||
{
|
||||
AddInternal(new Tick(t)
|
||||
{
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = getMappedPosition(t)
|
||||
});
|
||||
}
|
||||
|
||||
AddInternal(marker = new Marker());
|
||||
|
||||
CurrentNumber.ValueChanged += v =>
|
||||
{
|
||||
marker.MoveToX(getMappedPosition(v), 100, Easing.OutQuint);
|
||||
marker.Flash();
|
||||
};
|
||||
}
|
||||
|
||||
protected override void UpdateValue(float value)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HandleKeyboardInput => IsHovered && !CurrentNumber.Disabled;
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.Right:
|
||||
beatDivisor.Next();
|
||||
OnUserChange();
|
||||
return true;
|
||||
case Key.Left:
|
||||
beatDivisor.Previous();
|
||||
OnUserChange();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
marker.Active = true;
|
||||
return base.OnMouseDown(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||
{
|
||||
marker.Active = false;
|
||||
return base.OnMouseUp(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
handleMouseInput(state);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
handleMouseInput(state);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleMouseInput(InputState state)
|
||||
{
|
||||
// copied from SliderBar so we can do custom spacing logic.
|
||||
var xPosition = (ToLocalSpace(state?.Mouse.NativeState.Position ?? Vector2.Zero).X - RangePadding) / UsableWidth;
|
||||
|
||||
CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First();
|
||||
OnUserChange();
|
||||
}
|
||||
|
||||
private float getMappedPosition(float divisor) => (float)Math.Pow((divisor - 1) / (availableDivisors.Last() - 1), 0.90f);
|
||||
|
||||
private class Tick : CompositeDrawable
|
||||
{
|
||||
private readonly int divisor;
|
||||
|
||||
public Tick(int divisor)
|
||||
{
|
||||
this.divisor = divisor;
|
||||
Size = new Vector2(2.5f, 10);
|
||||
|
||||
InternalChild = new Box { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
CornerRadius = 0.5f;
|
||||
Masking = true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = getColourForDivisor(divisor, colours);
|
||||
}
|
||||
|
||||
private ColourInfo getColourForDivisor(int divisor, OsuColour colours)
|
||||
{
|
||||
switch (divisor)
|
||||
{
|
||||
case 2:
|
||||
return colours.BlueLight;
|
||||
case 4:
|
||||
return colours.Blue;
|
||||
case 8:
|
||||
return colours.BlueDarker;
|
||||
case 16:
|
||||
return colours.PurpleDark;
|
||||
case 3:
|
||||
return colours.YellowLight;
|
||||
case 6:
|
||||
return colours.Yellow;
|
||||
case 12:
|
||||
return colours.YellowDarker;
|
||||
default:
|
||||
return Color4.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Marker : CompositeDrawable
|
||||
{
|
||||
private Color4 defaultColour;
|
||||
|
||||
private const float size = 7;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = defaultColour = colours.Gray4;
|
||||
Anchor = Anchor.TopLeft;
|
||||
Origin = Anchor.TopCentre;
|
||||
|
||||
Width = size;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
RelativePositionAxes = Axes.X;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Width = 2,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Colour = ColourInfo.GradientVertical(Color4.White.Opacity(0.2f), Color4.White),
|
||||
Blending = BlendingMode.Additive,
|
||||
},
|
||||
new EquilateralTriangle
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Height = size,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
Colour = Color4.White,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private bool active;
|
||||
|
||||
public bool Active
|
||||
{
|
||||
get => active;
|
||||
set
|
||||
{
|
||||
this.FadeColour(value ? Color4.White : defaultColour, 500, Easing.OutQuint);
|
||||
active = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Flash()
|
||||
{
|
||||
bool wasActive = active;
|
||||
|
||||
Active = true;
|
||||
|
||||
if (wasActive) return;
|
||||
|
||||
using (BeginDelayedSequence(50))
|
||||
Active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
39
osu.Game/Screens/Edit/Screens/Compose/BindableBeatDivisor.cs
Normal file
39
osu.Game/Screens/Edit/Screens/Compose/BindableBeatDivisor.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
{
|
||||
public class BindableBeatDivisor : BindableNumber<int>
|
||||
{
|
||||
public static readonly int[] VALID_DIVISORS = { 1, 2, 3, 4, 6, 8, 12, 16 };
|
||||
|
||||
public BindableBeatDivisor(int value = 1)
|
||||
: base(value)
|
||||
{
|
||||
}
|
||||
|
||||
public void Next() => Value = VALID_DIVISORS[Math.Min(VALID_DIVISORS.Length - 1, Array.IndexOf(VALID_DIVISORS, Value) + 1)];
|
||||
|
||||
public void Previous() => Value = VALID_DIVISORS[Math.Max(0, Array.IndexOf(VALID_DIVISORS, Value) - 1)];
|
||||
|
||||
public override int Value
|
||||
{
|
||||
get { return base.Value; }
|
||||
set
|
||||
{
|
||||
if (!VALID_DIVISORS.Contains(value))
|
||||
throw new ArgumentOutOfRangeException($"Provided divisor is not in {nameof(VALID_DIVISORS)}");
|
||||
|
||||
base.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override int DefaultMinValue => VALID_DIVISORS.First();
|
||||
protected override int DefaultMaxValue => VALID_DIVISORS.Last();
|
||||
protected override int DefaultPrecision => 1;
|
||||
}
|
||||
}
|
@ -17,11 +17,20 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
private const float vertical_margins = 10;
|
||||
private const float horizontal_margins = 20;
|
||||
|
||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
||||
|
||||
private Container composerContainer;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(parent);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
dependencies.Cache(beatDivisor);
|
||||
|
||||
ScrollableTimeline timeline;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -48,15 +57,28 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
Name = "Timeline content",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
|
||||
Children = new Drawable[]
|
||||
Child = new GridContainer
|
||||
{
|
||||
new Container
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 115 },
|
||||
Child = timeline = new ScrollableTimeline { RelativeSizeAxes = Axes.Both }
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 5 },
|
||||
Child = timeline = new ScrollableTimeline { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
},
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Absolute, 90),
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -381,6 +381,8 @@
|
||||
<Compile Include="Rulesets\Replays\Types\IConvertibleReplayFrame.cs" />
|
||||
<Compile Include="Rulesets\Scoring\Legacy\LegacyScoreParser.cs" />
|
||||
<Compile Include="Rulesets\UI\JudgementContainer.cs" />
|
||||
<Compile Include="Screens\Edit\Screens\Compose\BindableBeatDivisor.cs" />
|
||||
<Compile Include="Screens\Edit\Screens\Compose\BeatDivisorControl.cs" />
|
||||
<Compile Include="Screens\Edit\Screens\Compose\Layers\BorderLayer.cs" />
|
||||
<Compile Include="Screens\Edit\Screens\Compose\Layers\HitObjectMaskLayer.cs" />
|
||||
<Compile Include="Screens\Edit\Screens\Compose\Layers\SelectionBox.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user