mirror of
https://github.com/ppy/osu
synced 2024-12-30 19:02:27 +00:00
Merge GlobalSkinConfiguration settings into the LegacySetting enum
This commit is contained in:
parent
91ce06aaa7
commit
5439099b7c
@ -6,9 +6,9 @@ using osu.Framework.IO.Stores;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Skinning;
|
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
|
using static osu.Game.Skinning.LegacySkinConfiguration;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Gameplay
|
namespace osu.Game.Tests.Gameplay
|
||||||
{
|
{
|
||||||
@ -190,7 +190,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests that when a custom sample bank is used, but <see cref="GlobalSkinConfiguration.LayeredHitSounds"/> is disabled,
|
/// Tests that when a custom sample bank is used, but <see cref="LegacySetting.LayeredHitSounds"/> is disabled,
|
||||||
/// only the additional sound will be looked up.
|
/// only the additional sound will be looked up.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
@ -209,7 +209,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests that when a normal sample bank is used and <see cref="GlobalSkinConfiguration.LayeredHitSounds"/> is disabled,
|
/// Tests that when a normal sample bank is used and <see cref="LegacySetting.LayeredHitSounds"/> is disabled,
|
||||||
/// the normal sound will be looked up anyway.
|
/// the normal sound will be looked up anyway.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
@ -226,6 +226,6 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void disableLayeredHitSounds()
|
private void disableLayeredHitSounds()
|
||||||
=> AddStep("set LayeredHitSounds to false", () => Skin.Configuration.ConfigDictionary[GlobalSkinConfiguration.LayeredHitSounds.ToString()] = "0");
|
=> AddStep("set LayeredHitSounds to false", () => Skin.Configuration.ConfigDictionary[LegacySetting.LayeredHitSounds.ToString()] = "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Layered hit samples are automatically added in all modes (except osu!mania), but can be disabled
|
/// Layered hit samples are automatically added in all modes (except osu!mania), but can be disabled
|
||||||
/// using the <see cref="GlobalSkinConfiguration.LayeredHitSounds"/> skin config option.
|
/// using the <see cref="LegacySkinConfiguration.LegacySetting.LayeredHitSounds"/> skin config option.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public bool IsLayered { get; set; }
|
public bool IsLayered { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
|
||||||
{
|
|
||||||
public enum GlobalSkinConfiguration
|
|
||||||
{
|
|
||||||
AnimationFramerate,
|
|
||||||
LayeredHitSounds,
|
|
||||||
}
|
|
||||||
}
|
|
@ -120,15 +120,6 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LegacySkinConfiguration.LegacySetting legacy:
|
|
||||||
switch (legacy)
|
|
||||||
{
|
|
||||||
case LegacySkinConfiguration.LegacySetting.Version:
|
|
||||||
return SkinUtils.As<TValue>(new Bindable<decimal>(Configuration.LegacyVersion ?? LegacySkinConfiguration.LATEST_VERSION));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SkinCustomColourLookup customColour:
|
case SkinCustomColourLookup customColour:
|
||||||
return SkinUtils.As<TValue>(getCustomColour(Configuration, customColour.Lookup.ToString()));
|
return SkinUtils.As<TValue>(getCustomColour(Configuration, customColour.Lookup.ToString()));
|
||||||
|
|
||||||
@ -142,8 +133,11 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LegacySkinConfiguration.LegacySetting s when s == LegacySkinConfiguration.LegacySetting.Version:
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<decimal>(Configuration.LegacyVersion ?? LegacySkinConfiguration.LATEST_VERSION));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// handles lookups like GlobalSkinConfiguration
|
// handles lookups like some in LegacySkinConfiguration.LegacySetting
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,8 @@ namespace osu.Game.Skinning
|
|||||||
public enum LegacySetting
|
public enum LegacySetting
|
||||||
{
|
{
|
||||||
Version,
|
Version,
|
||||||
|
AnimationFramerate,
|
||||||
|
LayeredHitSounds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Animations;
|
|||||||
using osu.Framework.Graphics.OpenGL.Textures;
|
using osu.Framework.Graphics.OpenGL.Textures;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using static osu.Game.Skinning.LegacySkinConfiguration;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -89,7 +90,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
if (applyConfigFrameRate)
|
if (applyConfigFrameRate)
|
||||||
{
|
{
|
||||||
var iniRate = source.GetConfig<GlobalSkinConfiguration, int>(GlobalSkinConfiguration.AnimationFramerate);
|
var iniRate = source.GetConfig<LegacySetting, int>(LegacySetting.AnimationFramerate);
|
||||||
|
|
||||||
if (iniRate?.Value > 0)
|
if (iniRate?.Value > 0)
|
||||||
return 1000f / iniRate.Value;
|
return 1000f / iniRate.Value;
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.OpenGL.Textures;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
|
using static osu.Game.Skinning.LegacySkinConfiguration;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -38,7 +39,7 @@ namespace osu.Game.Skinning
|
|||||||
if (!(sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample))
|
if (!(sampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacySample))
|
||||||
return Source.GetSample(sampleInfo);
|
return Source.GetSample(sampleInfo);
|
||||||
|
|
||||||
var playLayeredHitSounds = GetConfig<GlobalSkinConfiguration, bool>(GlobalSkinConfiguration.LayeredHitSounds);
|
var playLayeredHitSounds = GetConfig<LegacySetting, bool>(LegacySetting.LayeredHitSounds);
|
||||||
if (legacySample.IsLayered && playLayeredHitSounds?.Value == false)
|
if (legacySample.IsLayered && playLayeredHitSounds?.Value == false)
|
||||||
return new SampleChannelVirtual();
|
return new SampleChannelVirtual();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user