spriterenderer + remove dev thing

This commit is contained in:
SillyStar-Github 2025-10-04 02:54:41 -04:00
parent 92de889fac
commit 9766957a86
4 changed files with 61 additions and 7 deletions

View file

@ -81,11 +81,6 @@ namespace PvZ_Fusion_Translator
{
TowerManager_Patch.UpdateText();
}
if (Input.GetKeyDown(KeyCode.P))
{
Time.timeScale = 0;
}
}
public override void OnGUI()

View file

@ -0,0 +1,25 @@
using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using UnityEngine;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(SpriteRenderer))]
public static class SpriteRenderer_Patch
{
[HarmonyPatch(nameof(SpriteRenderer.InvokeSpriteChanged))]
[HarmonyPostfix]
private static void InvokeSpriteChanged(SpriteRenderer __instance)
{
if (__instance.sprite != null)
{
if (TextureStore.spriteDict.ContainsKey(__instance.sprite.name) && __instance.drawMode != SpriteDrawMode.Sliced)
{
__instance.drawMode = SpriteDrawMode.Sliced;
}
}
}
}
}

View file

@ -400,6 +400,8 @@
<Compile Include="Log.cs" />
<Compile Include="ModFeatures.cs" />
<Compile Include="AssetStore\AudioStore.cs" />
<Compile Include="Patches\GameObjects\AnimUIOver_Patch.cs" />
<Compile Include="Patches\GameObjects\SpriteRenderer_Patch.cs" />
<Compile Include="Patches\GameObjects\Board_Patch.cs" />
<Compile Include="Patches\GameObjects\ButtonObjects\MainMenu_Btn_Patch.cs" />
<Compile Include="Patches\GameObjects\MinorObjects\TreasureMoney_Patch.cs" />

View file

@ -196,6 +196,38 @@ namespace PvZ_Fusion_Translator
return thePlantName;
}
public static string GetZombieNameFromAlmanac(ZombieType theZombieType)
{
string json;
string theZombieName = "";
string currentLanguage = Utils.Language.ToString();
string almanacDir = GetAssetDir(AssetType.Almanac, Utils.Language);
string path = Path.Combine(almanacDir, "ZombieStringsTranslate.json");
if (!File.Exists(path))
{
Log.LogError($"ZombieStringsTranslate.json file not found at path: {path}");
Log.LogError("Zombie name could not be found!");
theZombieName = "";
}
else
{
json = File.ReadAllText(path);
AlmanacMgrZombie.ZombieAlmanacData zombieData = JsonUtility.FromJson<AlmanacMgrZombie.ZombieAlmanacData>(json);
foreach (AlmanacMgrZombie.ZombieInfo zombieInfo in zombieData.zombies)
{
if ((int)zombieInfo.theZombieType == (int)theZombieType)
{
theZombieName = zombieInfo.name;
}
}
}
return theZombieName;
}
public static Dictionary<int, KeyValuePair<int, string>> plantIndices = new Dictionary<int, KeyValuePair<int, string>>();
public static void RegisterPlantIndices()