mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Move basic transformer behaviour to base abstract
class
This commit is contained in:
32
osu.Game/Skinning/SkinTransformer.cs
Normal file
32
osu.Game/Skinning/SkinTransformer.cs
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public abstract class SkinTransformer : ISkinTransformer
|
||||
{
|
||||
public ISkin Skin { get; }
|
||||
|
||||
protected SkinTransformer(ISkin skin)
|
||||
{
|
||||
Skin = skin ?? throw new ArgumentNullException(nameof(skin));
|
||||
}
|
||||
|
||||
public virtual Drawable? GetDrawableComponent(ISkinComponent component) => Skin.GetDrawableComponent(component);
|
||||
|
||||
public virtual Texture? GetTexture(string componentName) => GetTexture(componentName, default, default);
|
||||
|
||||
public virtual Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Skin.GetTexture(componentName, wrapModeS, wrapModeT);
|
||||
|
||||
public virtual ISample? GetSample(ISampleInfo sampleInfo) => Skin.GetSample(sampleInfo);
|
||||
|
||||
public virtual IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup) where TLookup : notnull where TValue : notnull => Skin.GetConfig<TLookup, TValue>(lookup);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user