mirror of https://github.com/ppy/osu
Make `RulesetSkinProvidingContainer` able to be overriden for testing purposes
This commit is contained in:
parent
09a2d008d2
commit
ef2c4fd0d8
|
@ -234,7 +234,7 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
|
|||
|
||||
dependencies.CacheAs(GameplayBeatmap);
|
||||
|
||||
var rulesetSkinProvider = new RulesetSkinProvidingContainer(GameplayRuleset, playableBeatmap, Beatmap.Value.Skin);
|
||||
var rulesetSkinProvider = CreateRulesetSkinProvider(GameplayRuleset, playableBeatmap, Beatmap.Value.Skin);
|
||||
|
||||
// load the skinning hierarchy first.
|
||||
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
|
||||
|
@ -315,6 +315,8 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
|
|||
|
||||
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
||||
|
||||
protected virtual RulesetSkinProvidingContainer CreateRulesetSkinProvider(Ruleset ruleset, IBeatmap beatmap, ISkin beatmapSkin) => new RulesetSkinProvidingContainer(ruleset, beatmap, beatmapSkin);
|
||||
|
||||
private Drawable createUnderlayComponents() =>
|
||||
DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ namespace osu.Game.Skinning
|
|||
/// </summary>
|
||||
public class RulesetSkinProvidingContainer : SkinProvidingContainer
|
||||
{
|
||||
private readonly Ruleset ruleset;
|
||||
private readonly IBeatmap beatmap;
|
||||
protected readonly Ruleset Ruleset;
|
||||
protected readonly IBeatmap Beatmap;
|
||||
|
||||
protected override Container<Drawable> Content { get; }
|
||||
|
||||
public RulesetSkinProvidingContainer(Ruleset ruleset, IBeatmap beatmap, [CanBeNull] ISkin beatmapSkin)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
this.beatmap = beatmap;
|
||||
Ruleset = ruleset;
|
||||
Beatmap = beatmap;
|
||||
|
||||
InternalChild = new BeatmapSkinProvidingContainer(beatmapSkin == null ? null : ruleset.CreateLegacySkinProvider(beatmapSkin, beatmap))
|
||||
{
|
||||
|
@ -41,25 +41,25 @@ public RulesetSkinProvidingContainer(Ruleset ruleset, IBeatmap beatmap, [CanBeNu
|
|||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
updateSkins();
|
||||
UpdateSkins();
|
||||
}
|
||||
|
||||
protected override void OnSourceChanged()
|
||||
{
|
||||
updateSkins();
|
||||
UpdateSkins();
|
||||
base.OnSourceChanged();
|
||||
}
|
||||
|
||||
private void updateSkins()
|
||||
protected virtual void UpdateSkins()
|
||||
{
|
||||
SkinSources.Clear();
|
||||
|
||||
SkinSources.Add(ruleset.CreateLegacySkinProvider(skinManager.CurrentSkin.Value, beatmap));
|
||||
SkinSources.Add(Ruleset.CreateLegacySkinProvider(skinManager.CurrentSkin.Value, Beatmap));
|
||||
|
||||
if (skinManager.CurrentSkin.Value is LegacySkin)
|
||||
SkinSources.Add(ruleset.CreateLegacySkinProvider(skinManager.DefaultLegacySkin, beatmap));
|
||||
SkinSources.Add(Ruleset.CreateLegacySkinProvider(skinManager.DefaultLegacySkin, Beatmap));
|
||||
|
||||
SkinSources.Add(ruleset.CreateLegacySkinProvider(skinManager.DefaultSkin, beatmap));
|
||||
SkinSources.Add(Ruleset.CreateLegacySkinProvider(skinManager.DefaultSkin, Beatmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue