sprite fix (?)

This commit is contained in:
SillyStar-Github 2025-07-27 15:51:00 -04:00
parent d49fae11bb
commit 1f6ef36728
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,28 @@
using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using UnityEngine;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(Board))]
public static class Board_Patch
{
[HarmonyPatch(nameof(Board.Update))]
[HarmonyPostfix]
private static void Update(Board __instance)
{
foreach (SpriteRenderer spriteRenderer in __instance.GetComponentsInChildren<SpriteRenderer>())
{
if (spriteRenderer.sprite != null)
{
if (TextureStore.spriteDict.ContainsKey(spriteRenderer.sprite.name) && spriteRenderer.drawMode != SpriteDrawMode.Sliced)
{
spriteRenderer.drawMode = SpriteDrawMode.Sliced;
}
}
}
}
}
}

View file

@ -400,6 +400,7 @@
<Compile Include="Log.cs" />
<Compile Include="ModFeatures.cs" />
<Compile Include="AssetStore\AudioStore.cs" />
<Compile Include="Patches\GameObjects\Board_Patch.cs" />
<Compile Include="Patches\GameObjects\MinorObjects\Jigsaw_Patch.cs" />
<Compile Include="Patches\GameObjects\ShootingSelectWindow_Patch.cs" />
<Compile Include="Patches\GameObjects\FruitNinjaSelectWindow_Patch.cs" />