Skip to content

Commit

Permalink
Merge pull request #25443 from peppy/fix-argon-custom-skins
Browse files Browse the repository at this point in the history
Fix customised argon skins no longer loading due to incorrect resource store specification
  • Loading branch information
bdach authored Nov 14, 2023
2 parents 6e0375e + 9a7d7dd commit 711bf14
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
14 changes: 7 additions & 7 deletions osu.Game/Screens/Play/HUD/ArgonCounterTextComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation;
using osu.Framework.Text;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Screens.Play.HUD
Expand Down Expand Up @@ -133,30 +133,30 @@ public ArgonCounterSpriteText(Func<char, string> getLookup)
}

[BackgroundDependencyLoader]
private void load(ISkinSource skin)
private void load(TextureStore textures)
{
Spacing = new Vector2(-2f, 0f);
Font = new FontUsage(@"argon-counter", 1);
glyphStore = new GlyphStore(skin, getLookup);
glyphStore = new GlyphStore(textures, getLookup);
}

protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);

private class GlyphStore : ITexturedGlyphLookupStore
{
private readonly ISkin skin;
private readonly TextureStore textures;
private readonly Func<char, string> getLookup;

public GlyphStore(ISkin skin, Func<char, string> getLookup)
public GlyphStore(TextureStore textures, Func<char, string> getLookup)
{
this.skin = skin;
this.textures = textures;
this.getLookup = getLookup;
}

public ITexturedCharacterGlyph? Get(string fontName, char character)
{
string lookup = getLookup(character);
var texture = skin.GetTexture($"{fontName}-{lookup}");
var texture = textures.Get($"Gameplay/Fonts/{fontName}-{lookup}");

if (texture == null)
return null;
Expand Down
4 changes: 1 addition & 3 deletions osu.Game/Skinning/ArgonSkin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Game.Audio;
using osu.Game.Beatmaps.Formats;
using osu.Game.Extensions;
Expand Down Expand Up @@ -44,8 +43,7 @@ public ArgonSkin(IStorageResourceProvider resources)
public ArgonSkin(SkinInfo skin, IStorageResourceProvider resources)
: base(
skin,
resources,
new NamespacedResourceStore<byte[]>(resources.Resources, "Skins/Argon")
resources
)
{
Resources = resources;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/osu.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</PackageReference>
<PackageReference Include="Realm" Version="11.5.0" />
<PackageReference Include="ppy.osu.Framework" Version="2023.1111.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1110.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1114.0" />
<PackageReference Include="Sentry" Version="3.40.0" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.33.0" />
Expand Down

0 comments on commit 711bf14

Please sign in to comment.