1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-25 03:07:34 +08:00

Fixed multiple critical bugs and changed allSamples to a normal Dictionary for faster access

This commit is contained in:
FreezyLemon 2017-12-08 09:41:13 +01:00
parent 40e750f309
commit 61a6a2919e
2 changed files with 7 additions and 3 deletions

View File

@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Taiko.UI
private readonly Box background;
private ControlPointInfo controlPointInfo;
private SortedDictionary<double, Tuple<SampleChannel, SampleChannel>> allSamples;
private Dictionary<double, Tuple<SampleChannel, SampleChannel>> allSamples;
private AudioManager audio;
public TaikoPlayfield(ControlPointInfo controlPointInfo)
@ -210,6 +210,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{
this.audio = audio;
allSamples = new Dictionary<double, Tuple<SampleChannel, SampleChannel>>();
foreach (var soundPoint in controlPointInfo.SoundPoints)
{
var normalSample = SampleInfo.FromSoundPoint(soundPoint).GetChannel(audio.Sample);
@ -282,7 +283,10 @@ namespace osu.Game.Rulesets.Taiko.UI
public bool OnPressed(TaikoAction action)
{
if (!allSamples.TryGetValue(controlPointInfo.SoundPointAt(Clock.CurrentTime).Time, out Tuple<SampleChannel, SampleChannel> samples))
var currentTime = Clock.CurrentTime;
var soundPoint = currentTime < controlPointInfo.SoundPoints[0].Time ? controlPointInfo.SoundPoints[0] : controlPointInfo.SoundPointAt(currentTime);
if (!allSamples.TryGetValue(soundPoint.Time, out Tuple<SampleChannel, SampleChannel> samples))
throw new InvalidOperationException("Current sample set not found.");
if (action == TaikoAction.LeftCentre || action == TaikoAction.RightCentre)

View File

@ -27,7 +27,7 @@ namespace osu.Game.Audio
public SampleChannel GetChannel(SampleManager manager)
{
var channel = manager.Get($"{Bank}-{Name}");
var channel = manager.Get($"Gameplay/{Bank}-{Name}");
channel.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(Volume / 100.0));
return channel;