1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-07 01:07:20 +08:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

146 lines
6.0 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-05-18 13:05:58 +09:00
2019-12-05 20:12:25 +09:00
using osu.Framework.Allocation;
using osu.Framework.Bindables;
2018-05-18 13:05:58 +09:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
2018-11-20 16:51:59 +09:00
using osuTK;
2018-05-18 13:05:58 +09:00
2018-11-06 18:28:22 +09:00
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
2018-05-18 13:05:58 +09:00
{
public partial class TimelineArea : CompositeDrawable
2018-05-18 13:05:58 +09:00
{
2023-07-14 14:04:12 +09:00
public Timeline Timeline = null!;
2018-05-18 13:05:58 +09:00
private readonly Drawable userContent;
private Box timelineBackground = null!;
private readonly Bindable<bool> composerFocusMode = new Bindable<bool>();
2023-07-14 14:04:12 +09:00
public TimelineArea(Drawable? content = null)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
2023-07-14 14:04:12 +09:00
userContent = content ?? Empty();
}
2019-12-05 20:12:25 +09:00
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours, Editor? editor)
2018-05-18 13:05:58 +09:00
{
const float padding = 10;
2018-05-18 13:05:58 +09:00
InternalChildren = new Drawable[]
{
new Box
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Width = 35 + HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT,
RelativeSizeAxes = Axes.Y,
Colour = colourProvider.Background4
},
2018-05-18 13:05:58 +09:00
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 35),
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT),
},
2018-05-18 13:05:58 +09:00
Content = new[]
{
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
timelineBackground = new Box
{
RelativeSizeAxes = Axes.Both,
Depth = float.MaxValue,
Colour = colourProvider.Background5
},
Timeline = new Timeline(userContent),
}
},
2018-05-18 13:05:58 +09:00
new Container
{
RelativeSizeAxes = Axes.Both,
Name = @"Zoom controls",
Padding = new MarginPadding { Right = padding },
2018-05-18 13:05:58 +09:00
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
2018-05-18 13:05:58 +09:00
},
new Container<TimelineButton>
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Both,
2018-05-18 13:05:58 +09:00
Children = new[]
{
new TimelineButton
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
2019-04-02 19:55:24 +09:00
Icon = FontAwesome.Solid.SearchPlus,
2022-07-22 14:44:48 +09:00
Action = () => Timeline.AdjustZoomRelatively(1)
2018-05-18 13:05:58 +09:00
},
new TimelineButton
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
2019-04-02 19:55:24 +09:00
Icon = FontAwesome.Solid.SearchMinus,
2022-07-22 14:44:48 +09:00
Action = () => Timeline.AdjustZoomRelatively(-1)
2018-05-18 13:05:58 +09:00
},
}
}
}
},
new BeatDivisorControl { RelativeSizeAxes = Axes.Both }
2018-05-18 13:05:58 +09:00
},
},
}
};
if (editor != null)
composerFocusMode.BindTo(editor.ComposerFocusMode);
}
protected override void LoadComplete()
{
base.LoadComplete();
composerFocusMode.BindValueChanged(_ =>
{
// Transforms should be kept in sync with other usages of composer focus mode.
if (!composerFocusMode.Value)
timelineBackground.FadeIn(750, Easing.OutQuint);
else
timelineBackground.Delay(600).FadeTo(0.5f, 4000, Easing.OutQuint);
}, true);
2018-05-18 13:05:58 +09:00
}
}
}