1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Add support for disabling "hit lighting" with osu! argon skin

This commit is contained in:
Dean Herbert 2023-01-25 15:50:49 +09:00
parent 4674956ccf
commit 9499d3a20a
2 changed files with 40 additions and 8 deletions

View File

@ -5,9 +5,11 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
@ -22,6 +24,9 @@ namespace osu.Game.Rulesets.Osu.Tests
{
private int depthIndex;
[Resolved]
private OsuConfigManager config { get; set; }
[Test]
public void TestHits()
{
@ -56,6 +61,13 @@ namespace osu.Game.Rulesets.Osu.Tests
AddStep("Hit stream late", () => SetContents(_ => testStream(5, true, 150)));
}
[Test]
public void TestHitLighting()
{
AddToggleStep("toggle hit lighting", v => config.SetValue(OsuSetting.HitLighting, v));
AddStep("Hit Big Single", () => SetContents(_ => testSingle(2, true)));
}
private Drawable testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)
{
var playfield = new TestOsuPlayfield();

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Objects.Drawables;
@ -44,6 +45,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
private readonly FlashPiece flash;
private Bindable<bool> configHitLighting = null!;
[Resolved]
private DrawableHitObject drawableObject { get; set; } = null!;
@ -96,12 +99,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
}
[BackgroundDependencyLoader]
private void load()
private void load(OsuConfigManager config)
{
var drawableOsuObject = (DrawableOsuHitObject)drawableObject;
accentColour.BindTo(drawableObject.AccentColour);
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
configHitLighting = config.GetBindable<bool>(OsuSetting.HitLighting);
}
protected override void LoadComplete()
@ -140,12 +145,15 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
case ArmedState.Hit:
// Fade out time is at a maximum of 800. Must match `DrawableHitCircle`'s arbitrary lifetime spec.
const double fade_out_time = 800;
const double flash_in_duration = 150;
const double resize_duration = 400;
const float shrink_size = 0.8f;
// When the user has hit lighting disabled, we won't be showing the bright white flash.
// To make things look good, the surrounding animations are also slightly adjusted.
bool showFlash = configHitLighting.Value;
// Animating with the number present is distracting.
// The number disappearing is hidden by the bright flash.
number.FadeOut(flash_in_duration / 2);
@ -176,15 +184,27 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
using (BeginDelayedSequence(flash_in_duration / 12))
{
outerGradient.ResizeTo(OUTER_GRADIENT_SIZE * shrink_size, resize_duration, Easing.OutElasticHalf);
outerGradient
.FadeColour(Color4.White, 80)
.Then()
.FadeOut(flash_in_duration);
if (showFlash)
{
outerGradient
.FadeColour(Color4.White, 80)
.Then()
.FadeOut(flash_in_duration);
}
else
{
outerGradient
.FadeColour(Color4.White, flash_in_duration * 8)
.FadeOut(flash_in_duration * 2);
}
}
flash.FadeTo(1, flash_in_duration, Easing.OutQuint);
if (showFlash)
flash.FadeTo(1, flash_in_duration, Easing.OutQuint);
this.FadeOut(showFlash ? fade_out_time : fade_out_time / 2, Easing.OutQuad);
this.FadeOut(fade_out_time, Easing.OutQuad);
break;
}
}