mirror of
https://github.com/ppy/osu.git
synced 2025-02-01 22:42:54 +08:00
Merge branch 'master' into fix-beatmap-wedge-appear
This commit is contained in:
commit
259e32f485
@ -1 +1 @@
|
|||||||
Subproject commit 4287ee8043fb1419017359bc3a5db5dc06bc643f
|
Subproject commit e01f71160fb9b3167efcd177c7d7dba9e5d36604
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Taiko.Audio
|
|||||||
public class DrumSampleMapping
|
public class DrumSampleMapping
|
||||||
{
|
{
|
||||||
private readonly ControlPointInfo controlPoints;
|
private readonly ControlPointInfo controlPoints;
|
||||||
private readonly Dictionary<SampleControlPoint, DrumSample> mappings = new Dictionary<SampleControlPoint, DrumSample>();
|
private readonly Dictionary<double, DrumSample> mappings = new Dictionary<double, DrumSample>();
|
||||||
|
|
||||||
public DrumSampleMapping(ControlPointInfo controlPoints, AudioManager audio)
|
public DrumSampleMapping(ControlPointInfo controlPoints, AudioManager audio)
|
||||||
{
|
{
|
||||||
@ -26,17 +25,17 @@ namespace osu.Game.Rulesets.Taiko.Audio
|
|||||||
else
|
else
|
||||||
samplePoints = controlPoints.SamplePoints;
|
samplePoints = controlPoints.SamplePoints;
|
||||||
|
|
||||||
foreach (var s in samplePoints.Distinct())
|
foreach (var s in samplePoints)
|
||||||
{
|
{
|
||||||
mappings[s] = new DrumSample
|
mappings[s.Time] = new DrumSample
|
||||||
{
|
{
|
||||||
Centre = s.GetSampleInfo().GetChannel(audio.Sample),
|
Centre = s.GetSampleInfo().GetChannel(audio.Sample, "Taiko"),
|
||||||
Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample)
|
Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample, "Taiko")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time)];
|
public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time).Time];
|
||||||
|
|
||||||
public class DrumSample
|
public class DrumSample
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
// Normal and clap samples are handled by the drum
|
// Normal and clap samples are handled by the drum
|
||||||
protected override IEnumerable<SampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != SampleInfo.HIT_NORMAL && s.Name != SampleInfo.HIT_CLAP);
|
protected override IEnumerable<SampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != SampleInfo.HIT_NORMAL && s.Name != SampleInfo.HIT_CLAP);
|
||||||
|
|
||||||
|
protected override string SampleNamespace => "Taiko";
|
||||||
|
|
||||||
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece();
|
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece();
|
||||||
|
|
||||||
public abstract bool OnPressed(TaikoAction action);
|
public abstract bool OnPressed(TaikoAction action);
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Game.Audio;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
|
||||||
@ -75,13 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
FirstTick = first,
|
FirstTick = first,
|
||||||
TickSpacing = tickSpacing,
|
TickSpacing = tickSpacing,
|
||||||
StartTime = t,
|
StartTime = t,
|
||||||
IsStrong = IsStrong,
|
IsStrong = IsStrong
|
||||||
Samples = new List<SampleInfo>(Samples.Select(s => new SampleInfo
|
|
||||||
{
|
|
||||||
Bank = s.Bank,
|
|
||||||
Name = @"slidertick",
|
|
||||||
Volume = s.Volume
|
|
||||||
}))
|
|
||||||
});
|
});
|
||||||
|
|
||||||
first = false;
|
first = false;
|
||||||
|
44
osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs
Normal file
44
osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Taiko.Audio;
|
||||||
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests
|
||||||
|
{
|
||||||
|
[Ignore("getting CI working")]
|
||||||
|
public class TestCaseInputDrum : OsuTestCase
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(InputDrum),
|
||||||
|
typeof(DrumSampleMapping),
|
||||||
|
typeof(SampleInfo),
|
||||||
|
typeof(SampleControlPoint)
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestCaseInputDrum()
|
||||||
|
{
|
||||||
|
Add(new TaikoInputManager(new RulesetInfo { ID = 1 })
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(200),
|
||||||
|
Child = new InputDrum(new ControlPointInfo())
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -152,14 +152,14 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
target = centreHit;
|
target = centreHit;
|
||||||
back = centre;
|
back = centre;
|
||||||
|
|
||||||
drumSample.Centre.Play();
|
drumSample.Centre?.Play();
|
||||||
}
|
}
|
||||||
else if (action == RimAction)
|
else if (action == RimAction)
|
||||||
{
|
{
|
||||||
target = rimHit;
|
target = rimHit;
|
||||||
back = rim;
|
back = rim;
|
||||||
|
|
||||||
drumSample.Rim.Play();
|
drumSample.Rim?.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Scoring\TaikoScoreProcessor.cs" />
|
<Compile Include="Scoring\TaikoScoreProcessor.cs" />
|
||||||
<Compile Include="TaikoInputManager.cs" />
|
<Compile Include="TaikoInputManager.cs" />
|
||||||
|
<Compile Include="Tests\TestCaseInputDrum.cs" />
|
||||||
<Compile Include="Tests\TestCasePerformancePoints.cs" />
|
<Compile Include="Tests\TestCasePerformancePoints.cs" />
|
||||||
<Compile Include="Tests\TestCaseTaikoPlayfield.cs" />
|
<Compile Include="Tests\TestCaseTaikoPlayfield.cs" />
|
||||||
<Compile Include="UI\HitTarget.cs" />
|
<Compile Include="UI\HitTarget.cs" />
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
|
|
||||||
namespace osu.Game.Audio
|
namespace osu.Game.Audio
|
||||||
@ -14,10 +15,20 @@ namespace osu.Game.Audio
|
|||||||
public const string HIT_NORMAL = @"hitnormal";
|
public const string HIT_NORMAL = @"hitnormal";
|
||||||
public const string HIT_CLAP = @"hitclap";
|
public const string HIT_CLAP = @"hitclap";
|
||||||
|
|
||||||
public SampleChannel GetChannel(SampleManager manager)
|
public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null)
|
||||||
{
|
{
|
||||||
var channel = manager.Get($"Gameplay/{Bank}-{Name}");
|
SampleChannel channel = null;
|
||||||
channel.Volume.Value = Volume / 100.0;
|
|
||||||
|
if (resourceNamespace != null)
|
||||||
|
channel = manager.Get(Path.Combine("Gameplay", resourceNamespace, $"{Bank}-{Name}"));
|
||||||
|
|
||||||
|
// try without namespace as a fallback.
|
||||||
|
if (channel == null)
|
||||||
|
channel = manager.Get(Path.Combine("Gameplay", $"{Bank}-{Name}"));
|
||||||
|
|
||||||
|
if (channel != null)
|
||||||
|
channel.Volume.Value = Volume / 100.0;
|
||||||
|
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default sample volume at this control point.
|
/// The default sample volume at this control point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SampleVolume;
|
public int SampleVolume = 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a SampleInfo based on the sample settings in this control point.
|
/// Create a SampleInfo based on the sample settings in this control point.
|
||||||
|
@ -74,6 +74,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
protected List<SampleChannel> Samples = new List<SampleChannel>();
|
protected List<SampleChannel> Samples = new List<SampleChannel>();
|
||||||
protected virtual IEnumerable<SampleInfo> GetSamples() => HitObject.Samples;
|
protected virtual IEnumerable<SampleInfo> GetSamples() => HitObject.Samples;
|
||||||
|
|
||||||
|
// Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first
|
||||||
|
protected virtual string SampleNamespace => null;
|
||||||
|
|
||||||
public readonly Bindable<ArmedState> State = new Bindable<ArmedState>();
|
public readonly Bindable<ArmedState> State = new Bindable<ArmedState>();
|
||||||
|
|
||||||
protected DrawableHitObject(TObject hitObject)
|
protected DrawableHitObject(TObject hitObject)
|
||||||
@ -101,7 +104,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
Volume = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume
|
Volume = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume
|
||||||
};
|
};
|
||||||
|
|
||||||
SampleChannel channel = localSampleInfo.GetChannel(audio.Sample);
|
SampleChannel channel = localSampleInfo.GetChannel(audio.Sample, SampleNamespace);
|
||||||
|
|
||||||
if (channel == null)
|
if (channel == null)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user