mirror of
https://github.com/ppy/osu.git
synced 2025-03-06 17:47:19 +08:00
Determine whether to show lighting at prepare time
This commit is contained in:
parent
bbc7d69524
commit
21ae33e284
@ -20,6 +20,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
private Bindable<Color4> lightingColour;
|
private Bindable<Color4> lightingColour;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuConfigManager config { get; set; }
|
||||||
|
|
||||||
public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObject)
|
public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObject)
|
||||||
: base(result, judgedObject)
|
: base(result, judgedObject)
|
||||||
{
|
{
|
||||||
@ -30,18 +33,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load()
|
||||||
{
|
{
|
||||||
if (config.Get<bool>(OsuSetting.HitLighting))
|
AddInternal(Lighting = new SkinnableSprite("lighting")
|
||||||
{
|
{
|
||||||
AddInternal(Lighting = new SkinnableSprite("lighting")
|
Anchor = Anchor.Centre,
|
||||||
{
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Blending = BlendingParameters.Additive,
|
||||||
Origin = Anchor.Centre,
|
Depth = float.MaxValue,
|
||||||
Blending = BlendingParameters.Additive,
|
Alpha = 0
|
||||||
Depth = float.MaxValue
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Apply(JudgementResult result, DrawableHitObject judgedObject)
|
public override void Apply(JudgementResult result, DrawableHitObject judgedObject)
|
||||||
@ -61,19 +62,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
lightingColour?.UnbindAll();
|
lightingColour?.UnbindAll();
|
||||||
|
|
||||||
if (Lighting != null)
|
Lighting.ResetAnimation();
|
||||||
{
|
|
||||||
Lighting.ResetAnimation();
|
|
||||||
|
|
||||||
if (JudgedObject != null)
|
if (JudgedObject != null)
|
||||||
{
|
{
|
||||||
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
|
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
|
||||||
lightingColour.BindValueChanged(colour => Lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true);
|
lightingColour.BindValueChanged(colour => Lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Lighting.Colour = Color4.White;
|
Lighting.Colour = Color4.White;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +79,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
protected override void ApplyHitAnimations()
|
protected override void ApplyHitAnimations()
|
||||||
{
|
{
|
||||||
if (Lighting != null)
|
if (config.Get<bool>(OsuSetting.HitLighting))
|
||||||
{
|
{
|
||||||
JudgementBody.FadeIn().Delay(FadeInDuration).FadeOut(400);
|
JudgementBody.FadeIn().Delay(FadeInDuration).FadeOut(400);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user