mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 14:23:14 +08:00
Add divisor text
This commit is contained in:
parent
66e4e45882
commit
7182442b21
@ -6,6 +6,7 @@ using osu.Framework.Configuration;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -18,6 +19,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.BeatSnap
|
|||||||
public readonly Bindable<int> Divisor = new Bindable<int>(1);
|
public readonly Bindable<int> Divisor = new Bindable<int>(1);
|
||||||
|
|
||||||
private TickContainer tickContainer;
|
private TickContainer tickContainer;
|
||||||
|
private DivisorText text;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
@ -74,7 +76,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.BeatSnap
|
|||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_chevron_left,
|
Icon = FontAwesome.fa_chevron_left,
|
||||||
},
|
},
|
||||||
null,
|
text = new DivisorText(),
|
||||||
new DivisorButton
|
new DivisorButton
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_chevron_right,
|
Icon = FontAwesome.fa_chevron_right,
|
||||||
@ -111,6 +113,28 @@ namespace osu.Game.Screens.Edit.Screens.Compose.BeatSnap
|
|||||||
};
|
};
|
||||||
|
|
||||||
tickContainer.Divisor.BindTo(Divisor);
|
tickContainer.Divisor.BindTo(Divisor);
|
||||||
|
text.Divisor.BindTo(Divisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DivisorText : SpriteText
|
||||||
|
{
|
||||||
|
public readonly Bindable<int> Divisor = new Bindable<int>();
|
||||||
|
|
||||||
|
public DivisorText()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Divisor.ValueChanged += v => updateText();
|
||||||
|
updateText();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateText() => Text = $"1/{Divisor.Value}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DivisorButton : IconButton
|
private class DivisorButton : IconButton
|
||||||
|
Loading…
Reference in New Issue
Block a user