1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:07:44 +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,
Colour = OsuColour.FromHex("333")
},
new FillFlowContainer
new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = 15 },
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 30),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Padding = new MarginPadding { Vertical = 5 },
Children = new[]
{
new SpriteIcon
new TimelineButton { Icon = FontAwesome.fa_search_plus },
new TimelineButton
{
Size = new Vector2(18),
Icon = FontAwesome.fa_search_plus,
Colour = OsuColour.FromHex("555")
},
new SpriteIcon
{
Size = new Vector2(18),
Icon = FontAwesome.fa_search_minus,
Colour = OsuColour.FromHex("555")
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Icon = FontAwesome.fa_search_minus
},
}
}

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 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;

View File

@ -275,6 +275,7 @@
<Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" />
<Compile Include="Beatmaps\IO\ArchiveReader.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\BlurredIcon.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BreakOverlay.cs" />