[皮肤]修复路径问题

This commit is contained in:
ctrwaz
2025-12-29 02:19:57 +08:00
parent 5c4db4a6f7
commit 540e0c61bd
4 changed files with 48 additions and 21 deletions

6
.vscode/launch.json vendored
View File

@@ -7,7 +7,7 @@
"request": "launch",
"program": "dotnet",
"args": [
"${workspaceRoot}/osu.Desktop/bin/Debug/net8.0/osu!.dll"
"${workspaceRoot}/osu.Desktop/bin/Debug/net8.0/Ez2osu!.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build osu! (Debug)",
@@ -19,7 +19,7 @@
"request": "launch",
"program": "dotnet",
"args": [
"${workspaceRoot}/osu.Desktop/bin/Release/net8.0/osu!.dll"
"${workspaceRoot}/osu.Desktop/bin/Release/net8.0/Ez2osu!.dll"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "Build osu! (Release)",
@@ -55,7 +55,7 @@
"request": "launch",
"program": "dotnet",
"args": [
"${workspaceRoot}/osu.Desktop/bin/Debug/net8.0/osu!.dll",
"${workspaceRoot}/osu.Desktop/bin/Debug/net8.0/Ez2osu!.dll",
"--tournament"
],
"cwd": "${workspaceRoot}",

View File

@@ -41,11 +41,10 @@ namespace osu.Game.LAsEzExtensions.Screens
private static readonly Dictionary<string, string> resource_paths = new Dictionary<string, string>
{
["note"] = @"EzResources\note",
["Stage"] = @"EzResources\Stage",
["GameTheme"] = @"EzResources\GameTheme"
["note"] = Path.Combine("EzResources", "note"),
["Stage"] = Path.Combine("EzResources", "Stage"),
["GameTheme"] = Path.Combine("EzResources", "GameTheme")
};
private static readonly Dictionary<bool, (Color4 Color, string TopText, string BottomText)> position_mode_config = new Dictionary<bool, (Color4 Color, string TopText, string BottomText)>
{
[true] = (new Color4(0.2f, 0.4f, 0.8f, 0.3f), "SwitchToAbsolute".Localize(), "SwitchToAbsolute".Localize()),

View File

@@ -3,11 +3,16 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Framework.Text;
using osu.Game.Graphics.Sprites;
@@ -32,13 +37,18 @@ namespace osu.Game.Skinning.Components
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private void load(GameHost host, IRenderer renderer)
{
// Spacing = new Vector2(-2f, 0f);
Storage gameStorage = host.Storage;
var userResourceStore = new StorageBackedResourceStore(gameStorage);
var textureLoader = new TextureLoaderStore(userResourceStore);
var localSkinStore = new TextureStore(renderer, textureLoader);
FontName.BindValueChanged(e =>
{
Font = new FontUsage(FontName.Value.ToString(), 1);
glyphStore = new GlyphStore(textures, getLookup);
glyphStore = new GlyphStore(localSkinStore, getLookup);
foreach (char c in new[] { '.', '%', 'c', 'e', 'l', 'j' })
glyphStore.Get(FontName.Value.ToString(), c);
@@ -77,6 +87,7 @@ namespace osu.Game.Skinning.Components
string textureNameReplace = textureName.Replace(" ", "_");
string[] possiblePaths;
string themeRoot = Path.Combine("EzResources", "GameTheme", textureNameReplace);
switch (character)
{
@@ -86,29 +97,29 @@ namespace osu.Game.Skinning.Components
case 'l':
possiblePaths = new[]
{
$"EzResources/GameTheme/{textureNameReplace}/{lookup}",
Path.Combine(themeRoot, lookup)
};
break;
case 'c':
possiblePaths = new[]
{
$"EzResources/GameTheme/{textureNameReplace}/combo/{lookup}", //combo图
Path.Combine(themeRoot, "combo", lookup)
};
break;
case 'j':
possiblePaths = new[]
{
$"EzResources/GameTheme/{textureNameReplace}/judgement/",
Path.Combine(themeRoot, "judgement")
};
break;
default:
possiblePaths = new[]
{
$"EzResources/GameTheme/{textureNameReplace}/combo/number/{lookup}", //数字
$"EzResources/GameTheme/{textureNameReplace}/judgement/{lookup}", //判定
Path.Combine(themeRoot, "combo", "number", lookup),
Path.Combine(themeRoot, "judgement", lookup)
};
break;
}
@@ -121,6 +132,7 @@ namespace osu.Game.Skinning.Components
{
glyph = new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, texture.Height, null),
texture, 0.125f);
break;
}
}
}

View File

@@ -3,11 +3,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Framework.Text;
using osu.Game.Graphics.Sprites;
@@ -32,13 +36,18 @@ namespace osu.Game.Skinning.Components
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private void load(GameHost host, IRenderer renderer)
{
Storage gameStorage = host.Storage;
var userResourceStore = new StorageBackedResourceStore(gameStorage);
var textureLoader = new TextureLoaderStore(userResourceStore);
var localSkinStore = new TextureStore(renderer, textureLoader);
// Spacing = new Vector2(-2f, 0f);
FontName.BindValueChanged(e =>
{
Font = new FontUsage(FontName.Value.ToString(), 1);
glyphStore = new GlyphStore(textures, getLookup);
glyphStore = new GlyphStore(localSkinStore, getLookup);
foreach (char c in new[] { '.', '%' })
glyphStore.Get(FontName.Value.ToString(), c);
@@ -78,17 +87,23 @@ namespace osu.Game.Skinning.Components
string[] possiblePaths;
string themeRoot = Path.Combine("EzResources", "GameTheme", textureNameReplace);
switch (character)
{
case '.':
case '%':
default:
possiblePaths = new[]
{
$"EzResources/GameTheme/{textureNameReplace}/number/score/{lookup}",
$"EzResources/GameTheme/{textureNameReplace}/number/combo/{lookup}", //combo图
$"EzResources/GameTheme/{textureNameReplace}/number/{lookup}", //combo图
// 对应:.../number/score/{lookup}
Path.Combine(themeRoot, "number", "score", lookup),
// 对应:.../number/combo/{lookup}
Path.Combine(themeRoot, "number", "combo", lookup),
// 对应:.../number/{lookup}
Path.Combine(themeRoot, "number", lookup),
};
break;
}
@@ -101,6 +116,7 @@ namespace osu.Game.Skinning.Components
{
glyph = new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, texture.Height, null),
texture, 0.125f);
break;
}
}
}