mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix entry image loading
This commit is contained in:
parent
ee37fe7164
commit
790303afde
@ -186,17 +186,17 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
|
|
||||||
private static Sprite GetEntrySprite(string entryId, NewHorizonsBody body)
|
private static Sprite GetEntrySprite(string entryId, NewHorizonsBody body)
|
||||||
{
|
{
|
||||||
IModAssets assets = body.Mod.Assets;
|
string relativePath = body.Config.ShipLog.spriteFolder + "/" + entryId + ".png";
|
||||||
string path = body.Config.ShipLog.spriteFolder + "/" + entryId + ".png";
|
try
|
||||||
if (File.Exists(Main.Instance.ModHelper.Manifest.ModFolderPath + path))
|
|
||||||
{
|
{
|
||||||
Texture2D newTexture = assets.GetTexture(path);
|
Texture2D newTexture = body.Mod.Assets.GetTexture(relativePath);
|
||||||
Rect rect = new Rect(0, 0, newTexture.width, newTexture.height);
|
Rect rect = new Rect(0, 0, newTexture.width, newTexture.height);
|
||||||
Vector2 pivot = new Vector2(newTexture.width / 2, newTexture.height / 2);
|
Vector2 pivot = new Vector2(newTexture.width / 2, newTexture.height / 2);
|
||||||
return Sprite.Create(newTexture, rect, pivot);
|
return Sprite.Create(newTexture, rect, pivot);
|
||||||
}
|
}
|
||||||
else
|
catch(Exception)
|
||||||
{
|
{
|
||||||
|
Logger.LogError($"Couldn't load image for {entryId} at {relativePath}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user