mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Ability to contain multiple sample banks. Get default bank name from control point.
This commit is contained in:
@ -43,7 +43,7 @@ namespace osu.Game.Modes.Osu.Beatmaps
|
|||||||
return new Slider
|
return new Slider
|
||||||
{
|
{
|
||||||
StartTime = original.StartTime,
|
StartTime = original.StartTime,
|
||||||
SampleBank = original.SampleBank,
|
SampleBanks = original.SampleBanks,
|
||||||
CurveObject = curveData,
|
CurveObject = curveData,
|
||||||
Position = positionData?.Position ?? Vector2.Zero,
|
Position = positionData?.Position ?? Vector2.Zero,
|
||||||
NewCombo = comboData?.NewCombo ?? false
|
NewCombo = comboData?.NewCombo ?? false
|
||||||
@ -55,7 +55,7 @@ namespace osu.Game.Modes.Osu.Beatmaps
|
|||||||
return new Spinner
|
return new Spinner
|
||||||
{
|
{
|
||||||
StartTime = original.StartTime,
|
StartTime = original.StartTime,
|
||||||
SampleBank = original.SampleBank,
|
SampleBanks = original.SampleBanks,
|
||||||
Position = new Vector2(512, 384) / 2,
|
Position = new Vector2(512, 384) / 2,
|
||||||
EndTime = endTimeData.EndTime
|
EndTime = endTimeData.EndTime
|
||||||
};
|
};
|
||||||
@ -64,7 +64,7 @@ namespace osu.Game.Modes.Osu.Beatmaps
|
|||||||
return new HitCircle
|
return new HitCircle
|
||||||
{
|
{
|
||||||
StartTime = original.StartTime,
|
StartTime = original.StartTime,
|
||||||
SampleBank = original.SampleBank,
|
SampleBanks = original.SampleBanks,
|
||||||
Position = positionData?.Position ?? Vector2.Zero,
|
Position = positionData?.Position ?? Vector2.Zero,
|
||||||
NewCombo = comboData?.NewCombo ?? false
|
NewCombo = comboData?.NewCombo ?? false
|
||||||
};
|
};
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
ComboIndex = s.ComboIndex,
|
ComboIndex = s.ComboIndex,
|
||||||
Scale = s.Scale,
|
Scale = s.Scale,
|
||||||
ComboColour = s.ComboColour,
|
ComboColour = s.ComboColour,
|
||||||
SampleBank = s.SampleBank,
|
SampleBanks = s.SampleBanks,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Modes.Objects.Drawables;
|
|||||||
using osu.Game.Modes.Osu.Judgements;
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -28,6 +29,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
|
|
||||||
protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.SliderTick };
|
protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.SliderTick };
|
||||||
|
|
||||||
|
private List<SampleChannel> samples = new List<SampleChannel>();
|
||||||
|
|
||||||
public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick)
|
public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick)
|
||||||
{
|
{
|
||||||
this.sliderTick = sliderTick;
|
this.sliderTick = sliderTick;
|
||||||
@ -53,20 +56,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private SampleChannel sample;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
sample = audio.Sample.Get($@"Gameplay/{HitObject.SampleBank.Name}-slidertick");
|
foreach (var bank in HitObject.SampleBanks)
|
||||||
|
samples.Add(audio.Sample.Get($@"Gameplay/{bank.Name}-slidertick"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PlaySamples()
|
protected override void PlaySamples()
|
||||||
{
|
{
|
||||||
sample?.Play();
|
samples.ForEach(s => s?.Play());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void CheckJudgement(bool userTriggered)
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
{
|
{
|
||||||
if (Judgement.TimeOffset >= 0)
|
if (Judgement.TimeOffset >= 0)
|
||||||
|
@ -95,7 +95,7 @@ namespace osu.Game.Modes.Osu.Objects
|
|||||||
StackHeight = StackHeight,
|
StackHeight = StackHeight,
|
||||||
Scale = Scale,
|
Scale = Scale,
|
||||||
ComboColour = ComboColour,
|
ComboColour = ComboColour,
|
||||||
SampleBank = SampleBank
|
SampleBanks = SampleBanks
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
var endTimeData = obj as IHasEndTime;
|
var endTimeData = obj as IHasEndTime;
|
||||||
|
|
||||||
// Old osu! used hit sounding to determine various hit type information
|
// Old osu! used hit sounding to determine various hit type information
|
||||||
SampleBank sampleBank = obj.SampleBank;
|
List<SampleBank> sampleBanks = obj.SampleBanks;
|
||||||
|
|
||||||
bool strong = sampleBank.Sets.Any(s => s.Type == SampleType.Finish);
|
bool strong = sampleBanks.Any(b => b.Samples.Any(s => s.Type == SampleType.Finish));
|
||||||
|
|
||||||
if (distanceData != null)
|
if (distanceData != null)
|
||||||
{
|
{
|
||||||
@ -98,7 +98,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
yield return new CentreHit
|
yield return new CentreHit
|
||||||
{
|
{
|
||||||
StartTime = j,
|
StartTime = j,
|
||||||
SampleBank = obj.SampleBank,
|
SampleBanks = obj.SampleBanks,
|
||||||
IsStrong = strong,
|
IsStrong = strong,
|
||||||
VelocityMultiplier = legacy_velocity_multiplier
|
VelocityMultiplier = legacy_velocity_multiplier
|
||||||
};
|
};
|
||||||
@ -109,7 +109,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
yield return new DrumRoll
|
yield return new DrumRoll
|
||||||
{
|
{
|
||||||
StartTime = obj.StartTime,
|
StartTime = obj.StartTime,
|
||||||
SampleBank = obj.SampleBank,
|
SampleBanks = obj.SampleBanks,
|
||||||
IsStrong = strong,
|
IsStrong = strong,
|
||||||
Distance = distance,
|
Distance = distance,
|
||||||
TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4,
|
TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4,
|
||||||
@ -124,7 +124,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
yield return new Swell
|
yield return new Swell
|
||||||
{
|
{
|
||||||
StartTime = obj.StartTime,
|
StartTime = obj.StartTime,
|
||||||
SampleBank = obj.SampleBank,
|
SampleBanks = obj.SampleBanks,
|
||||||
IsStrong = strong,
|
IsStrong = strong,
|
||||||
EndTime = endTimeData.EndTime,
|
EndTime = endTimeData.EndTime,
|
||||||
RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier),
|
RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier),
|
||||||
@ -133,14 +133,14 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool isCentre = sampleBank.Sets.Any(s => s.Type == SampleType.Normal);
|
bool isCentre = sampleBanks.Any(b => b.Samples.Any(s => s.Type == SampleType.Normal));
|
||||||
|
|
||||||
if (isCentre)
|
if (isCentre)
|
||||||
{
|
{
|
||||||
yield return new CentreHit
|
yield return new CentreHit
|
||||||
{
|
{
|
||||||
StartTime = obj.StartTime,
|
StartTime = obj.StartTime,
|
||||||
SampleBank = obj.SampleBank,
|
SampleBanks = obj.SampleBanks,
|
||||||
IsStrong = strong,
|
IsStrong = strong,
|
||||||
VelocityMultiplier = legacy_velocity_multiplier
|
VelocityMultiplier = legacy_velocity_multiplier
|
||||||
};
|
};
|
||||||
@ -150,7 +150,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
yield return new RimHit
|
yield return new RimHit
|
||||||
{
|
{
|
||||||
StartTime = obj.StartTime,
|
StartTime = obj.StartTime,
|
||||||
SampleBank = obj.SampleBank,
|
SampleBanks = obj.SampleBanks,
|
||||||
IsStrong = strong,
|
IsStrong = strong,
|
||||||
VelocityMultiplier = legacy_velocity_multiplier
|
VelocityMultiplier = legacy_velocity_multiplier
|
||||||
};
|
};
|
||||||
|
@ -95,7 +95,7 @@ namespace osu.Game.Modes.Taiko.Objects
|
|||||||
TickSpacing = tickSpacing,
|
TickSpacing = tickSpacing,
|
||||||
StartTime = t,
|
StartTime = t,
|
||||||
IsStrong = IsStrong,
|
IsStrong = IsStrong,
|
||||||
SampleBank = SampleBank
|
SampleBanks = SampleBanks
|
||||||
});
|
});
|
||||||
|
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -11,6 +11,7 @@ using osu.Game.Modes;
|
|||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osu.Game.Modes.Osu;
|
using osu.Game.Modes.Osu;
|
||||||
using osu.Game.Modes.Objects.Legacy;
|
using osu.Game.Modes.Objects.Legacy;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Beatmaps.Formats
|
namespace osu.Game.Tests.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
@ -136,12 +137,12 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
Assert.IsNotNull(slider);
|
Assert.IsNotNull(slider);
|
||||||
Assert.AreEqual(new Vector2(192, 168), slider.Position);
|
Assert.AreEqual(new Vector2(192, 168), slider.Position);
|
||||||
Assert.AreEqual(956, slider.StartTime);
|
Assert.AreEqual(956, slider.StartTime);
|
||||||
Assert.AreEqual(SampleType.None, slider.SampleBank.Type);
|
Assert.IsTrue(slider.SampleBanks.Any(b => b.Name == "none"));
|
||||||
var hit = beatmap.HitObjects[1] as LegacyHit;
|
var hit = beatmap.HitObjects[1] as LegacyHit;
|
||||||
Assert.IsNotNull(hit);
|
Assert.IsNotNull(hit);
|
||||||
Assert.AreEqual(new Vector2(304, 56), hit.Position);
|
Assert.AreEqual(new Vector2(304, 56), hit.Position);
|
||||||
Assert.AreEqual(1285, hit.StartTime);
|
Assert.AreEqual(1285, hit.StartTime);
|
||||||
Assert.AreEqual(SampleType.Clap, hit.SampleBank.Type);
|
Assert.IsTrue(hit.SampleBanks.Any(b => b.Name == "clap"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps.Samples
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of samples that are to be played to be played from this bank.
|
/// The list of samples that are to be played to be played from this bank.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Sample> Sets;
|
public List<Sample> Samples;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// In conversion from osu-stable, this is equivalent to SampleSet (_not_ CustomSampleSet).
|
/// In conversion from osu-stable, this is equivalent to SampleSet (_not_ CustomSampleSet).
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps.Timing
|
|||||||
TimingChange = true,
|
TimingChange = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
public SampleInfo Sample;
|
public SampleBank SampleBank;
|
||||||
public TimeSignatures TimeSignature;
|
public TimeSignatures TimeSignature;
|
||||||
public double Time;
|
public double Time;
|
||||||
public double BeatLength;
|
public double BeatLength;
|
||||||
|
@ -59,8 +59,9 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
foreach (var sample in HitObject.SampleBank.Sets)
|
foreach (var bank in HitObject.SampleBanks)
|
||||||
samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type}-hit{HitObject.SampleBank.Name}"));
|
foreach (var sample in bank.Samples)
|
||||||
|
samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type}-hit{bank.Name}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArmedState state;
|
private ArmedState state;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Game.Beatmaps.Samples;
|
using osu.Game.Beatmaps.Samples;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Objects
|
namespace osu.Game.Modes.Objects
|
||||||
{
|
{
|
||||||
@ -21,15 +22,29 @@ namespace osu.Game.Modes.Objects
|
|||||||
public double StartTime { get; set; }
|
public double StartTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The sample bank to be played when this hit object is hit.
|
/// The sample banks to be played when this hit object is hit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SampleBank SampleBank { get; set; }
|
public List<SampleBank> SampleBanks = new List<SampleBank>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies default values to this HitObject.
|
/// Applies default values to this HitObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="difficulty">The difficulty settings to use.</param>
|
/// <param name="difficulty">The difficulty settings to use.</param>
|
||||||
/// <param name="timing">The timing settings to use.</param>
|
/// <param name="timing">The timing settings to use.</param>
|
||||||
public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { }
|
public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
|
||||||
|
{
|
||||||
|
foreach (var bank in SampleBanks)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(bank.Name))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// If the bank is not assigned a name, assign it from the relevant timing point
|
||||||
|
ControlPoint overridePoint;
|
||||||
|
ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint);
|
||||||
|
|
||||||
|
bank.Name = (overridePoint ?? timingPoint)?.SampleBank.Name ?? string.Empty;
|
||||||
|
bank.Volume = (overridePoint ?? timingPoint)?.SampleBank.Volume ?? 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user