mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
Merge branch 'master' into localise-rankings
This commit is contained in:
commit
e4e4c85a11
@ -1,9 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -11,11 +11,11 @@ using osu.Game.Skinning;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public class Metronome : BeatSyncedContainer
|
public class Metronome : BeatSyncedContainer, IAdjustableAudioComponent
|
||||||
{
|
{
|
||||||
private readonly double firstHitTime;
|
private readonly double firstHitTime;
|
||||||
|
|
||||||
private PausableSkinnableSound sample;
|
private readonly PausableSkinnableSound sample;
|
||||||
|
|
||||||
/// <param name="firstHitTime">Start time of the first hit object, used for providing a count down.</param>
|
/// <param name="firstHitTime">Start time of the first hit object, used for providing a count down.</param>
|
||||||
public Metronome(double firstHitTime)
|
public Metronome(double firstHitTime)
|
||||||
@ -23,15 +23,8 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
this.firstHitTime = firstHitTime;
|
this.firstHitTime = firstHitTime;
|
||||||
AllowMistimedEventFiring = false;
|
AllowMistimedEventFiring = false;
|
||||||
Divisor = 1;
|
Divisor = 1;
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
InternalChild = sample = new PausableSkinnableSound(new SampleInfo("Gameplay/catch-banana"));
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
sample = new PausableSkinnableSound(new SampleInfo("Gameplay/catch-banana"))
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
||||||
@ -49,5 +42,50 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
|
sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
|
||||||
sample.Play();
|
sample.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region IAdjustableAudioComponent
|
||||||
|
|
||||||
|
public IBindable<double> AggregateVolume => sample.AggregateVolume;
|
||||||
|
|
||||||
|
public IBindable<double> AggregateBalance => sample.AggregateBalance;
|
||||||
|
|
||||||
|
public IBindable<double> AggregateFrequency => sample.AggregateFrequency;
|
||||||
|
|
||||||
|
public IBindable<double> AggregateTempo => sample.AggregateTempo;
|
||||||
|
|
||||||
|
public BindableNumber<double> Volume => sample.Volume;
|
||||||
|
|
||||||
|
public BindableNumber<double> Balance => sample.Balance;
|
||||||
|
|
||||||
|
public BindableNumber<double> Frequency => sample.Frequency;
|
||||||
|
|
||||||
|
public BindableNumber<double> Tempo => sample.Tempo;
|
||||||
|
|
||||||
|
public void BindAdjustments(IAggregateAudioAdjustment component)
|
||||||
|
{
|
||||||
|
sample.BindAdjustments(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnbindAdjustments(IAggregateAudioAdjustment component)
|
||||||
|
{
|
||||||
|
sample.UnbindAdjustments(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddAdjustment(AdjustableProperty type, IBindable<double> adjustBindable)
|
||||||
|
{
|
||||||
|
sample.AddAdjustment(type, adjustBindable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAdjustment(AdjustableProperty type, IBindable<double> adjustBindable)
|
||||||
|
{
|
||||||
|
sample.RemoveAdjustment(type, adjustBindable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAllAdjustments(AdjustableProperty type)
|
||||||
|
{
|
||||||
|
sample.RemoveAllAdjustments(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user