mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Fix skinning support for combobreak
This commit is contained in:
@ -2,10 +2,9 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
@ -13,23 +12,31 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class ComboEffects : CompositeDrawable
|
||||
{
|
||||
private SampleChannel sampleComboBreak;
|
||||
private readonly ScoreProcessor processor;
|
||||
|
||||
private SkinnableSound comboBreakSample;
|
||||
|
||||
public ComboEffects(ScoreProcessor processor)
|
||||
{
|
||||
processor.Combo.BindValueChanged(onComboChange);
|
||||
this.processor = processor;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak"));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
processor.Combo.BindValueChanged(onComboChange, true);
|
||||
}
|
||||
|
||||
private void onComboChange(ValueChangedEvent<int> combo)
|
||||
{
|
||||
if (combo.NewValue == 0 && combo.OldValue > 20)
|
||||
sampleComboBreak?.Play();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource skin, AudioManager audio)
|
||||
{
|
||||
sampleComboBreak = skin.GetSample(@"Gameplay/combobreak") ?? audio.Samples.Get(@"Gameplay/combobreak");
|
||||
comboBreakSample?.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user