mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 17:02:55 +08:00
Merge branch 'master' into fix-drumroll-nullref
This commit is contained in:
commit
41727509d7
@ -22,16 +22,14 @@ namespace osu.Game.Skinning
|
||||
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
|
||||
: base(skin)
|
||||
{
|
||||
storage = new LegacySkinResourceStore(skin, storage);
|
||||
samples = audioManager.GetSampleManager(storage);
|
||||
textures = new TextureStore(new RawTextureLoaderStore(storage));
|
||||
}
|
||||
|
||||
private string getPathForFile(string filename) =>
|
||||
SkinInfo.Files.FirstOrDefault(f => string.Equals(Path.GetFileNameWithoutExtension(f.Filename), filename, StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath;
|
||||
|
||||
public override Drawable GetDrawableComponent(string componentName)
|
||||
{
|
||||
var texture = textures.Get(getPathForFile(componentName.Split('/').Last()));
|
||||
var texture = textures.Get(componentName);
|
||||
if (texture == null) return null;
|
||||
|
||||
return new Sprite
|
||||
@ -42,6 +40,25 @@ namespace osu.Game.Skinning
|
||||
};
|
||||
}
|
||||
|
||||
public override SampleChannel GetSample(string sampleName) => samples.Get(getPathForFile(sampleName.Split('/').Last()));
|
||||
public override SampleChannel GetSample(string sampleName) => samples.Get(sampleName);
|
||||
|
||||
private class LegacySkinResourceStore : IResourceStore<byte[]>
|
||||
{
|
||||
private readonly SkinInfo skin;
|
||||
private readonly IResourceStore<byte[]> underlyingStore;
|
||||
|
||||
private string getPathForFile(string filename) =>
|
||||
skin.Files.FirstOrDefault(f => string.Equals(Path.GetFileNameWithoutExtension(f.Filename), filename.Split('/').Last(), StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath;
|
||||
|
||||
public LegacySkinResourceStore(SkinInfo skin, IResourceStore<byte[]> underlyingStore)
|
||||
{
|
||||
this.skin = skin;
|
||||
this.underlyingStore = underlyingStore;
|
||||
}
|
||||
|
||||
public Stream GetStream(string name) => underlyingStore.GetStream(getPathForFile(name));
|
||||
|
||||
byte[] IResourceStore<byte[]>.Get(string name) => underlyingStore.Get(getPathForFile(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
}
|
||||
}
|
||||
|
||||
public override bool RemoveCompletedTransforms => false;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
|
||||
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
public bool FlipH { get; set; }
|
||||
public bool FlipV { get; set; }
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
|
||||
protected override Vector2 DrawScale
|
||||
=> new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y);
|
||||
|
||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
public bool FlipH { get; set; }
|
||||
public bool FlipV { get; set; }
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
|
||||
protected override Vector2 DrawScale
|
||||
=> new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user