mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Merge pull request #5795 from iiSaLMaN/allow-fallback-to-samples-without-bank
Try retrieving samples without bank names
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
@ -43,28 +42,20 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
channels = hitSamples.Select(s =>
|
||||
{
|
||||
var ch = loadChannel(s, skin.GetSample);
|
||||
var ch = skin.GetSample(s);
|
||||
|
||||
if (ch == null && allowFallback)
|
||||
ch = loadChannel(s, audio.Samples.Get);
|
||||
foreach (var lookup in s.LookupNames)
|
||||
if ((ch = audio.Samples.Get($"Gameplay/{lookup}")) != null)
|
||||
break;
|
||||
|
||||
if (ch != null)
|
||||
ch.Volume.Value = s.Volume / 100.0;
|
||||
|
||||
return ch;
|
||||
}).Where(c => c != null).ToArray();
|
||||
}
|
||||
|
||||
private SampleChannel loadChannel(ISampleInfo info, Func<string, SampleChannel> getSampleFunction)
|
||||
{
|
||||
foreach (var lookup in info.LookupNames)
|
||||
{
|
||||
var ch = getSampleFunction($"Gameplay/{lookup}");
|
||||
if (ch == null)
|
||||
continue;
|
||||
|
||||
ch.Volume.Value = info.Volume / 100.0;
|
||||
return ch;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
Reference in New Issue
Block a user