1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Merge pull request #10676 from peppy/fix-hitcircle-glow-on-skin-change

Fix skin changes resulting in incorrectly applied transforms in MainCirclePiece
This commit is contained in:
Dan Balasescu 2020-11-06 21:09:22 +09:00 committed by GitHub
commit cf9acca78a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 40 deletions

View File

@ -42,8 +42,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
[Resolved]
private DrawableHitObject drawableObject { get; set; }
[BackgroundDependencyLoader]
private void load(DrawableHitObject drawableObject)
private void load()
{
var drawableOsuObject = (DrawableOsuHitObject)drawableObject;
@ -64,32 +67,35 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private void updateState(ValueChangedEvent<ArmedState> state)
{
glow.FadeOut(400);
switch (state.NewValue)
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime, true))
{
case ArmedState.Hit:
const double flash_in = 40;
const double flash_out = 100;
glow.FadeOut(400);
flash.FadeTo(0.8f, flash_in)
.Then()
.FadeOut(flash_out);
switch (state.NewValue)
{
case ArmedState.Hit:
const double flash_in = 40;
const double flash_out = 100;
explode.FadeIn(flash_in);
this.ScaleTo(1.5f, 400, Easing.OutQuad);
flash.FadeTo(0.8f, flash_in)
.Then()
.FadeOut(flash_out);
using (BeginDelayedSequence(flash_in, true))
{
// after the flash, we can hide some elements that were behind it
ring.FadeOut();
circle.FadeOut();
number.FadeOut();
explode.FadeIn(flash_in);
this.ScaleTo(1.5f, 400, Easing.OutQuad);
this.FadeOut(800);
}
using (BeginDelayedSequence(flash_in, true))
{
// after the flash, we can hide some elements that were behind it
ring.FadeOut();
circle.FadeOut();
number.FadeOut();
break;
this.FadeOut(800);
}
break;
}
}
}
}

View File

@ -42,11 +42,14 @@ namespace osu.Game.Rulesets.Osu.Skinning
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
[Resolved]
private DrawableHitObject drawableObject { get; set; }
[Resolved]
private ISkinSource skin { get; set; }
[BackgroundDependencyLoader]
private void load(DrawableHitObject drawableObject)
private void load()
{
var drawableOsuObject = (DrawableOsuHitObject)drawableObject;
@ -144,28 +147,31 @@ namespace osu.Game.Rulesets.Osu.Skinning
{
const double legacy_fade_duration = 240;
switch (state.NewValue)
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime, true))
{
case ArmedState.Hit:
circleSprites.FadeOut(legacy_fade_duration, Easing.Out);
circleSprites.ScaleTo(1.4f, legacy_fade_duration, Easing.Out);
switch (state.NewValue)
{
case ArmedState.Hit:
circleSprites.FadeOut(legacy_fade_duration, Easing.Out);
circleSprites.ScaleTo(1.4f, legacy_fade_duration, Easing.Out);
if (hasNumber)
{
var legacyVersion = skin.GetConfig<LegacySetting, decimal>(LegacySetting.Version)?.Value;
if (legacyVersion >= 2.0m)
// legacy skins of version 2.0 and newer only apply very short fade out to the number piece.
hitCircleText.FadeOut(legacy_fade_duration / 4, Easing.Out);
else
if (hasNumber)
{
// old skins scale and fade it normally along other pieces.
hitCircleText.FadeOut(legacy_fade_duration, Easing.Out);
hitCircleText.ScaleTo(1.4f, legacy_fade_duration, Easing.Out);
}
}
var legacyVersion = skin.GetConfig<LegacySetting, decimal>(LegacySetting.Version)?.Value;
break;
if (legacyVersion >= 2.0m)
// legacy skins of version 2.0 and newer only apply very short fade out to the number piece.
hitCircleText.FadeOut(legacy_fade_duration / 4, Easing.Out);
else
{
// old skins scale and fade it normally along other pieces.
hitCircleText.FadeOut(legacy_fade_duration, Easing.Out);
hitCircleText.ScaleTo(1.4f, legacy_fade_duration, Easing.Out);
}
}
break;
}
}
}
}