Merge branch 'master' into fix-skin-layout-editor-crash

This commit is contained in:
Dean Herbert
2021-10-28 06:24:20 +09:00
322 changed files with 2368 additions and 979 deletions

View File

@ -41,7 +41,7 @@ namespace osu.Game.Skinning
public override ISample GetSample(ISampleInfo sampleInfo)
{
foreach (var lookup in sampleInfo.LookupNames)
foreach (string lookup in sampleInfo.LookupNames)
{
var sample = resources.AudioManager.Samples.Get(lookup);
if (sample != null)

View File

@ -41,7 +41,7 @@ namespace osu.Game.Skinning.Editor
if (targetContainers.Length == 0)
{
var targetScreen = target.ChildrenOfType<Screen>().LastOrDefault()?.GetType().Name ?? "this screen";
string targetScreen = target.ChildrenOfType<Screen>().LastOrDefault()?.GetType().Name ?? "this screen";
AddInternal(new ScreenWhiteBox.UnderConstructionMessage(targetScreen, "doesn't support skin customisation just yet."));
return;

View File

@ -66,7 +66,7 @@ namespace osu.Game.Skinning
{
Debug.Assert(currentConfig != null);
foreach (var line in pendingLines)
foreach (string line in pendingLines)
{
var pair = SplitKeyVal(line);

View File

@ -306,7 +306,7 @@ namespace osu.Game.Skinning
=> source.CustomColours.TryGetValue(lookup, out var col) ? new Bindable<Color4>(col) : null;
private IBindable<string> getManiaImage(LegacyManiaSkinConfiguration source, string lookup)
=> source.ImageLookups.TryGetValue(lookup, out var image) ? new Bindable<string>(image) : null;
=> source.ImageLookups.TryGetValue(lookup, out string image) ? new Bindable<string>(image) : null;
[CanBeNull]
private IBindable<TValue> legacySettingLookup<TValue>(SkinConfiguration.LegacySetting legacySetting)
@ -326,7 +326,7 @@ namespace osu.Game.Skinning
{
try
{
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out var val))
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out string val))
{
// special case for handling skins which use 1 or 0 to signify a boolean state.
if (typeof(TValue) == typeof(bool))
@ -472,7 +472,7 @@ namespace osu.Game.Skinning
public override Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
{
foreach (var name in getFallbackNames(componentName))
foreach (string name in getFallbackNames(componentName))
{
float ratio = 2;
var texture = Textures?.Get($"{name}@2x", wrapModeS, wrapModeT);
@ -504,7 +504,7 @@ namespace osu.Game.Skinning
lookupNames = sampleInfo.LookupNames.SelectMany(getFallbackNames);
}
foreach (var lookup in lookupNames)
foreach (string lookup in lookupNames)
{
var sample = Samples?.Get(lookup);
@ -529,7 +529,7 @@ namespace osu.Game.Skinning
lookupNames = lookupNames.Where(name => !name.EndsWith(hitSample.Suffix, StringComparison.Ordinal));
}
foreach (var l in lookupNames)
foreach (string l in lookupNames)
yield return l;
// also for compatibility, try falling back to non-bank samples (so-called "universal" samples) as the last resort.

View File

@ -35,7 +35,7 @@ namespace osu.Game.Skinning
case @"Version":
if (pair.Value == "latest")
skin.LegacyVersion = SkinConfiguration.LATEST_VERSION;
else if (decimal.TryParse(pair.Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var version))
else if (decimal.TryParse(pair.Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out decimal version))
skin.LegacyVersion = version;
return;

View File

@ -26,9 +26,9 @@ namespace osu.Game.Skinning
if (source.Files == null)
yield break;
foreach (var filename in base.GetFilenames(name))
foreach (string filename in base.GetFilenames(name))
{
var path = getPathForFile(filename.ToStandardisedPath());
string path = getPathForFile(filename.ToStandardisedPath());
if (path != null)
yield return path;
}

View File

@ -49,7 +49,7 @@ namespace osu.Game.Skinning
public ITexturedCharacterGlyph Get(string fontName, char character)
{
var lookup = getLookupName(character);
string lookup = getLookupName(character);
var texture = skin.GetTexture($"{fontName}-{lookup}");

View File

@ -36,7 +36,7 @@ namespace osu.Game.Skinning
public ISample? GetSample(ISampleInfo sampleInfo)
{
foreach (var lookup in sampleInfo.LookupNames)
foreach (string? lookup in sampleInfo.LookupNames)
{
ISample? sample = samples.Get(lookup);
if (sample != null)

View File

@ -63,7 +63,7 @@ namespace osu.Game.Skinning
if (fileInfo == null)
continue;
var bytes = resources?.Files.Get(fileInfo.FileInfo.StoragePath);
byte[] bytes = resources?.Files.Get(fileInfo.FileInfo.StoragePath);
if (bytes == null)
continue;
@ -93,7 +93,7 @@ namespace osu.Game.Skinning
private Stream getConfigurationStream()
{
var path = SkinInfo.Files.SingleOrDefault(f => f.Filename == "skin.ini")?.FileInfo.StoragePath;
string path = SkinInfo.Files.SingleOrDefault(f => f.Filename == "skin.ini")?.FileInfo.StoragePath;
if (string.IsNullOrEmpty(path))
return null;