mirror of
https://github.com/ppy/osu.git
synced 2025-03-22 02:17:19 +08:00
Merge branch 'mod-overlay/back-button' into mod-overlay/integration
This commit is contained in:
commit
9a56f6db44
@ -30,6 +30,8 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public abstract class ModSelectScreen : ShearedOverlayContainer
|
||||
{
|
||||
protected const int BUTTON_WIDTH = 200;
|
||||
|
||||
[Cached]
|
||||
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; private set; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
|
||||
@ -65,12 +67,12 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
protected virtual IEnumerable<ShearedButton> CreateFooterButtons() => new[]
|
||||
{
|
||||
customisationButton = new ShearedToggleButton(200)
|
||||
customisationButton = new ShearedToggleButton(BUTTON_WIDTH)
|
||||
{
|
||||
Text = ModSelectScreenStrings.ModCustomisation,
|
||||
Active = { BindTarget = customisationVisible }
|
||||
},
|
||||
new ShearedButton(200)
|
||||
new ShearedButton(BUTTON_WIDTH)
|
||||
{
|
||||
Text = CommonStrings.DeselectAll,
|
||||
Action = DeselectAll
|
||||
@ -83,8 +85,10 @@ namespace osu.Game.Overlays.Mods
|
||||
private ModSettingsArea modSettingsArea = null!;
|
||||
private ColumnScrollContainer columnScroll = null!;
|
||||
private ColumnFlowContainer columnFlow = null!;
|
||||
private ShearedToggleButton? customisationButton;
|
||||
|
||||
private FillFlowContainer<ShearedButton> footerButtonFlow = null!;
|
||||
private ShearedButton backButton = null!;
|
||||
private ShearedToggleButton? customisationButton;
|
||||
|
||||
protected ModSelectScreen(OverlayColourScheme colourScheme = OverlayColourScheme.Green)
|
||||
: base(colourScheme)
|
||||
@ -184,7 +188,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Horizontal = 70
|
||||
},
|
||||
Spacing = new Vector2(10),
|
||||
ChildrenEnumerable = CreateFooterButtons().Prepend(new ShearedButton(200)
|
||||
ChildrenEnumerable = CreateFooterButtons().Prepend(backButton = new ShearedButton(BUTTON_WIDTH)
|
||||
{
|
||||
Text = CommonStrings.Back,
|
||||
Action = Hide,
|
||||
@ -378,9 +382,12 @@ namespace osu.Game.Overlays.Mods
|
||||
if (e.Repeat)
|
||||
return false;
|
||||
|
||||
if (e.Action == GlobalAction.Back && customisationVisible.Value)
|
||||
if (e.Action == GlobalAction.Back)
|
||||
{
|
||||
customisationVisible.Value = false;
|
||||
if (customisationVisible.Value)
|
||||
customisationVisible.Value = false;
|
||||
else
|
||||
backButton.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,15 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
@ -51,14 +55,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
float diameter = (i + 1) * DistanceBetweenTicks * 2;
|
||||
|
||||
AddInternal(new CircularProgress
|
||||
AddInternal(new Ring(ReferenceObject, GetColourForIndexFromPlacement(i))
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Position = StartPosition,
|
||||
Current = { Value = 1 },
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(diameter),
|
||||
InnerRadius = 4 * 1f / diameter,
|
||||
Colour = GetColourForIndexFromPlacement(i)
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -100,5 +102,45 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
return (snappedPosition, snappedTime);
|
||||
}
|
||||
|
||||
private class Ring : CircularProgress
|
||||
{
|
||||
[Resolved]
|
||||
private IDistanceSnapProvider snapProvider { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private EditorClock editorClock { get; set; }
|
||||
|
||||
private readonly HitObject referenceObject;
|
||||
|
||||
private readonly Color4 baseColour;
|
||||
|
||||
public Ring(HitObject referenceObject, Color4 baseColour)
|
||||
{
|
||||
this.referenceObject = referenceObject;
|
||||
|
||||
Colour = this.baseColour = baseColour;
|
||||
|
||||
Current.Value = 1;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (editorClock == null)
|
||||
return;
|
||||
|
||||
float distanceSpacingMultiplier = (float)snapProvider.DistanceSpacingMultiplier.Value;
|
||||
double timeFromReferencePoint = editorClock.CurrentTime - referenceObject.GetEndTime();
|
||||
|
||||
float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, timeFromReferencePoint)
|
||||
* distanceSpacingMultiplier;
|
||||
|
||||
float timeBasedAlpha = 1 - Math.Clamp(Math.Abs(distanceForCurrentTime - Size.X / 2) / 30, 0, 1);
|
||||
|
||||
Colour = baseColour.Opacity(Math.Max(baseColour.A, timeBasedAlpha));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,15 @@
|
||||
using System;
|
||||
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.Layout;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
@ -135,7 +136,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
/// </summary>
|
||||
/// <param name="placementIndex">The 0-based beat index from the point of placement.</param>
|
||||
/// <returns>The applicable colour.</returns>
|
||||
protected ColourInfo GetColourForIndexFromPlacement(int placementIndex)
|
||||
protected Color4 GetColourForIndexFromPlacement(int placementIndex)
|
||||
{
|
||||
var timingPoint = Beatmap.ControlPointInfo.TimingPointAt(StartTime);
|
||||
double beatLength = timingPoint.BeatLength / beatDivisor.Value;
|
||||
@ -144,7 +145,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
var colour = BindableBeatDivisor.GetColourFor(BindableBeatDivisor.GetDivisorForBeatIndex(beatIndex + placementIndex + 1, beatDivisor.Value), Colours);
|
||||
|
||||
int repeatIndex = placementIndex / beatDivisor.Value;
|
||||
return ColourInfo.SingleColour(colour).MultiplyAlpha(0.5f / (repeatIndex + 1));
|
||||
return colour.Opacity(0.5f / (repeatIndex + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,14 +33,14 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
protected override IEnumerable<ShearedButton> CreateFooterButtons() => new[]
|
||||
{
|
||||
new ShearedButton(200)
|
||||
new ShearedButton(BUTTON_WIDTH)
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Text = CommonStrings.SelectAll,
|
||||
Action = SelectAll
|
||||
},
|
||||
new ShearedButton(200)
|
||||
new ShearedButton(BUTTON_WIDTH)
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
|
Loading…
x
Reference in New Issue
Block a user