mirror of
https://github.com/ppy/osu.git
synced 2026-05-13 19:54:15 +08:00
Don't consider user toggles for beatmap skin/samples when in editor (#37662)
As far as I can tell this matches stable expectations. As with most things editor, it doesn't make sense to skin a beatmap and then want to edit the beatmap without that skin applied, ever. --- As mentioned in https://github.com/ppy/osu/discussions/37607. Could probably be implemented in five different ways, this is just the simplest that came to me. Well aware this is adding even more faff on top of the config/disable/toggles for this stuff, but feels required for editor sanity. --------- Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
c74c54d770
commit
0457cb924a
@@ -26,6 +26,7 @@ namespace osu.Game.Tests.Skins
|
||||
public partial class TestSceneBeatmapSkinLookupDisables : OsuTestScene
|
||||
{
|
||||
private UserSkinSource userSource;
|
||||
private BeatmapSkinProvidingContainer beatmapSkinProvider;
|
||||
private BeatmapSkinSource beatmapSource;
|
||||
private SkinRequester requester;
|
||||
|
||||
@@ -36,7 +37,7 @@ namespace osu.Game.Tests.Skins
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
Add(new SkinProvidingContainer(userSource = new UserSkinSource())
|
||||
.WithChild(new BeatmapSkinProvidingContainer(beatmapSource = new BeatmapSkinSource())
|
||||
.WithChild(beatmapSkinProvider = new BeatmapSkinProvidingContainer(beatmapSource = new BeatmapSkinSource())
|
||||
.WithChild(requester = new SkinRequester())));
|
||||
});
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace osu.Game.Tests.Skins
|
||||
[TestCase(true)]
|
||||
public void TestDrawableLookup(bool allowBeatmapLookups)
|
||||
{
|
||||
AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => config.SetValue(OsuSetting.BeatmapSkins, allowBeatmapLookups));
|
||||
AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => beatmapSkinProvider.BeatmapSkins.Value = allowBeatmapLookups);
|
||||
|
||||
string expected = allowBeatmapLookups ? "beatmap" : "user";
|
||||
|
||||
@@ -55,7 +56,7 @@ namespace osu.Game.Tests.Skins
|
||||
[TestCase(true)]
|
||||
public void TestProviderLookup(bool allowBeatmapLookups)
|
||||
{
|
||||
AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => config.SetValue(OsuSetting.BeatmapSkins, allowBeatmapLookups));
|
||||
AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => beatmapSkinProvider.BeatmapSkins.Value = allowBeatmapLookups);
|
||||
|
||||
ISkin expected() => allowBeatmapLookups ? beatmapSource : userSource;
|
||||
|
||||
|
||||
@@ -287,6 +287,10 @@ namespace osu.Game.Screens.Play
|
||||
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score, ScoreProcessor, HealthProcessor, Beatmap.Value.Storyboard, PlayingState));
|
||||
|
||||
var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin);
|
||||
config.BindWith(OsuSetting.BeatmapSkins, rulesetSkinProvider.BeatmapSkins);
|
||||
config.BindWith(OsuSetting.BeatmapColours, rulesetSkinProvider.BeatmapColours);
|
||||
config.BindWith(OsuSetting.BeatmapHitsounds, rulesetSkinProvider.BeatmapHitsounds);
|
||||
|
||||
GameplayClockContainer.Add(new GameplayScrollWheelHandling());
|
||||
|
||||
// needs to exist in frame stable content, but is used by underlay layers so make sure assigned early.
|
||||
|
||||
@@ -124,7 +124,8 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.TopCentre,
|
||||
});
|
||||
|
||||
AddInternal(new RulesetSkinProvidingContainer(GameplayState.Ruleset, GameplayState.Beatmap, Beatmap.Value.Skin)
|
||||
RulesetSkinProvidingContainer rulesetSkinProvider;
|
||||
AddInternal(rulesetSkinProvider = new RulesetSkinProvidingContainer(GameplayState.Ruleset, GameplayState.Beatmap, Beatmap.Value.Skin)
|
||||
{
|
||||
Child = failIndicator = new ReplayFailIndicator(GameplayClockContainer)
|
||||
{
|
||||
@@ -138,6 +139,9 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
});
|
||||
config.BindWith(OsuSetting.BeatmapSkins, rulesetSkinProvider.BeatmapSkins);
|
||||
config.BindWith(OsuSetting.BeatmapColours, rulesetSkinProvider.BeatmapColours);
|
||||
config.BindWith(OsuSetting.BeatmapHitsounds, rulesetSkinProvider.BeatmapHitsounds);
|
||||
}
|
||||
|
||||
protected override void PrepareReplay()
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Storyboards;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
@@ -15,55 +12,19 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
public partial class BeatmapSkinProvidingContainer : SkinProvidingContainer
|
||||
{
|
||||
private Bindable<bool> beatmapSkins = null!;
|
||||
private Bindable<bool> beatmapColours = null!;
|
||||
private Bindable<bool> beatmapHitsounds = null!;
|
||||
public BindableWithCurrent<bool> BeatmapSkins = new BindableWithCurrent<bool>(true);
|
||||
public BindableWithCurrent<bool> BeatmapColours = new BindableWithCurrent<bool>(true);
|
||||
public BindableWithCurrent<bool> BeatmapHitsounds = new BindableWithCurrent<bool>(true);
|
||||
|
||||
protected override bool AllowConfigurationLookup
|
||||
{
|
||||
get
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
protected override bool AllowConfigurationLookup => BeatmapSkins.Value;
|
||||
|
||||
return beatmapSkins.Value;
|
||||
}
|
||||
}
|
||||
protected override bool AllowColourLookup => BeatmapColours.Value;
|
||||
|
||||
protected override bool AllowColourLookup
|
||||
{
|
||||
get
|
||||
{
|
||||
if (beatmapColours == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
protected override bool AllowDrawableLookup(ISkinComponentLookup lookup) => BeatmapSkins.Value;
|
||||
|
||||
return beatmapColours.Value;
|
||||
}
|
||||
}
|
||||
protected override bool AllowTextureLookup(string componentName) => BeatmapSkins.Value;
|
||||
|
||||
protected override bool AllowDrawableLookup(ISkinComponentLookup lookup)
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapSkins.Value;
|
||||
}
|
||||
|
||||
protected override bool AllowTextureLookup(string componentName)
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapSkins.Value;
|
||||
}
|
||||
|
||||
protected override bool AllowSampleLookup(ISampleInfo sampleInfo)
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return sampleInfo is StoryboardSampleInfo || beatmapHitsounds.Value;
|
||||
}
|
||||
protected override bool AllowSampleLookup(ISampleInfo sampleInfo) => BeatmapHitsounds.Value;
|
||||
|
||||
private readonly ISkin skin;
|
||||
private readonly ISkin? classicFallback;
|
||||
@@ -77,23 +38,12 @@ namespace osu.Game.Skinning
|
||||
this.classicFallback = classicFallback;
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(SkinManager skins)
|
||||
{
|
||||
beatmapSkins.BindValueChanged(_ => TriggerSourceChanged());
|
||||
beatmapColours.BindValueChanged(_ => TriggerSourceChanged());
|
||||
beatmapHitsounds.BindValueChanged(_ => TriggerSourceChanged());
|
||||
BeatmapSkins.BindValueChanged(_ => TriggerSourceChanged());
|
||||
BeatmapColours.BindValueChanged(_ => TriggerSourceChanged());
|
||||
BeatmapHitsounds.BindValueChanged(_ => TriggerSourceChanged());
|
||||
|
||||
currentSkin = skins.CurrentSkin.GetBoundCopy();
|
||||
currentSkin.BindValueChanged(_ =>
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.IO.Stores;
|
||||
@@ -25,6 +26,10 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
public partial class RulesetSkinProvidingContainer : SkinProvidingContainer
|
||||
{
|
||||
public BindableWithCurrent<bool> BeatmapSkins = new BindableWithCurrent<bool>(true);
|
||||
public BindableWithCurrent<bool> BeatmapColours = new BindableWithCurrent<bool>(true);
|
||||
public BindableWithCurrent<bool> BeatmapHitsounds = new BindableWithCurrent<bool>(true);
|
||||
|
||||
protected readonly Ruleset Ruleset;
|
||||
protected readonly IBeatmap Beatmap;
|
||||
|
||||
@@ -55,6 +60,9 @@ namespace osu.Game.Skinning
|
||||
InternalChild = new BeatmapSkinProvidingContainer(GetRulesetTransformedSkin(beatmapSkin), GetRulesetTransformedSkin(skinManager.DefaultClassicSkin))
|
||||
{
|
||||
Child = Content,
|
||||
BeatmapSkins = BeatmapSkins,
|
||||
BeatmapColours = BeatmapColours,
|
||||
BeatmapHitsounds = BeatmapHitsounds,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user