Skip to content

Commit

Permalink
Add some skin transformers.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Oct 10, 2022
1 parent 276c4a9 commit c004c84
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 2 deletions.
20 changes: 18 additions & 2 deletions osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
using osu.Game.Rulesets.Karaoke.Replays;
using osu.Game.Rulesets.Karaoke.Resources;
using osu.Game.Rulesets.Karaoke.Scoring;
using osu.Game.Rulesets.Karaoke.Skinning.Argon;
using osu.Game.Rulesets.Karaoke.Skinning.Legacy;
using osu.Game.Rulesets.Karaoke.Skinning.Triangles;
using osu.Game.Rulesets.Karaoke.Statistics;
using osu.Game.Rulesets.Karaoke.UI;
using osu.Game.Rulesets.Mods;
Expand Down Expand Up @@ -193,8 +195,22 @@ public override IResourceStore<byte[]> CreateResourceStore()

public override ISkin CreateSkinTransformer(ISkin skin, IBeatmap beatmap)
{
// always return the legacy skin for now until have skin for karaoke.
return new KaraokeLegacySkinTransformer(skin, beatmap);
switch (skin)
{
case TrianglesSkin:
return new KaraokeTrianglesSkinTransformer(skin, beatmap);

case ArgonSkin:
return new KaraokeArgonSkinTransformer(skin, beatmap);

case DefaultLegacySkin:
return new KaraokeClassicSkinTransformer(skin, beatmap);

case LegacySkin:
return new KaraokeLegacySkinTransformer(skin, beatmap);
}

return null;
}

public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new KaraokeReplayFrame();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Beatmaps;
using osu.Game.Rulesets.Karaoke.Skinning.Default;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Karaoke.Skinning.Argon
{
public class KaraokeArgonSkinTransformer : KaraokeDefaultSkinTransformer
{
public KaraokeArgonSkinTransformer(ISkin skin, IBeatmap beatmap)
: base(skin, beatmap)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Karaoke.Skinning.Default
{
public class KaraokeDefaultSkinTransformer : SkinTransformer
{
private readonly KaraokeSkin karaokeSkin;

public KaraokeDefaultSkinTransformer(ISkin skin, IBeatmap beatmap)
: base(skin)
{
karaokeSkin = new KaraokeSkin(new SkinInfo(), new InternalSkinStorageResourceProvider("Default"));
}

public override IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
=> karaokeSkin.GetConfig<TLookup, TValue>(lookup);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Beatmaps;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Karaoke.Skinning.Legacy
{
public class KaraokeClassicSkinTransformer : KaraokeLegacySkinTransformer
{
public KaraokeClassicSkinTransformer(ISkin source, IBeatmap beatmap)
: base(source, beatmap)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Beatmaps;
using osu.Game.Rulesets.Karaoke.Skinning.Default;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Karaoke.Skinning.Triangles
{
public class KaraokeTrianglesSkinTransformer : KaraokeDefaultSkinTransformer
{
public KaraokeTrianglesSkinTransformer(ISkin skin, IBeatmap beatmap)
: base(skin, beatmap)
{
}
}
}

0 comments on commit c004c84

Please sign in to comment.