mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Cache TournamentStorage as Storage and only cast when necessary
This commit is contained in:
parent
e5851be9ad
commit
9d2392b6b1
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Video;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Tournament.IO;
|
||||
@ -18,7 +19,6 @@ namespace osu.Game.Tournament.Components
|
||||
private readonly string filename;
|
||||
private readonly bool drawFallbackGradient;
|
||||
private Video video;
|
||||
|
||||
private ManualClock manualClock;
|
||||
|
||||
public TourneyVideo(string filename, bool drawFallbackGradient = false)
|
||||
@ -28,9 +28,10 @@ namespace osu.Game.Tournament.Components
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TournamentStorage storage)
|
||||
private void load(Storage storage)
|
||||
{
|
||||
var stream = storage.VideoStore.GetStream(filename);
|
||||
var tournamentStorage = storage as TournamentStorage;
|
||||
var stream = tournamentStorage.VideoStore.GetStream(filename);
|
||||
|
||||
if (stream != null)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Tournament.IO;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Tournament.Models;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||
@ -14,9 +14,9 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||
{
|
||||
private const string teams_filename = "drawings.txt";
|
||||
|
||||
private readonly TournamentStorage storage;
|
||||
private readonly Storage storage;
|
||||
|
||||
public StorageBackedTeamList(TournamentStorage storage)
|
||||
public StorageBackedTeamList(Storage storage)
|
||||
{
|
||||
this.storage = storage;
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.IO;
|
||||
using osu.Game.Tournament.Models;
|
||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
||||
using osuTK;
|
||||
@ -36,12 +36,12 @@ namespace osu.Game.Tournament.Screens.Drawings
|
||||
|
||||
private Task writeOp;
|
||||
|
||||
private TournamentStorage storage;
|
||||
private Storage storage;
|
||||
|
||||
public ITeamList TeamList;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures, TournamentStorage storage)
|
||||
private void load(TextureStore textures, Storage storage)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
Resources.AddStore(new DllResourceStore(typeof(TournamentGameBase).Assembly));
|
||||
|
||||
dependencies.CacheAs(storage = new TournamentStorage(baseStorage));
|
||||
dependencies.CacheAs<Storage>(storage = new TournamentStorage(baseStorage));
|
||||
|
||||
Textures.AddStore(new TextureLoaderStore(storage.VideoStore));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user