Merge pull request #6151 from peppy/state-update-on-skin-change

Always update drawable hitobject state on skin change
This commit is contained in:
Dan Balasescu 2019-09-19 15:12:49 +09:00 committed by GitHub
commit e686bcf8e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -163,9 +163,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private float sliderPathRadius;
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
protected override void ApplySkin(ISkinSource skin, bool allowFallback)
{
base.SkinChanged(skin, allowFallback);
base.ApplySkin(skin, allowFallback);
Body.BorderSize = skin.GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.SliderBorderSize)?.Value ?? SliderBody.DEFAULT_BORDER_SIZE;
sliderPathRadius = skin.GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.SliderPathRadius)?.Value ?? OsuHitObject.OBJECT_RADIUS;

View File

@ -240,7 +240,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
#endregion
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
protected sealed override void SkinChanged(ISkinSource skin, bool allowFallback)
{
base.SkinChanged(skin, allowFallback);
@ -250,6 +250,20 @@ namespace osu.Game.Rulesets.Objects.Drawables
AccentColour.Value = comboColours?.Count > 0 ? comboColours[combo.ComboIndex % comboColours.Count] : Color4.White;
}
ApplySkin(skin, allowFallback);
if (IsLoaded)
updateState(State.Value, true);
}
/// <summary>
/// Called when a change is made to the skin.
/// </summary>
/// <param name="skin">The new skin.</param>
/// <param name="allowFallback">Whether fallback to default skin should be allowed if the custom skin is missing this resource.</param>
protected virtual void ApplySkin(ISkinSource skin, bool allowFallback)
{
}
/// <summary>