mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Added beatmap colour settings checkbox and associated tests.
This commit is contained in:
parent
10fd4cf7c9
commit
5f10bcce02
@ -7,9 +7,12 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Osu.Configuration;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Skinning;
|
||||
@ -24,34 +27,81 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
[Resolved]
|
||||
private AudioManager audio { get; set; }
|
||||
|
||||
[TestCase(true)]
|
||||
[TestCase(false)]
|
||||
public void TestBeatmapComboColours(bool customSkinColoursPresent)
|
||||
private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
|
||||
private readonly Bindable<bool> beatmapColours = new Bindable<bool>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins);
|
||||
config.BindWith(OsuSetting.BeatmapColours, beatmapColours);
|
||||
}
|
||||
|
||||
[TestCase(true, true, true)]
|
||||
[TestCase(true, false, true)]
|
||||
[TestCase(false, true, true)]
|
||||
[TestCase(false, false, true)]
|
||||
public void TestBeatmapComboColours(bool userHasCustomColours, bool useBeatmapSkin, bool useBeatmapColour)
|
||||
{
|
||||
ExposedPlayer player = null;
|
||||
|
||||
AddStep("load coloured beatmap", () => player = loadBeatmap(customSkinColoursPresent, true));
|
||||
configureSettings(useBeatmapSkin, useBeatmapColour);
|
||||
AddStep("load coloured beatmap", () => player = loadBeatmap(userHasCustomColours, true));
|
||||
AddUntilStep("wait for player", () => player.IsLoaded);
|
||||
|
||||
AddAssert("is beatmap skin colours", () => player.UsableComboColours.SequenceEqual(TestBeatmapSkin.Colours));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapNoComboColours()
|
||||
[TestCase(true, false)]
|
||||
[TestCase(false, false)]
|
||||
public void TestBeatmapComboColoursOverride(bool useBeatmapSkin, bool useBeatmapColour)
|
||||
{
|
||||
ExposedPlayer player = null;
|
||||
|
||||
configureSettings(useBeatmapSkin, useBeatmapColour);
|
||||
AddStep("load coloured beatmap", () => player = loadBeatmap(true, true));
|
||||
AddUntilStep("wait for player", () => player.IsLoaded);
|
||||
|
||||
AddAssert("is user custom skin colours", () => player.UsableComboColours.SequenceEqual(TestSkin.Colours));
|
||||
}
|
||||
|
||||
[TestCase(true, false)]
|
||||
[TestCase(false, false)]
|
||||
public void TestBeatmapComboColoursOverrideWithDefaultColours(bool useBeatmapSkin, bool useBeatmapColour)
|
||||
{
|
||||
ExposedPlayer player = null;
|
||||
|
||||
configureSettings(useBeatmapSkin, useBeatmapColour);
|
||||
AddStep("load coloured beatmap", () => player = loadBeatmap(false, true));
|
||||
AddUntilStep("wait for player", () => player.IsLoaded);
|
||||
|
||||
AddAssert("is default user skin colours", () => player.UsableComboColours.SequenceEqual(SkinConfiguration.DefaultComboColours));
|
||||
}
|
||||
|
||||
[TestCase(true, true)]
|
||||
[TestCase(false, true)]
|
||||
[TestCase(true, false)]
|
||||
[TestCase(false, false)]
|
||||
public void TestBeatmapNoComboColours(bool useBeatmapSkin, bool useBeatmapColour)
|
||||
{
|
||||
ExposedPlayer player = null;
|
||||
|
||||
configureSettings(useBeatmapSkin, useBeatmapColour);
|
||||
AddStep("load no-colour beatmap", () => player = loadBeatmap(false, false));
|
||||
AddUntilStep("wait for player", () => player.IsLoaded);
|
||||
|
||||
AddAssert("is default user skin colours", () => player.UsableComboColours.SequenceEqual(SkinConfiguration.DefaultComboColours));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapNoComboColoursSkinOverride()
|
||||
[TestCase(true, true)]
|
||||
[TestCase(false, true)]
|
||||
[TestCase(true, false)]
|
||||
[TestCase(false, false)]
|
||||
public void TestBeatmapNoComboColoursSkinOverride(bool useBeatmapSkin, bool useBeatmapColour)
|
||||
{
|
||||
ExposedPlayer player = null;
|
||||
|
||||
configureSettings(useBeatmapSkin, useBeatmapColour);
|
||||
AddStep("load custom-skin colour", () => player = loadBeatmap(true, false));
|
||||
AddUntilStep("wait for player", () => player.IsLoaded);
|
||||
|
||||
@ -69,6 +119,18 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
return player;
|
||||
}
|
||||
|
||||
private void configureSettings(bool beatmapSkins, bool beatmapColours)
|
||||
{
|
||||
AddStep($"{(beatmapSkins ? "enable" : "disable")} beatmap skins", () =>
|
||||
{
|
||||
this.beatmapSkins.Value = beatmapSkins;
|
||||
});
|
||||
AddStep($"{(beatmapColours ? "enable" : "disable")} beatmap colours", () =>
|
||||
{
|
||||
this.beatmapColours.Value = beatmapColours;
|
||||
});
|
||||
}
|
||||
|
||||
private class ExposedPlayer : Player
|
||||
{
|
||||
private readonly bool userHasCustomColours;
|
||||
|
@ -52,6 +52,31 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
checkNextHitObject(null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapColourDefault()
|
||||
{
|
||||
AddStep("enable user provider", () => testUserSkin.Enabled = true);
|
||||
|
||||
AddStep("enable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, true));
|
||||
AddStep("enable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, true));
|
||||
checkNextHitObject("beatmap");
|
||||
|
||||
AddStep("enable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, true));
|
||||
AddStep("disable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, false));
|
||||
checkNextHitObject("beatmap");
|
||||
|
||||
AddStep("disable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, false));
|
||||
AddStep("enable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, true));
|
||||
checkNextHitObject("user");
|
||||
|
||||
AddStep("disable beatmap skin", () => LocalConfig.Set<bool>(OsuSetting.BeatmapSkins, false));
|
||||
AddStep("disable beatmap colours", () => LocalConfig.Set<bool>(OsuSetting.BeatmapColours, false));
|
||||
checkNextHitObject("user");
|
||||
|
||||
AddStep("disable user provider", () => testUserSkin.Enabled = false);
|
||||
checkNextHitObject(null);
|
||||
}
|
||||
|
||||
private void checkNextHitObject(string skin) =>
|
||||
AddUntilStep($"check skin from {skin}", () =>
|
||||
{
|
||||
|
@ -82,6 +82,7 @@ namespace osu.Game.Configuration
|
||||
|
||||
Set(OsuSetting.ShowStoryboard, true);
|
||||
Set(OsuSetting.BeatmapSkins, true);
|
||||
Set(OsuSetting.BeatmapColours, true);
|
||||
Set(OsuSetting.BeatmapHitsounds, true);
|
||||
|
||||
Set(OsuSetting.CursorRotation, true);
|
||||
@ -250,6 +251,7 @@ namespace osu.Game.Configuration
|
||||
ScreenshotCaptureMenuCursor,
|
||||
SongSelectRightMouseScroll,
|
||||
BeatmapSkins,
|
||||
BeatmapColours,
|
||||
BeatmapHitsounds,
|
||||
IncreaseFirstObjectVisibility,
|
||||
ScoreDisplayMode,
|
||||
|
@ -70,6 +70,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Beatmap colours",
|
||||
Current = config.GetBindable<bool>(OsuSetting.BeatmapColours)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Beatmap hitsounds",
|
||||
Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds)
|
||||
|
@ -14,6 +14,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
private readonly PlayerSliderBar<double> blurSliderBar;
|
||||
private readonly PlayerCheckbox showStoryboardToggle;
|
||||
private readonly PlayerCheckbox beatmapSkinsToggle;
|
||||
private readonly PlayerCheckbox beatmapColorsToggle;
|
||||
private readonly PlayerCheckbox beatmapHitsoundsToggle;
|
||||
|
||||
public VisualSettings()
|
||||
@ -43,6 +44,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
},
|
||||
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboard / Video" },
|
||||
beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" },
|
||||
beatmapColorsToggle = new PlayerCheckbox { LabelText = "Beatmap colours" },
|
||||
beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" }
|
||||
};
|
||||
}
|
||||
@ -54,6 +56,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
blurSliderBar.Current = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
showStoryboardToggle.Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
beatmapSkinsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||
beatmapColorsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapColours);
|
||||
beatmapHitsoundsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace osu.Game.Skinning
|
||||
public class BeatmapSkinProvidingContainer : SkinProvidingContainer
|
||||
{
|
||||
private Bindable<bool> beatmapSkins;
|
||||
private Bindable<bool> beatmapColours;
|
||||
private Bindable<bool> beatmapHitsounds;
|
||||
|
||||
protected override bool AllowConfigurationLookup
|
||||
@ -24,10 +25,10 @@ namespace osu.Game.Skinning
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapSkins.Value;
|
||||
return beatmapColours.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override bool AllowDrawableLookup(ISkinComponent component)
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
@ -62,6 +63,7 @@ namespace osu.Game.Skinning
|
||||
var config = parent.Get<OsuConfigManager>();
|
||||
|
||||
beatmapSkins = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||
beatmapColours = config.GetBindable<bool>(OsuSetting.BeatmapColours);
|
||||
beatmapHitsounds = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||
|
||||
return base.CreateChildDependencies(parent);
|
||||
@ -71,6 +73,7 @@ namespace osu.Game.Skinning
|
||||
private void load()
|
||||
{
|
||||
beatmapSkins.BindValueChanged(_ => TriggerSourceChanged());
|
||||
beatmapColours.BindValueChanged(_ => TriggerSourceChanged());
|
||||
beatmapHitsounds.BindValueChanged(_ => TriggerSourceChanged());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user