mirror of
https://github.com/ppy/osu
synced 2025-01-12 09:09:44 +00:00
Merge branch 'master' into improve-filter-tab-item-ux
This commit is contained in:
commit
3862184f9c
@ -1,35 +1,64 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
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.Utils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
{
|
||||
public partial class ArgonFollowCircle : FollowCircle
|
||||
{
|
||||
private readonly CircularContainer circleContainer;
|
||||
private readonly Box circleFill;
|
||||
|
||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private DrawableHitObject? parentObject { get; set; }
|
||||
|
||||
public ArgonFollowCircle()
|
||||
{
|
||||
InternalChild = new CircularContainer
|
||||
InternalChild = circleContainer = new CircularContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = 4,
|
||||
BorderColour = ColourInfo.GradientVertical(Colour4.FromHex("FC618F"), Colour4.FromHex("BB1A41")),
|
||||
Blending = BlendingParameters.Additive,
|
||||
Child = new Box
|
||||
Child = circleFill = new Box
|
||||
{
|
||||
Colour = ColourInfo.GradientVertical(Colour4.FromHex("FC618F"), Colour4.FromHex("BB1A41")),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.3f,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (parentObject != null)
|
||||
accentColour.BindTo(parentObject.AccentColour);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
accentColour.BindValueChanged(colour =>
|
||||
{
|
||||
circleContainer.BorderColour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.5f));
|
||||
circleFill.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.5f));
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void OnSliderPress()
|
||||
{
|
||||
const float duration = 300f;
|
||||
|
@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -21,6 +23,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
|
||||
private readonly Vector2 defaultIconScale = new Vector2(0.6f, 0.8f);
|
||||
|
||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private DrawableHitObject? parentObject { get; set; }
|
||||
|
||||
@ -37,7 +41,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
{
|
||||
fill = new Box
|
||||
{
|
||||
Colour = ColourInfo.GradientVertical(Colour4.FromHex("FC618F"), Colour4.FromHex("BB1A41")),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -53,10 +56,22 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (parentObject != null)
|
||||
accentColour.BindTo(parentObject.AccentColour);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
accentColour.BindValueChanged(colour =>
|
||||
{
|
||||
fill.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.5f));
|
||||
}, true);
|
||||
|
||||
if (parentObject != null)
|
||||
{
|
||||
parentObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||
|
@ -55,6 +55,16 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestDisplay()
|
||||
{
|
||||
AddRepeatStep("toggle expanded state", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(group.ChildrenOfType<IconButton>().Single());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
}, 5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClickExpandButtonMultipleTimes()
|
||||
{
|
||||
|
@ -138,9 +138,18 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
// This avoids depth issues where a hovered (scaled) card to the right of another card would be beneath the card to the left.
|
||||
this.ScaleTo(Expanded.Value ? 1.03f : 1, 500, Easing.OutQuint);
|
||||
|
||||
background.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
dropdownContent.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
borderContainer.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
if (Expanded.Value)
|
||||
{
|
||||
background.FadeIn(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
dropdownContent.FadeIn(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
borderContainer.FadeIn(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
background.FadeOut(BeatmapCard.TRANSITION_DURATION / 3f, Easing.OutQuint);
|
||||
dropdownContent.FadeOut(BeatmapCard.TRANSITION_DURATION / 3f, Easing.OutQuint);
|
||||
borderContainer.FadeOut(BeatmapCard.TRANSITION_DURATION / 3f, Easing.OutQuint);
|
||||
}
|
||||
|
||||
content.TweenEdgeEffectTo(new EdgeEffectParameters
|
||||
{
|
||||
|
@ -34,8 +34,6 @@ namespace osu.Game.Beatmaps
|
||||
// TODO: remove once the fallback lookup is not required (and access via `working.BeatmapInfo.Metadata` directly).
|
||||
public BeatmapMetadata Metadata => BeatmapInfo.Metadata;
|
||||
|
||||
public Waveform Waveform => waveform.Value;
|
||||
|
||||
public Storyboard Storyboard => storyboard.Value;
|
||||
|
||||
public Texture Background => GetBackground(); // Texture uses ref counting, so we want to return a new instance every usage.
|
||||
@ -48,10 +46,11 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
private readonly object beatmapFetchLock = new object();
|
||||
|
||||
private readonly Lazy<Waveform> waveform;
|
||||
private readonly Lazy<Storyboard> storyboard;
|
||||
private readonly Lazy<ISkin> skin;
|
||||
|
||||
private Track track; // track is not Lazy as we allow transferring and loading multiple times.
|
||||
private Waveform waveform; // waveform is also not Lazy as the track may change.
|
||||
|
||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||
{
|
||||
@ -60,7 +59,6 @@ namespace osu.Game.Beatmaps
|
||||
BeatmapInfo = beatmapInfo;
|
||||
BeatmapSetInfo = beatmapInfo.BeatmapSet ?? new BeatmapSetInfo();
|
||||
|
||||
waveform = new Lazy<Waveform>(GetWaveform);
|
||||
storyboard = new Lazy<Storyboard>(GetStoryboard);
|
||||
skin = new Lazy<ISkin>(GetSkin);
|
||||
}
|
||||
@ -108,7 +106,16 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public virtual bool TrackLoaded => track != null;
|
||||
|
||||
public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||
public Track LoadTrack()
|
||||
{
|
||||
track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||
|
||||
// the track may have changed, recycle the current waveform.
|
||||
waveform?.Dispose();
|
||||
waveform = null;
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
public void PrepareTrackForPreview(bool looping, double offsetFromPreviewPoint = 0)
|
||||
{
|
||||
@ -171,6 +178,12 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
#endregion
|
||||
|
||||
#region Waveform
|
||||
|
||||
public Waveform Waveform => waveform ??= GetWaveform();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Beatmap
|
||||
|
||||
public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
|
||||
|
@ -85,7 +85,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
bool highlightHover = IsHovered && (!Active.Value || HighlightOnHoverWhenActive);
|
||||
|
||||
text.FadeColour(highlightHover ? ColourProvider.Content2 : GetStateColour(), 200, Easing.OutQuint);
|
||||
text.Font = text.Font.With(weight: Active.Value ? FontWeight.SemiBold : FontWeight.Regular);
|
||||
text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Regular);
|
||||
}
|
||||
|
||||
protected virtual Color4 GetStateColour() => Active.Value ? ColourProvider.Content1 : ColourProvider.Light2;
|
||||
|
@ -126,7 +126,8 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Expanded.BindValueChanged(updateExpandedState, true);
|
||||
Expanded.BindValueChanged(_ => updateExpandedState(true));
|
||||
updateExpandedState(false);
|
||||
|
||||
this.Delay(600).Schedule(updateFadeState);
|
||||
}
|
||||
@ -161,21 +162,25 @@ namespace osu.Game.Overlays
|
||||
return base.OnInvalidate(invalidation, source);
|
||||
}
|
||||
|
||||
private void updateExpandedState(ValueChangedEvent<bool> expanded)
|
||||
private void updateExpandedState(bool animate)
|
||||
{
|
||||
// clearing transforms is necessary to avoid a previous height transform
|
||||
// potentially continuing to get processed while content has changed to autosize.
|
||||
content.ClearTransforms();
|
||||
|
||||
if (expanded.NewValue)
|
||||
if (Expanded.Value)
|
||||
{
|
||||
content.AutoSizeAxes = Axes.Y;
|
||||
content.AutoSizeDuration = animate ? transition_duration : 0;
|
||||
content.AutoSizeEasing = Easing.OutQuint;
|
||||
}
|
||||
else
|
||||
{
|
||||
content.AutoSizeAxes = Axes.None;
|
||||
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
||||
content.ResizeHeightTo(0, animate ? transition_duration : 0, Easing.OutQuint);
|
||||
}
|
||||
|
||||
headerContent.FadeColour(expanded.NewValue ? Color4.White : OsuColour.Gray(0.5f), 200, Easing.OutQuint);
|
||||
headerContent.FadeColour(Expanded.Value ? Color4.White : OsuColour.Gray(0.5f), 200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private void updateFadeState()
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -35,8 +36,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
public readonly Bindable<bool> TicksVisible = new Bindable<bool>();
|
||||
|
||||
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
[Resolved]
|
||||
private EditorClock editorClock { get; set; }
|
||||
|
||||
@ -92,6 +91,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
private double trackLengthForZoom;
|
||||
|
||||
private readonly IBindable<Track> track = new Bindable<Track>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OsuConfigManager config)
|
||||
{
|
||||
@ -139,11 +140,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
||||
|
||||
Beatmap.BindTo(beatmap);
|
||||
Beatmap.BindValueChanged(b =>
|
||||
{
|
||||
waveform.Waveform = b.NewValue.Waveform;
|
||||
}, true);
|
||||
track.BindTo(editorClock.Track);
|
||||
track.BindValueChanged(_ => waveform.Waveform = beatmap.Value.Waveform, true);
|
||||
|
||||
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
new WaveformComparisonDisplay(),
|
||||
new WaveformComparisonDisplay()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Audio;
|
||||
@ -294,13 +295,18 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
|
||||
|
||||
private readonly IBindable<Track> track = new Bindable<Track>();
|
||||
|
||||
public WaveformRow(bool isMainRow)
|
||||
{
|
||||
this.isMainRow = isMainRow;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
private void load(EditorClock clock)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -330,6 +336,13 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
Colour = colourProvider.Content2
|
||||
}
|
||||
};
|
||||
|
||||
track.BindTo(clock.Track);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
track.ValueChanged += _ => waveformGraph.Waveform = beatmap.Value.Waveform;
|
||||
}
|
||||
|
||||
public int BeatIndex { set => beatIndexText.Text = value.ToString(); }
|
||||
|
Loading…
Reference in New Issue
Block a user