Skip to content

Commit 2be8642

Browse files
committed
Fix mod banner and icon not loading for unloaded mods.
1 parent 9961cf9 commit 2be8642

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Source/Mod/Mod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ private bool Initialize()
129129

130130
protected string GetModFolderPath(string subpath)
131131
{
132-
return $"@modfolder({this.Info.Name}):{subpath}";
132+
return $"{this.Info.Path}/{subpath}";
133133
}
134134

135135
protected bool TryGetModFolderPath(string subpath, out string path)
136136
{
137137
path = GetModFolderPath(subpath);
138-
return File.Exists(ModManager.PatchModPathString(path));
138+
return File.Exists(path);
139139
}
140140

141141
public virtual bool TryGetIconImage(out IXUiTexture texture)

Source/UI/Wrappers/XUiW_Texture.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,29 @@ public interface IXUiTexture
4747

4848
public sealed class XUiTexturePath : IXUiTexture
4949
{
50-
private readonly string modFolderRelativePath;
50+
private readonly string modFolderPath;
5151

52-
public XUiTexturePath(string modFolderRelativePath)
52+
public XUiTexturePath(string modFolderPath)
5353
{
54-
this.modFolderRelativePath = modFolderRelativePath;
54+
this.modFolderPath = modFolderPath;
55+
Debug.Log(this.modFolderPath);
5556
}
5657

5758
public void Load(XUiV_Texture texture)
5859
{
59-
texture.ParseAttribute("texture", this.modFolderRelativePath, null);
60+
byte[] data = File.ReadAllBytes(this.modFolderPath);
61+
62+
Texture2D texture2d = new Texture2D(0, 0);
63+
texture2d.LoadImage(data);
64+
65+
texture.Texture = texture2d;
66+
wwwAssignedField.SetValue(texture, true);
6067
}
6168

6269
public void Unload(XUiV_Texture texture)
6370
{
64-
texture.UnloadTexture();
71+
texture.Texture = null;
72+
texture.UITexture.mainTexture = null;
6573
}
6674
}
6775

0 commit comments

Comments
 (0)