mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 02:32:55 +08:00
Merge branch 'master' into tcm-resume
This commit is contained in:
commit
35df381717
@ -91,11 +91,11 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
var skinnable = firstObject.ApproachCircle;
|
var skinnable = firstObject.ApproachCircle;
|
||||||
|
|
||||||
if (skin == null && skinnable?.Drawable is DefaultApproachCircle)
|
if (skin == null && skinnable.Drawable is DefaultApproachCircle)
|
||||||
// check for default skin provider
|
// check for default skin provider
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var text = skinnable?.Drawable as SpriteText;
|
var text = skinnable.Drawable as SpriteText;
|
||||||
|
|
||||||
return text?.Text == skin;
|
return text?.Text == skin;
|
||||||
});
|
});
|
||||||
|
@ -95,12 +95,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static void blockInputToObjectsUnderSliderHead(DrawableSliderHead slider)
|
private static void blockInputToObjectsUnderSliderHead(DrawableSliderHead slider)
|
||||||
{
|
{
|
||||||
var oldHitAction = slider.HitArea.Hit;
|
slider.HitArea.CanBeHit = () => !slider.DrawableSlider.AllJudged;
|
||||||
slider.HitArea.Hit = () =>
|
|
||||||
{
|
|
||||||
oldHitAction?.Invoke();
|
|
||||||
return !slider.DrawableSlider.AllJudged;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyEarlyFading(DrawableHitCircle circle)
|
private void applyEarlyFading(DrawableHitCircle circle)
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -28,35 +24,30 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public partial class DrawableHitCircle : DrawableOsuHitObject, IHasApproachCircle
|
public partial class DrawableHitCircle : DrawableOsuHitObject, IHasApproachCircle
|
||||||
{
|
{
|
||||||
public OsuAction? HitAction => HitArea?.HitAction;
|
public OsuAction? HitAction => HitArea.HitAction;
|
||||||
protected virtual OsuSkinComponents CirclePieceComponent => OsuSkinComponents.HitCircle;
|
protected virtual OsuSkinComponents CirclePieceComponent => OsuSkinComponents.HitCircle;
|
||||||
|
|
||||||
public SkinnableDrawable ApproachCircle { get; private set; }
|
public SkinnableDrawable ApproachCircle { get; private set; } = null!;
|
||||||
public HitReceptor HitArea { get; private set; }
|
public HitReceptor HitArea { get; private set; } = null!;
|
||||||
public SkinnableDrawable CirclePiece { get; private set; }
|
public SkinnableDrawable CirclePiece { get; private set; } = null!;
|
||||||
|
|
||||||
protected override IEnumerable<Drawable> DimmablePieces => new[]
|
protected override IEnumerable<Drawable> DimmablePieces => new[] { CirclePiece };
|
||||||
{
|
|
||||||
CirclePiece,
|
|
||||||
};
|
|
||||||
|
|
||||||
Drawable IHasApproachCircle.ApproachCircle => ApproachCircle;
|
Drawable IHasApproachCircle.ApproachCircle => ApproachCircle;
|
||||||
|
|
||||||
private Container scaleContainer;
|
private Container scaleContainer = null!;
|
||||||
private InputManager inputManager;
|
private ShakeContainer shakeContainer = null!;
|
||||||
|
|
||||||
public DrawableHitCircle()
|
public DrawableHitCircle()
|
||||||
: this(null)
|
: this(null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public DrawableHitCircle([CanBeNull] HitCircle h = null)
|
public DrawableHitCircle(HitCircle? h = null)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShakeContainer shakeContainer;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -73,14 +64,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
HitArea = new HitReceptor
|
HitArea = new HitReceptor
|
||||||
{
|
{
|
||||||
Hit = () =>
|
CanBeHit = () => !AllJudged,
|
||||||
{
|
Hit = () => UpdateResult(true)
|
||||||
if (AllJudged)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UpdateResult(true);
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
shakeContainer = new ShakeContainer
|
shakeContainer = new ShakeContainer
|
||||||
{
|
{
|
||||||
@ -114,13 +99,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
ScaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue));
|
ScaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override double LifetimeStart
|
public override double LifetimeStart
|
||||||
{
|
{
|
||||||
get => base.LifetimeStart;
|
get => base.LifetimeStart;
|
||||||
@ -155,7 +133,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
if (!userTriggered)
|
if (!userTriggered)
|
||||||
{
|
{
|
||||||
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
if (!HitObject.HitWindows.CanBeHit(timeOffset))
|
||||||
ApplyMinResult();
|
{
|
||||||
|
ApplyResult((r, position) =>
|
||||||
|
{
|
||||||
|
var circleResult = (OsuHitCircleJudgementResult)r;
|
||||||
|
|
||||||
|
circleResult.Type = r.Judgement.MinResult;
|
||||||
|
circleResult.CursorPositionAtHit = position;
|
||||||
|
}, computeHitPosition());
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -169,22 +155,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
if (result == HitResult.None || clickAction != ClickAction.Hit)
|
if (result == HitResult.None || clickAction != ClickAction.Hit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector2? hitPosition = null;
|
|
||||||
|
|
||||||
// Todo: This should also consider misses, but they're a little more interesting to handle, since we don't necessarily know the position at the time of a miss.
|
|
||||||
if (result.IsHit())
|
|
||||||
{
|
|
||||||
var localMousePosition = ToLocalSpace(inputManager.CurrentState.Mouse.Position);
|
|
||||||
hitPosition = HitObject.StackedPosition + (localMousePosition - DrawSize / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplyResult<(HitResult result, Vector2? position)>((r, state) =>
|
ApplyResult<(HitResult result, Vector2? position)>((r, state) =>
|
||||||
{
|
{
|
||||||
var circleResult = (OsuHitCircleJudgementResult)r;
|
var circleResult = (OsuHitCircleJudgementResult)r;
|
||||||
|
|
||||||
circleResult.Type = state.result;
|
circleResult.Type = state.result;
|
||||||
circleResult.CursorPositionAtHit = state.position;
|
circleResult.CursorPositionAtHit = state.position;
|
||||||
}, (result, hitPosition));
|
}, (result, computeHitPosition()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector2? computeHitPosition()
|
||||||
|
{
|
||||||
|
if (HitArea.ClosestPressPosition is Vector2 screenSpaceHitPosition)
|
||||||
|
return HitObject.StackedPosition + (ToLocalSpace(screenSpaceHitPosition) - DrawSize / 2);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -227,7 +212,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmedState.Idle:
|
case ArmedState.Idle:
|
||||||
HitArea.HitAction = null;
|
HitArea.Reset();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmedState.Miss:
|
case ArmedState.Miss:
|
||||||
@ -247,9 +232,25 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
// IsHovered is used
|
// IsHovered is used
|
||||||
public override bool HandlePositionalInput => true;
|
public override bool HandlePositionalInput => true;
|
||||||
|
|
||||||
public Func<bool> Hit;
|
/// <summary>
|
||||||
|
/// Whether the hitobject can still be hit at the current point in time.
|
||||||
|
/// </summary>
|
||||||
|
public required Func<bool> CanBeHit { get; set; }
|
||||||
|
|
||||||
public OsuAction? HitAction;
|
/// <summary>
|
||||||
|
/// An action that's invoked to perform the hit.
|
||||||
|
/// </summary>
|
||||||
|
public required Action Hit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="OsuAction"/> with which the hit was attempted.
|
||||||
|
/// </summary>
|
||||||
|
public OsuAction? HitAction { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The closest position to the hit receptor at the point where the hit was attempted.
|
||||||
|
/// </summary>
|
||||||
|
public Vector2? ClosestPressPosition { get; private set; }
|
||||||
|
|
||||||
public HitReceptor()
|
public HitReceptor()
|
||||||
{
|
{
|
||||||
@ -264,12 +265,27 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
|
public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
|
||||||
{
|
{
|
||||||
|
if (!CanBeHit())
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (e.Action)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
case OsuAction.LeftButton:
|
case OsuAction.LeftButton:
|
||||||
case OsuAction.RightButton:
|
case OsuAction.RightButton:
|
||||||
if (IsHovered && (Hit?.Invoke() ?? false))
|
if (ClosestPressPosition is Vector2 curClosest)
|
||||||
{
|
{
|
||||||
|
float oldDist = Vector2.DistanceSquared(curClosest, ScreenSpaceDrawQuad.Centre);
|
||||||
|
float newDist = Vector2.DistanceSquared(e.ScreenSpaceMousePosition, ScreenSpaceDrawQuad.Centre);
|
||||||
|
|
||||||
|
if (newDist < oldDist)
|
||||||
|
ClosestPressPosition = e.ScreenSpaceMousePosition;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ClosestPressPosition = e.ScreenSpaceMousePosition;
|
||||||
|
|
||||||
|
if (IsHovered)
|
||||||
|
{
|
||||||
|
Hit();
|
||||||
HitAction ??= e.Action;
|
HitAction ??= e.Action;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -283,13 +299,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
|
public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets to a fresh state.
|
||||||
|
/// </summary>
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
HitAction = null;
|
||||||
|
ClosestPressPosition = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class ProxyableSkinnableDrawable : SkinnableDrawable
|
private partial class ProxyableSkinnableDrawable : SkinnableDrawable
|
||||||
{
|
{
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
public ProxyableSkinnableDrawable(ISkinComponentLookup lookup, Func<ISkinComponentLookup, Drawable> defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling)
|
public ProxyableSkinnableDrawable(ISkinComponentLookup lookup, Func<ISkinComponentLookup, Drawable>? defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling)
|
||||||
: base(lookup, defaultImplementation, confineMode)
|
: base(lookup, defaultImplementation, confineMode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -191,16 +192,22 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
|||||||
|
|
||||||
for (int c = 0; c < points_per_dimension; c++)
|
for (int c = 0; c < points_per_dimension; c++)
|
||||||
{
|
{
|
||||||
HitPointType pointType = Vector2.Distance(new Vector2(c + 0.5f, r + 0.5f), centre) <= innerRadius
|
bool isHit = Vector2.Distance(new Vector2(c + 0.5f, r + 0.5f), centre) <= innerRadius;
|
||||||
? HitPointType.Hit
|
|
||||||
: HitPointType.Miss;
|
|
||||||
|
|
||||||
var point = new HitPoint(pointType, this)
|
if (isHit)
|
||||||
{
|
{
|
||||||
BaseColour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
|
points[r][c] = new HitPoint(this)
|
||||||
};
|
{
|
||||||
|
BaseColour = new Color4(102, 255, 204, 255)
|
||||||
points[r][c] = point;
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
points[r][c] = new MissPoint
|
||||||
|
{
|
||||||
|
BaseColour = new Color4(255, 102, 102, 255)
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,40 +257,31 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
|||||||
var rotatedCoordinate = -1 * new Vector2((float)Math.Cos(rotatedAngle), (float)Math.Sin(rotatedAngle));
|
var rotatedCoordinate = -1 * new Vector2((float)Math.Cos(rotatedAngle), (float)Math.Sin(rotatedAngle));
|
||||||
|
|
||||||
Vector2 localCentre = new Vector2(points_per_dimension - 1) / 2;
|
Vector2 localCentre = new Vector2(points_per_dimension - 1) / 2;
|
||||||
float localRadius = localCentre.X * inner_portion * normalisedDistance; // The radius inside the inner portion which of the heatmap which the closest point lies.
|
float localRadius = localCentre.X * inner_portion * normalisedDistance;
|
||||||
Vector2 localPoint = localCentre + localRadius * rotatedCoordinate;
|
Vector2 localPoint = localCentre + localRadius * rotatedCoordinate;
|
||||||
|
|
||||||
// Find the most relevant hit point.
|
// Find the most relevant hit point.
|
||||||
int r = Math.Clamp((int)Math.Round(localPoint.Y), 0, points_per_dimension - 1);
|
int r = (int)Math.Round(localPoint.Y);
|
||||||
int c = Math.Clamp((int)Math.Round(localPoint.X), 0, points_per_dimension - 1);
|
int c = (int)Math.Round(localPoint.X);
|
||||||
|
|
||||||
PeakValue = Math.Max(PeakValue, ((HitPoint)pointGrid.Content[r][c]).Increment());
|
if (r < 0 || r >= points_per_dimension || c < 0 || c >= points_per_dimension)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PeakValue = Math.Max(PeakValue, ((GridPoint)pointGrid.Content[r][c]).Increment());
|
||||||
|
|
||||||
bufferedGrid.ForceRedraw();
|
bufferedGrid.ForceRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class HitPoint : Circle
|
private abstract partial class GridPoint : CompositeDrawable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base colour which will be lightened/darkened depending on the value of this <see cref="HitPoint"/>.
|
/// The base colour which will be lightened/darkened depending on the value of this <see cref="HitPoint"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color4 BaseColour;
|
public Color4 BaseColour;
|
||||||
|
|
||||||
private readonly HitPointType pointType;
|
public override bool IsPresent => Count > 0;
|
||||||
private readonly AccuracyHeatmap heatmap;
|
|
||||||
|
|
||||||
public override bool IsPresent => count > 0;
|
protected int Count { get; private set; }
|
||||||
|
|
||||||
public HitPoint(HitPointType pointType, AccuracyHeatmap heatmap)
|
|
||||||
{
|
|
||||||
this.pointType = pointType;
|
|
||||||
this.heatmap = heatmap;
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Alpha = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int count;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Increment the value of this point by one.
|
/// Increment the value of this point by one.
|
||||||
@ -291,7 +289,41 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
|||||||
/// <returns>The value after incrementing.</returns>
|
/// <returns>The value after incrementing.</returns>
|
||||||
public int Increment()
|
public int Increment()
|
||||||
{
|
{
|
||||||
return ++count;
|
return ++Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class MissPoint : GridPoint
|
||||||
|
{
|
||||||
|
public MissPoint()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.Times
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
Alpha = 0.8f;
|
||||||
|
Colour = BaseColour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class HitPoint : GridPoint
|
||||||
|
{
|
||||||
|
private readonly AccuracyHeatmap heatmap;
|
||||||
|
|
||||||
|
public HitPoint(AccuracyHeatmap heatmap)
|
||||||
|
{
|
||||||
|
this.heatmap = heatmap;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = new Circle { RelativeSizeAxes = Axes.Both };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -307,10 +339,10 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
|||||||
float amount = 0;
|
float amount = 0;
|
||||||
|
|
||||||
// give some amount of alpha regardless of relative count
|
// give some amount of alpha regardless of relative count
|
||||||
amount += non_relative_portion * Math.Min(1, count / 10f);
|
amount += non_relative_portion * Math.Min(1, Count / 10f);
|
||||||
|
|
||||||
// add relative portion
|
// add relative portion
|
||||||
amount += (1 - non_relative_portion) * (count / heatmap.PeakValue);
|
amount += (1 - non_relative_portion) * (Count / heatmap.PeakValue);
|
||||||
|
|
||||||
// apply easing
|
// apply easing
|
||||||
amount = (float)Interpolation.ApplyEasing(Easing.OutQuint, Math.Min(1, amount));
|
amount = (float)Interpolation.ApplyEasing(Easing.OutQuint, Math.Min(1, amount));
|
||||||
@ -318,15 +350,8 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
|||||||
Debug.Assert(amount <= 1);
|
Debug.Assert(amount <= 1);
|
||||||
|
|
||||||
Alpha = Math.Min(amount / lighten_cutoff, 1);
|
Alpha = Math.Min(amount / lighten_cutoff, 1);
|
||||||
if (pointType == HitPointType.Hit)
|
Colour = BaseColour.Lighten(Math.Max(0, amount - lighten_cutoff));
|
||||||
Colour = BaseColour.Lighten(Math.Max(0, amount - lighten_cutoff));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum HitPointType
|
|
||||||
{
|
|
||||||
Hit,
|
|
||||||
Miss
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<Description>click the circles. to the beat.</Description>
|
<Description>click the circles. to the beat.</Description>
|
||||||
<LangVersion>10</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Label="Nuget">
|
<PropertyGroup Label="Nuget">
|
||||||
|
@ -5,7 +5,9 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
|
using osu.Game.IO.Legacy;
|
||||||
using osu.Game.Rulesets.Catch;
|
using osu.Game.Rulesets.Catch;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Scoring.Legacy;
|
using osu.Game.Scoring.Legacy;
|
||||||
@ -21,9 +23,9 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
public void CatchMergesFruitAndDropletMisses(int missCount, int largeTickMissCount)
|
public void CatchMergesFruitAndDropletMisses(int missCount, int largeTickMissCount)
|
||||||
{
|
{
|
||||||
var ruleset = new CatchRuleset().RulesetInfo;
|
var ruleset = new CatchRuleset().RulesetInfo;
|
||||||
|
|
||||||
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
|
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
|
||||||
var beatmap = new TestBeatmap(ruleset);
|
var beatmap = new TestBeatmap(ruleset);
|
||||||
|
|
||||||
scoreInfo.Statistics = new Dictionary<HitResult, int>
|
scoreInfo.Statistics = new Dictionary<HitResult, int>
|
||||||
{
|
{
|
||||||
[HitResult.Great] = 50,
|
[HitResult.Great] = 50,
|
||||||
@ -31,13 +33,63 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
[HitResult.Miss] = missCount,
|
[HitResult.Miss] = missCount,
|
||||||
[HitResult.LargeTickMiss] = largeTickMissCount
|
[HitResult.LargeTickMiss] = largeTickMissCount
|
||||||
};
|
};
|
||||||
var score = new Score { ScoreInfo = scoreInfo };
|
|
||||||
|
|
||||||
|
var score = new Score { ScoreInfo = scoreInfo };
|
||||||
var decodedAfterEncode = encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, score, beatmap);
|
var decodedAfterEncode = encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, score, beatmap);
|
||||||
|
|
||||||
Assert.That(decodedAfterEncode.ScoreInfo.GetCountMiss(), Is.EqualTo(missCount + largeTickMissCount));
|
Assert.That(decodedAfterEncode.ScoreInfo.GetCountMiss(), Is.EqualTo(missCount + largeTickMissCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ScoreWithMissIsNotPerfect()
|
||||||
|
{
|
||||||
|
var ruleset = new OsuRuleset().RulesetInfo;
|
||||||
|
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
|
||||||
|
var beatmap = new TestBeatmap(ruleset);
|
||||||
|
|
||||||
|
scoreInfo.Statistics = new Dictionary<HitResult, int>
|
||||||
|
{
|
||||||
|
[HitResult.Great] = 2,
|
||||||
|
[HitResult.Miss] = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
scoreInfo.MaximumStatistics = new Dictionary<HitResult, int>
|
||||||
|
{
|
||||||
|
[HitResult.Great] = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
// Hit -> Miss -> Hit
|
||||||
|
scoreInfo.Combo = 1;
|
||||||
|
scoreInfo.MaxCombo = 1;
|
||||||
|
|
||||||
|
using (var ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
new LegacyScoreEncoder(new Score { ScoreInfo = scoreInfo }, beatmap).Encode(ms, true);
|
||||||
|
|
||||||
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
using (var sr = new SerializationReader(ms))
|
||||||
|
{
|
||||||
|
sr.ReadByte(); // ruleset id
|
||||||
|
sr.ReadInt32(); // version
|
||||||
|
sr.ReadString(); // beatmap hash
|
||||||
|
sr.ReadString(); // username
|
||||||
|
sr.ReadString(); // score hash
|
||||||
|
sr.ReadInt16(); // count300
|
||||||
|
sr.ReadInt16(); // count100
|
||||||
|
sr.ReadInt16(); // count50
|
||||||
|
sr.ReadInt16(); // countGeki
|
||||||
|
sr.ReadInt16(); // countKatu
|
||||||
|
sr.ReadInt16(); // countMiss
|
||||||
|
sr.ReadInt32(); // total score
|
||||||
|
sr.ReadInt16(); // max combo
|
||||||
|
bool isPerfect = sr.ReadBoolean(); // full combo
|
||||||
|
|
||||||
|
Assert.That(isPerfect, Is.False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static Score encodeThenDecode(int beatmapVersion, Score score, TestBeatmap beatmap)
|
private static Score encodeThenDecode(int beatmapVersion, Score score, TestBeatmap beatmap)
|
||||||
{
|
{
|
||||||
var encodeStream = new MemoryStream();
|
var encodeStream = new MemoryStream();
|
||||||
|
@ -89,13 +89,18 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
setupUserSettings();
|
setupUserSettings();
|
||||||
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new LoadBlockingTestPlayer { BlockLoad = true })));
|
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new LoadBlockingTestPlayer { BlockLoad = true })));
|
||||||
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
|
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
|
||||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
AddAssert("Background retained from song select", () =>
|
||||||
AddStep("Trigger background preview", () =>
|
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(playerLoader.ScreenPos);
|
InputManager.MoveMouseTo(playerLoader);
|
||||||
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
return songSelect.IsBackgroundCurrent();
|
||||||
});
|
});
|
||||||
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
|
||||||
|
AddUntilStep("Screen is dimmed and blur applied", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
||||||
|
return songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied();
|
||||||
|
});
|
||||||
|
|
||||||
AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
||||||
AddUntilStep("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.CheckBackgroundBlur(playerLoader.ExpectedBackgroundBlur));
|
AddUntilStep("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.CheckBackgroundBlur(playerLoader.ExpectedBackgroundBlur));
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
@ -36,7 +37,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private TestPlayerLoader loader;
|
private TestPlayerLoader loader;
|
||||||
private TestPlayer player;
|
private TestPlayer player;
|
||||||
|
|
||||||
private bool epilepsyWarning;
|
private bool? epilepsyWarning;
|
||||||
|
private BeatmapOnlineStatus? onlineStatus;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audioManager { get; set; }
|
private AudioManager audioManager { get; set; }
|
||||||
@ -81,7 +83,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() => player = null);
|
public void Setup() => Schedule(() =>
|
||||||
|
{
|
||||||
|
player = null;
|
||||||
|
epilepsyWarning = null;
|
||||||
|
onlineStatus = null;
|
||||||
|
});
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
@ -118,8 +125,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
// Add intro time to test quick retry skipping (TestQuickRetry).
|
// Add intro time to test quick retry skipping (TestQuickRetry).
|
||||||
workingBeatmap.BeatmapInfo.AudioLeadIn = 60000;
|
workingBeatmap.BeatmapInfo.AudioLeadIn = 60000;
|
||||||
|
|
||||||
// Turn on epilepsy warning to test warning display (TestEpilepsyWarning).
|
// Set up data for testing disclaimer display.
|
||||||
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning;
|
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning ?? false;
|
||||||
|
workingBeatmap.BeatmapInfo.Status = onlineStatus ?? BeatmapOnlineStatus.Ranked;
|
||||||
|
|
||||||
Beatmap.Value = workingBeatmap;
|
Beatmap.Value = workingBeatmap;
|
||||||
|
|
||||||
@ -334,13 +342,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => (getWarning() != null) == warning);
|
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(warning ? 1 : 0));
|
||||||
|
|
||||||
if (warning)
|
|
||||||
{
|
|
||||||
AddUntilStep("sound volume decreased", () => Beatmap.Value.Track.AggregateVolume.Value == 0.25);
|
|
||||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
restoreVolumes();
|
restoreVolumes();
|
||||||
}
|
}
|
||||||
@ -357,30 +359,45 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
AddUntilStep("epilepsy warning absent", () => getWarning() == null);
|
AddUntilStep("epilepsy warning absent", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Single().Alpha, () => Is.Zero);
|
||||||
|
|
||||||
restoreVolumes();
|
restoreVolumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(BeatmapOnlineStatus.Loved, 1)]
|
||||||
public void TestEpilepsyWarningEarlyExit()
|
[TestCase(BeatmapOnlineStatus.Qualified, 1)]
|
||||||
|
[TestCase(BeatmapOnlineStatus.Graveyard, 0)]
|
||||||
|
public void TestStatusWarning(BeatmapOnlineStatus status, int expectedDisclaimerCount)
|
||||||
{
|
{
|
||||||
saveVolumes();
|
saveVolumes();
|
||||||
setFullVolume();
|
setFullVolume();
|
||||||
|
|
||||||
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
|
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
|
||||||
AddStep("set epilepsy warning", () => epilepsyWarning = true);
|
AddStep("disable epilepsy warning", () => epilepsyWarning = false);
|
||||||
|
AddStep("set beatmap status", () => onlineStatus = status);
|
||||||
AddStep("load dummy beatmap", () => resetPlayer(false));
|
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||||
|
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0);
|
AddAssert($"disclaimer count is {expectedDisclaimerCount}", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(expectedDisclaimerCount));
|
||||||
AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible);
|
|
||||||
|
|
||||||
AddStep("exit early", () => loader.Exit());
|
restoreVolumes();
|
||||||
|
}
|
||||||
|
|
||||||
AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden);
|
[Test]
|
||||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
public void TestCombinedWarnings()
|
||||||
|
{
|
||||||
|
saveVolumes();
|
||||||
|
setFullVolume();
|
||||||
|
|
||||||
|
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
|
||||||
|
AddStep("disable epilepsy warning", () => epilepsyWarning = true);
|
||||||
|
AddStep("set beatmap status", () => onlineStatus = BeatmapOnlineStatus.Loved);
|
||||||
|
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||||
|
|
||||||
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
|
AddAssert("disclaimer count is 2", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(2));
|
||||||
|
|
||||||
restoreVolumes();
|
restoreVolumes();
|
||||||
}
|
}
|
||||||
@ -479,8 +496,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("click notification", () => notification.TriggerClick());
|
AddStep("click notification", () => notification.TriggerClick());
|
||||||
}
|
}
|
||||||
|
|
||||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault(w => w.IsAlive);
|
|
||||||
|
|
||||||
private partial class TestPlayerLoader : PlayerLoader
|
private partial class TestPlayerLoader : PlayerLoader
|
||||||
{
|
{
|
||||||
public new VisualSettings VisualSettings => base.VisualSettings;
|
public new VisualSettings VisualSettings => base.VisualSettings;
|
||||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
downloadTracker,
|
downloadTracker,
|
||||||
background = new Container
|
background = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Child = new Box
|
Child = new Box
|
||||||
@ -165,9 +165,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
float targetWidth = Width - (ShowDetails.Value ? ButtonsExpandedWidth : ButtonsCollapsedWidth);
|
float buttonAreaWidth = ShowDetails.Value ? ButtonsExpandedWidth : ButtonsCollapsedWidth;
|
||||||
|
float mainAreaWidth = Width - buttonAreaWidth;
|
||||||
|
|
||||||
mainArea.ResizeWidthTo(targetWidth, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
mainArea.ResizeWidthTo(mainAreaWidth, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||||
|
|
||||||
|
// By limiting the width we avoid this box showing up as an outline around the drawables that are on top of it.
|
||||||
|
background.ResizeWidthTo(buttonAreaWidth + BeatmapCard.CORNER_RADIUS, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||||
|
|
||||||
background.FadeColour(downloadTracker.State.Value == DownloadState.LocallyAvailable ? colours.Lime0 : colourProvider.Background3, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
background.FadeColour(downloadTracker.State.Value == DownloadState.LocallyAvailable ? colours.Lime0 : colourProvider.Background3, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||||
buttons.FadeTo(ShowDetails.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
buttons.FadeTo(ShowDetails.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||||
|
48
osu.Game/Localisation/PlayerLoaderStrings.cs
Normal file
48
osu.Game/Localisation/PlayerLoaderStrings.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// 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.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Localisation
|
||||||
|
{
|
||||||
|
public static class PlayerLoaderStrings
|
||||||
|
{
|
||||||
|
private const string prefix = @"osu.Game.Resources.Localisation.PlayerLoader";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "This beatmap contains scenes with rapidly flashing colours"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString EpilepsyWarningTitle => new TranslatableString(getKey(@"epilepsy_warning_title"), @"This beatmap contains scenes with rapidly flashing colours");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Please take caution if you are affected by epilepsy."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString EpilepsyWarningContent => new TranslatableString(getKey(@"epilepsy_warning_content"), @"Please take caution if you are affected by epilepsy.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "This beatmap is loved"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString LovedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"loved_beatmap_disclaimer_title"), @"This beatmap is loved");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "No performance points will be awarded.
|
||||||
|
/// Leaderboards may be reset by the beatmap creator."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString LovedBeatmapDisclaimerContent => new TranslatableString(getKey(@"loved_beatmap_disclaimer_content"), @"No performance points will be awarded.
|
||||||
|
Leaderboards may be reset by the beatmap creator.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "This beatmap is qualified"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString QualifiedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_title"), @"This beatmap is qualified");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "No performance points will be awarded.
|
||||||
|
/// Leaderboards will be reset when the beatmap is ranked."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString QualifiedBeatmapDisclaimerContent => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_content"), @"No performance points will be awarded.
|
||||||
|
Leaderboards will be reset when the beatmap is ranked.");
|
||||||
|
|
||||||
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
|
}
|
||||||
|
}
|
@ -93,7 +93,7 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
sw.Write((ushort)(score.ScoreInfo.GetCountMiss() ?? 0));
|
sw.Write((ushort)(score.ScoreInfo.GetCountMiss() ?? 0));
|
||||||
sw.Write((int)(score.ScoreInfo.TotalScore));
|
sw.Write((int)(score.ScoreInfo.TotalScore));
|
||||||
sw.Write((ushort)score.ScoreInfo.MaxCombo);
|
sw.Write((ushort)score.ScoreInfo.MaxCombo);
|
||||||
sw.Write(score.ScoreInfo.Combo == score.ScoreInfo.MaxCombo);
|
sw.Write(score.ScoreInfo.MaxCombo == score.ScoreInfo.GetMaximumAchievableCombo());
|
||||||
sw.Write((int)score.ScoreInfo.Ruleset.CreateInstance().ConvertToLegacyMods(score.ScoreInfo.Mods));
|
sw.Write((int)score.ScoreInfo.Ruleset.CreateInstance().ConvertToLegacyMods(score.ScoreInfo.Mods));
|
||||||
|
|
||||||
sw.Write(getHpGraphFormatted());
|
sw.Write(getHpGraphFormatted());
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Caching;
|
using osu.Framework.Caching;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -18,6 +19,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
public partial class TimelineTickDisplay : TimelinePart<PointVisualisation>
|
public partial class TimelineTickDisplay : TimelinePart<PointVisualisation>
|
||||||
{
|
{
|
||||||
|
// With current implementation every tick in the sub-tree should be visible, no need to check whether they are masked away.
|
||||||
|
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds) => false;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap beatmap { get; set; } = null!;
|
private EditorBeatmap beatmap { get; set; } = null!;
|
||||||
|
|
||||||
@ -165,7 +169,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
// save a few drawables beyond the currently used for edge cases.
|
// save a few drawables beyond the currently used for edge cases.
|
||||||
while (drawableIndex < Math.Min(usedDrawables + 16, Count))
|
while (drawableIndex < Math.Min(usedDrawables + 16, Count))
|
||||||
Children[drawableIndex++].Hide();
|
Children[drawableIndex++].Alpha = 0;
|
||||||
|
|
||||||
// expire any excess
|
// expire any excess
|
||||||
while (drawableIndex < Count)
|
while (drawableIndex < Count)
|
||||||
@ -182,7 +186,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
point = Children[drawableIndex];
|
point = Children[drawableIndex];
|
||||||
|
|
||||||
drawableIndex++;
|
drawableIndex++;
|
||||||
point.Show();
|
point.Alpha = 1;
|
||||||
|
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
@ -1,102 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Screens.Backgrounds;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
|
||||||
{
|
|
||||||
public partial class EpilepsyWarning : VisibilityContainer
|
|
||||||
{
|
|
||||||
public const double FADE_DURATION = 250;
|
|
||||||
|
|
||||||
public EpilepsyWarning()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Alpha = 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BackgroundScreenBeatmap dimmableBackground;
|
|
||||||
|
|
||||||
public BackgroundScreenBeatmap DimmableBackground
|
|
||||||
{
|
|
||||||
get => dimmableBackground;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
dimmableBackground = value;
|
|
||||||
|
|
||||||
if (IsLoaded)
|
|
||||||
updateBackgroundFade();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Colour = colours.Yellow,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Icon = FontAwesome.Solid.ExclamationTriangle,
|
|
||||||
Size = new Vector2(50),
|
|
||||||
},
|
|
||||||
new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 25))
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
TextAnchor = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
}.With(tfc =>
|
|
||||||
{
|
|
||||||
tfc.AddText("This beatmap contains scenes with ");
|
|
||||||
tfc.AddText("rapidly flashing colours", s =>
|
|
||||||
{
|
|
||||||
s.Font = s.Font.With(weight: FontWeight.Bold);
|
|
||||||
s.Colour = colours.Yellow;
|
|
||||||
});
|
|
||||||
tfc.AddText(".");
|
|
||||||
|
|
||||||
tfc.NewParagraph();
|
|
||||||
tfc.AddText("Please take caution if you are affected by epilepsy.");
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
|
||||||
{
|
|
||||||
updateBackgroundFade();
|
|
||||||
|
|
||||||
this.FadeIn(FADE_DURATION, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateBackgroundFade()
|
|
||||||
{
|
|
||||||
DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopOut() => this.FadeOut(FADE_DURATION);
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,6 +18,7 @@ using osu.Framework.Threading;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Audio.Effects;
|
using osu.Game.Audio.Effects;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -42,7 +43,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected const double CONTENT_OUT_DURATION = 300;
|
protected const double CONTENT_OUT_DURATION = 300;
|
||||||
|
|
||||||
protected virtual double PlayerPushDelay => 1800;
|
protected virtual double PlayerPushDelay => 1800 + disclaimers.Count * 500;
|
||||||
|
|
||||||
public override bool HideOverlaysOnEnter => hideOverlays;
|
public override bool HideOverlaysOnEnter => hideOverlays;
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected Task? DisposalTask { get; private set; }
|
protected Task? DisposalTask { get; private set; }
|
||||||
|
|
||||||
|
private FillFlowContainer disclaimers = null!;
|
||||||
private OsuScrollContainer settingsScroll = null!;
|
private OsuScrollContainer settingsScroll = null!;
|
||||||
|
|
||||||
private Bindable<bool> showStoryboards = null!;
|
private Bindable<bool> showStoryboards = null!;
|
||||||
@ -137,7 +139,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private ScheduledDelegate? scheduledPushPlayer;
|
private ScheduledDelegate? scheduledPushPlayer;
|
||||||
|
|
||||||
private EpilepsyWarning? epilepsyWarning;
|
private PlayerLoaderDisclaimer? epilepsyWarning;
|
||||||
|
|
||||||
private bool quickRestart;
|
private bool quickRestart;
|
||||||
|
|
||||||
@ -188,6 +190,18 @@ namespace osu.Game.Screens.Play
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
disclaimers = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Width = SettingsToolboxGroup.CONTAINER_WIDTH + padding * 2,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
AutoSizeDuration = 250,
|
||||||
|
AutoSizeEasing = Easing.OutQuint,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Padding = new MarginPadding(padding),
|
||||||
|
Spacing = new Vector2(20),
|
||||||
|
},
|
||||||
settingsScroll = new OsuScrollContainer
|
settingsScroll = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -216,11 +230,18 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
||||||
{
|
{
|
||||||
AddInternal(epilepsyWarning = new EpilepsyWarning
|
disclaimers.Add(epilepsyWarning = new PlayerLoaderDisclaimer(PlayerLoaderStrings.EpilepsyWarningTitle, PlayerLoaderStrings.EpilepsyWarningContent));
|
||||||
{
|
}
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
switch (Beatmap.Value.BeatmapInfo.Status)
|
||||||
});
|
{
|
||||||
|
case BeatmapOnlineStatus.Loved:
|
||||||
|
disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.LovedBeatmapDisclaimerTitle, PlayerLoaderStrings.LovedBeatmapDisclaimerContent));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BeatmapOnlineStatus.Qualified:
|
||||||
|
disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.QualifiedBeatmapDisclaimerTitle, PlayerLoaderStrings.QualifiedBeatmapDisclaimerContent));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +250,9 @@ namespace osu.Game.Screens.Play
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager();
|
||||||
|
|
||||||
|
showStoryboards.BindValueChanged(val => epilepsyWarning?.FadeTo(val.NewValue ? 1 : 0, 250, Easing.OutQuint), true);
|
||||||
|
epilepsyWarning?.FinishTransforms(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Screen handling
|
#region Screen handling
|
||||||
@ -237,22 +261,18 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.OnEntering(e);
|
base.OnEntering(e);
|
||||||
|
|
||||||
ApplyToBackground(b =>
|
|
||||||
{
|
|
||||||
if (epilepsyWarning != null)
|
|
||||||
epilepsyWarning.DimmableBackground = b;
|
|
||||||
});
|
|
||||||
|
|
||||||
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
// Start off-screen.
|
// Start side content off-screen.
|
||||||
|
disclaimers.MoveToX(-disclaimers.DrawWidth);
|
||||||
settingsScroll.MoveToX(settingsScroll.DrawWidth);
|
settingsScroll.MoveToX(settingsScroll.DrawWidth);
|
||||||
|
|
||||||
content.ScaleTo(0.7f);
|
content.ScaleTo(0.7f);
|
||||||
|
|
||||||
contentIn();
|
const double metadata_delay = 500;
|
||||||
|
|
||||||
MetadataInfo.Delay(750).FadeIn(500, Easing.OutQuint);
|
MetadataInfo.Delay(metadata_delay).FadeIn(500, Easing.OutQuint);
|
||||||
|
contentIn(metadata_delay + 250);
|
||||||
|
|
||||||
// after an initial delay, start the debounced load check.
|
// after an initial delay, start the debounced load check.
|
||||||
// this will continue to execute even after resuming back on restart.
|
// this will continue to execute even after resuming back on restart.
|
||||||
@ -301,9 +321,6 @@ namespace osu.Game.Screens.Play
|
|||||||
cancelLoad();
|
cancelLoad();
|
||||||
ContentOut();
|
ContentOut();
|
||||||
|
|
||||||
// If the load sequence was interrupted, the epilepsy warning may already be displayed (or in the process of being displayed).
|
|
||||||
epilepsyWarning?.Hide();
|
|
||||||
|
|
||||||
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
||||||
this.Delay(CONTENT_OUT_DURATION).FadeOut();
|
this.Delay(CONTENT_OUT_DURATION).FadeOut();
|
||||||
|
|
||||||
@ -333,7 +350,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (this.IsCurrentScreen())
|
if (this.IsCurrentScreen())
|
||||||
content.StartTracking(logo, resuming ? 0 : 500, Easing.InOutExpo);
|
content.StartTracking(logo, resuming ? 0 : 500, Easing.InOutExpo);
|
||||||
}, resuming ? 0 : 500);
|
}, resuming ? 0 : 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoExiting(OsuLogo logo)
|
protected override void LogoExiting(OsuLogo logo)
|
||||||
@ -426,15 +443,21 @@ namespace osu.Game.Screens.Play
|
|||||||
this.MakeCurrent();
|
this.MakeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contentIn()
|
private void contentIn(double delayBeforeSideDisplays = 0)
|
||||||
{
|
{
|
||||||
MetadataInfo.Loading = true;
|
MetadataInfo.Loading = true;
|
||||||
|
|
||||||
content.FadeInFromZero(500, Easing.OutQuint);
|
content.FadeInFromZero(500, Easing.OutQuint);
|
||||||
content.ScaleTo(1, 650, Easing.OutQuint).Then().Schedule(prepareNewPlayer);
|
content.ScaleTo(1, 650, Easing.OutQuint).Then().Schedule(prepareNewPlayer);
|
||||||
|
|
||||||
settingsScroll.FadeInFromZero(500, Easing.Out)
|
using (BeginDelayedSequence(delayBeforeSideDisplays))
|
||||||
.MoveToX(0, 500, Easing.OutQuint);
|
{
|
||||||
|
settingsScroll.FadeInFromZero(500, Easing.Out)
|
||||||
|
.MoveToX(0, 500, Easing.OutQuint);
|
||||||
|
|
||||||
|
disclaimers.FadeInFromZero(500, Easing.Out)
|
||||||
|
.MoveToX(0, 500, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
AddRangeInternal(new[]
|
AddRangeInternal(new[]
|
||||||
{
|
{
|
||||||
@ -466,6 +489,8 @@ namespace osu.Game.Screens.Play
|
|||||||
lowPassFilter = null;
|
lowPassFilter = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
disclaimers.FadeOut(CONTENT_OUT_DURATION, Easing.Out)
|
||||||
|
.MoveToX(-disclaimers.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||||
settingsScroll.FadeOut(CONTENT_OUT_DURATION, Easing.OutQuint)
|
settingsScroll.FadeOut(CONTENT_OUT_DURATION, Easing.OutQuint)
|
||||||
.MoveToX(settingsScroll.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
.MoveToX(settingsScroll.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||||
|
|
||||||
@ -503,33 +528,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
TransformSequence<PlayerLoader> pushSequence = this.Delay(0);
|
TransformSequence<PlayerLoader> pushSequence = this.Delay(0);
|
||||||
|
|
||||||
// only show if the warning was created (i.e. the beatmap needs it)
|
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
|
||||||
// and this is not a restart of the map (the warning expires after first load).
|
this.TransformBindableTo(volumeAdjustment, 0, CONTENT_OUT_DURATION, Easing.OutCubic);
|
||||||
//
|
|
||||||
// note the late check of storyboard enable as the user may have just changed it
|
|
||||||
// from the settings on the loader screen.
|
|
||||||
if (epilepsyWarning?.IsAlive == true && showStoryboards.Value)
|
|
||||||
{
|
|
||||||
const double epilepsy_display_length = 3000;
|
|
||||||
|
|
||||||
pushSequence
|
|
||||||
.Delay(CONTENT_OUT_DURATION)
|
|
||||||
.Schedule(() => epilepsyWarning.State.Value = Visibility.Visible)
|
|
||||||
.TransformBindableTo(volumeAdjustment, 0.25, EpilepsyWarning.FADE_DURATION, Easing.OutQuint)
|
|
||||||
.Delay(epilepsy_display_length)
|
|
||||||
.Schedule(() =>
|
|
||||||
{
|
|
||||||
epilepsyWarning.Hide();
|
|
||||||
epilepsyWarning.Expire();
|
|
||||||
})
|
|
||||||
.Delay(EpilepsyWarning.FADE_DURATION);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
|
|
||||||
this.TransformBindableTo(volumeAdjustment, 0, CONTENT_OUT_DURATION, Easing.OutCubic);
|
|
||||||
epilepsyWarning?.Expire();
|
|
||||||
}
|
|
||||||
|
|
||||||
pushSequence.Schedule(() =>
|
pushSequence.Schedule(() =>
|
||||||
{
|
{
|
||||||
|
107
osu.Game/Screens/Play/PlayerLoaderDisclaimer.cs
Normal file
107
osu.Game/Screens/Play/PlayerLoaderDisclaimer.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play
|
||||||
|
{
|
||||||
|
public partial class PlayerLoaderDisclaimer : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly LocalisableString title;
|
||||||
|
private readonly LocalisableString content;
|
||||||
|
|
||||||
|
private Box background = null!;
|
||||||
|
|
||||||
|
public PlayerLoaderDisclaimer(LocalisableString title, LocalisableString content)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours, OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 5;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider.Background4,
|
||||||
|
Alpha = 0.1f,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Circle
|
||||||
|
{
|
||||||
|
Width = 7,
|
||||||
|
Height = 15,
|
||||||
|
Margin = new MarginPadding { Top = 2 },
|
||||||
|
Colour = colours.Orange1,
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding { Left = 12 },
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 2),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new TextFlowContainer(t => t.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Text = title,
|
||||||
|
},
|
||||||
|
new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 16))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Text = content,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
updateFadeState();
|
||||||
|
|
||||||
|
// handle hover so that users can hover the disclaimer to delay load if they want to read it.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
updateFadeState();
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFadeState()
|
||||||
|
{
|
||||||
|
// Matches SettingsToolboxGroup
|
||||||
|
background.FadeTo(IsHovered ? 1 : 0.1f, 500, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,6 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>10</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Nuget">
|
<PropertyGroup Label="Nuget">
|
||||||
<Title>osu!</Title>
|
<Title>osu!</Title>
|
||||||
|
Loading…
Reference in New Issue
Block a user