mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add automatic resource mapping for rulesets to their own dll
This commit is contained in:
@ -14,10 +14,14 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Input.Handlers;
|
||||
@ -51,6 +55,10 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
private readonly Lazy<Playfield> playfield;
|
||||
|
||||
private TextureStore textureStore;
|
||||
|
||||
private ISampleStore sampleStore;
|
||||
|
||||
/// <summary>
|
||||
/// The playfield.
|
||||
/// </summary>
|
||||
@ -142,6 +150,18 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||
|
||||
var resources = Ruleset.CreateReourceStore();
|
||||
|
||||
if (resources != null)
|
||||
{
|
||||
textureStore = new TextureStore(new TextureLoaderStore(new NamespacedResourceStore<byte[]>(resources, "Textures")));
|
||||
textureStore.AddStore(dependencies.Get<TextureStore>());
|
||||
dependencies.Cache(textureStore);
|
||||
|
||||
sampleStore = dependencies.Get<AudioManager>().GetSampleStore(new NamespacedResourceStore<byte[]>(resources, "Samples"));
|
||||
dependencies.CacheAs(sampleStore);
|
||||
}
|
||||
|
||||
onScreenDisplay = dependencies.Get<OnScreenDisplay>();
|
||||
|
||||
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
|
||||
|
Reference in New Issue
Block a user