1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 03:42:55 +08:00

Determine whether to show lighting at prepare time

This commit is contained in:
Bartłomiej Dach 2020-07-26 23:20:38 +02:00
parent bbc7d69524
commit 21ae33e284

View File

@ -20,6 +20,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private Bindable<Color4> lightingColour;
[Resolved]
private OsuConfigManager config { get; set; }
public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObject)
: base(result, judgedObject)
{
@ -30,19 +33,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
if (config.Get<bool>(OsuSetting.HitLighting))
private void load()
{
AddInternal(Lighting = new SkinnableSprite("lighting")
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Blending = BlendingParameters.Additive,
Depth = float.MaxValue
Depth = float.MaxValue,
Alpha = 0
});
}
}
public override void Apply(JudgementResult result, DrawableHitObject judgedObject)
{
@ -61,8 +62,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
lightingColour?.UnbindAll();
if (Lighting != null)
{
Lighting.ResetAnimation();
if (JudgedObject != null)
@ -75,13 +74,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Lighting.Colour = Color4.White;
}
}
}
protected override double FadeOutDelay => Lighting == null ? base.FadeOutDelay : 1400;
protected override void ApplyHitAnimations()
{
if (Lighting != null)
if (config.Get<bool>(OsuSetting.HitLighting))
{
JudgementBody.FadeIn().Delay(FadeInDuration).FadeOut(400);