Esempio n. 1
0
        public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore <byte[]> resources, GameHost host = null,
                              WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
            : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
        {
            this.rulesets     = rulesets;
            this.audioManager = audioManager;
            this.resources    = resources;
            this.host         = host;

            DefaultBeatmap = defaultBeatmap;

            beatmaps = (BeatmapStore)ModelStore;
            beatmaps.BeatmapHidden   += b => beatmapHidden.Value = new WeakReference <BeatmapInfo>(b);
            beatmaps.BeatmapRestored += b => beatmapRestored.Value = new WeakReference <BeatmapInfo>(b);
            beatmaps.ItemRemoved     += removeWorkingCache;
            beatmaps.ItemUpdated     += removeWorkingCache;

            if (performOnlineLookups)
            {
                onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
            }

            largeTextureStore = new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store));
            trackStore        = audioManager.GetTrackStore(Files.Store);
        }
Esempio n. 2
0
        public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore <byte[]> resources, GameHost host = null,
                              WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
        {
            beatmapModelManager    = CreateBeatmapModelManager(storage, contextFactory, rulesets, api, host);
            beatmapModelDownloader = CreateBeatmapModelDownloader(beatmapModelManager, api, host);
            workingBeatmapCache    = CreateWorkingBeatmapCache(audioManager, resources, new FileStore(contextFactory, storage).Store, defaultBeatmap, host);

            workingBeatmapCache.BeatmapManager = beatmapModelManager;

            if (performOnlineLookups)
            {
                onlineBetamapLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
                beatmapModelManager.OnlineLookupQueue = onlineBetamapLookupQueue;
            }
        }
Esempio n. 3
0
        public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null,
                              WorkingBeatmap defaultBeatmap = null)
            : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
        {
            this.rulesets     = rulesets;
            this.audioManager = audioManager;
            this.host         = host;

            DefaultBeatmap = defaultBeatmap;

            beatmaps = (BeatmapStore)ModelStore;
            beatmaps.BeatmapHidden   += b => beatmapHidden.Value = new WeakReference <BeatmapInfo>(b);
            beatmaps.BeatmapRestored += b => beatmapRestored.Value = new WeakReference <BeatmapInfo>(b);

            onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
        }
Esempio n. 4
0
        public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null,
                              WorkingBeatmap defaultBeatmap = null)
            : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
        {
            this.rulesets     = rulesets;
            this.audioManager = audioManager;
            this.host         = host;

            DefaultBeatmap = defaultBeatmap;

            beatmaps = (BeatmapStore)ModelStore;
            beatmaps.BeatmapHidden   += b => BeatmapHidden?.Invoke(b);
            beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b);

            onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
            exportStorage     = storage.GetStorageForDirectory("exports");
        }
Esempio n. 5
0
        public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore <byte[]> gameResources, GameHost host = null, WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
        {
            var userResources = new FileStore(contextFactory, storage).Store;

            BeatmapTrackStore = audioManager.GetTrackStore(userResources);

            beatmapModelManager = CreateBeatmapModelManager(storage, contextFactory, rulesets, api, host);
            workingBeatmapCache = CreateWorkingBeatmapCache(audioManager, gameResources, userResources, defaultBeatmap, host);

            workingBeatmapCache.BeatmapManager      = beatmapModelManager;
            beatmapModelManager.WorkingBeatmapCache = workingBeatmapCache;

            if (performOnlineLookups)
            {
                onlineBeatmapLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
                beatmapModelManager.OnlineLookupQueue = onlineBeatmapLookupQueue;
            }
        }