1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 15:12:57 +08:00

Implement TimelineButton and use for the magnification buttons

This commit is contained in:
smoogipoo 2017-10-12 16:10:14 +09:00
parent 2844764e3c
commit de8f9325a3
4 changed files with 53 additions and 16 deletions

View File

@ -76,27 +76,21 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex("333") Colour = OsuColour.FromHex("333")
}, },
new FillFlowContainer new Container
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = 15 }, AutoSizeAxes = Axes.X,
Direction = FillDirection.Vertical, Padding = new MarginPadding { Vertical = 5 },
Spacing = new Vector2(0, 30),
Children = new[] Children = new[]
{ {
new SpriteIcon new TimelineButton { Icon = FontAwesome.fa_search_plus },
new TimelineButton
{ {
Size = new Vector2(18), Anchor = Anchor.BottomLeft,
Icon = FontAwesome.fa_search_plus, Origin = Anchor.BottomLeft,
Colour = OsuColour.FromHex("555") Icon = FontAwesome.fa_search_minus
},
new SpriteIcon
{
Size = new Vector2(18),
Icon = FontAwesome.fa_search_minus,
Colour = OsuColour.FromHex("555")
}, },
} }
} }

View File

@ -0,0 +1,42 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
{
public class TimelineButton : CompositeDrawable
{
public Action Action;
public readonly BindableBool Enabled = new BindableBool(true);
public FontAwesome Icon
{
get { return button.Icon; }
set { button.Icon = value; }
}
private readonly IconButton button;
public TimelineButton()
{
InternalChild = button = new IconButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
IconColour = OsuColour.FromHex("555"),
HoverColour = OsuColour.FromHex("3A3A3A"),
FlashColour = OsuColour.FromHex("555"),
Action = () => Action?.Invoke()
};
button.Enabled.BindTo(Enabled);
Size = button.ButtonSize;
}
}
}

View File

@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual
{ {
public class TestCaseEditorComposeTimeline : OsuTestCase public class TestCaseEditorComposeTimeline : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ScrollableTimeline), typeof(ScrollingTimelineContainer), typeof(BeatmapWaveformGraph) }; public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ScrollableTimeline), typeof(ScrollingTimelineContainer), typeof(BeatmapWaveformGraph), typeof(TimelineButton) };
private readonly ScrollableTimeline timeline; private readonly ScrollableTimeline timeline;

View File

@ -275,6 +275,7 @@
<Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" /> <Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" />
<Compile Include="Beatmaps\IO\ArchiveReader.cs" /> <Compile Include="Beatmaps\IO\ArchiveReader.cs" />
<Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" /> <Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\TimelineButton.cs" />
<Compile Include="Screens\Play\BreaksOverlay\ArrowsOverlay.cs" /> <Compile Include="Screens\Play\BreaksOverlay\ArrowsOverlay.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BlurredIcon.cs" /> <Compile Include="Screens\Play\BreaksOverlay\BlurredIcon.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BreakOverlay.cs" /> <Compile Include="Screens\Play\BreaksOverlay\BreakOverlay.cs" />