mirror of
https://github.com/ppy/osu
synced 2024-12-16 03:45:46 +00:00
Merge pull request #12924 from smoogipoo/fix-dho-skin
Fix DHOs not receiving initial skin changed events
This commit is contained in:
commit
ae30754aa0
@ -5,12 +5,14 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
@ -32,6 +34,16 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
AddStep($"{term} Small", () => SetContents(() => testSingle(7, autoplay)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSpinningSamplePitchShift()
|
||||
{
|
||||
AddStep("Add spinner", () => SetContents(() => testSingle(5, true, 4000)));
|
||||
AddUntilStep("Pitch starts low", () => getSpinningSample().Frequency.Value < 0.8);
|
||||
AddUntilStep("Pitch increases", () => getSpinningSample().Frequency.Value > 0.8);
|
||||
|
||||
PausableSkinnableSound getSpinningSample() => drawableSpinner.ChildrenOfType<PausableSkinnableSound>().FirstOrDefault(s => s.Samples.Any(i => i.LookupNames.Any(l => l.Contains("spinnerspin"))));
|
||||
}
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestLongSpinner(bool autoplay)
|
||||
@ -93,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
base.Update();
|
||||
if (auto)
|
||||
RotationTracker.AddRotation((float)(Clock.ElapsedFrameTime * 3));
|
||||
RotationTracker.AddRotation((float)(Clock.ElapsedFrameTime * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
private Bindable<bool> isSpinning;
|
||||
private bool spinnerFrequencyModulate;
|
||||
|
||||
private const float spinning_sample_initial_frequency = 1.0f;
|
||||
private const float spinning_sample_modulated_base_frequency = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of bonus score gained from spinning after the required number of spins, for display purposes.
|
||||
/// </summary>
|
||||
@ -106,9 +109,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
isSpinning.BindValueChanged(updateSpinningSample);
|
||||
}
|
||||
|
||||
private const float spinning_sample_initial_frequency = 1.0f;
|
||||
private const float spinning_sample_modulated_base_frequency = 0.5f;
|
||||
|
||||
protected override void OnFree()
|
||||
{
|
||||
base.OnFree();
|
||||
|
@ -172,7 +172,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
base.AddInternal(Samples = new PausableSkinnableSound());
|
||||
|
||||
CurrentSkin = skinSource;
|
||||
CurrentSkin.SourceChanged += onSkinSourceChanged;
|
||||
CurrentSkin.SourceChanged += skinSourceChanged;
|
||||
}
|
||||
|
||||
protected override void LoadAsyncComplete()
|
||||
{
|
||||
base.LoadAsyncComplete();
|
||||
skinChanged();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -495,7 +501,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
protected ISkinSource CurrentSkin { get; private set; }
|
||||
|
||||
private void onSkinSourceChanged() => Scheduler.AddOnce(() =>
|
||||
private void skinSourceChanged() => Scheduler.AddOnce(skinChanged);
|
||||
|
||||
private void skinChanged()
|
||||
{
|
||||
UpdateComboColour();
|
||||
|
||||
@ -503,7 +511,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
if (IsLoaded)
|
||||
updateState(State.Value, true);
|
||||
});
|
||||
}
|
||||
|
||||
protected void UpdateComboColour()
|
||||
{
|
||||
@ -747,7 +755,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
if (HitObject != null)
|
||||
HitObject.DefaultsApplied -= onDefaultsApplied;
|
||||
|
||||
CurrentSkin.SourceChanged -= onSkinSourceChanged;
|
||||
CurrentSkin.SourceChanged -= skinSourceChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user