mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Merge pull request #18618 from peppy/isolate-ui-scale-screens-better
Isolate nested sample screens from main game to avoid toolbar interactions
This commit is contained in:
commit
4df8219c8f
@ -126,6 +126,7 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
private class SampleScreenContainer : CompositeDrawable
|
private class SampleScreenContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly OsuScreen screen;
|
private readonly OsuScreen screen;
|
||||||
|
|
||||||
// Minimal isolation from main game.
|
// Minimal isolation from main game.
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
@ -151,6 +152,9 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
|
new DependencyContainer(new DependencyIsolationContainer(base.CreateChildDependencies(parent)));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, TextureStore textures, RulesetStore rulesets)
|
private void load(AudioManager audio, TextureStore textures, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
@ -197,5 +201,41 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
stack.PushSynchronously(screen);
|
stack.PushSynchronously(screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DependencyIsolationContainer : IReadOnlyDependencyContainer
|
||||||
|
{
|
||||||
|
private readonly IReadOnlyDependencyContainer parentDependencies;
|
||||||
|
|
||||||
|
private readonly Type[] isolatedTypes =
|
||||||
|
{
|
||||||
|
typeof(OsuGame)
|
||||||
|
};
|
||||||
|
|
||||||
|
public DependencyIsolationContainer(IReadOnlyDependencyContainer parentDependencies)
|
||||||
|
{
|
||||||
|
this.parentDependencies = parentDependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Get(Type type)
|
||||||
|
{
|
||||||
|
if (isolatedTypes.Contains(type))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return parentDependencies.Get(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Get(Type type, CacheInfo info)
|
||||||
|
{
|
||||||
|
if (isolatedTypes.Contains(type))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return parentDependencies.Get(type, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Inject<T>(T instance) where T : class
|
||||||
|
{
|
||||||
|
parentDependencies.Inject(instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user