Merge branch 'cassidy'

This commit is contained in:
SillyStar-Github 2025-10-04 02:55:18 -04:00
commit d11489f391
4 changed files with 61 additions and 7 deletions

View file

@ -81,11 +81,6 @@ namespace PvZ_Fusion_Translator
{ {
TowerManager_Patch.UpdateText(); TowerManager_Patch.UpdateText();
} }
if (Input.GetKeyDown(KeyCode.P))
{
Time.timeScale = 0;
}
} }
public override void OnGUI() 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="Log.cs" />
<Compile Include="ModFeatures.cs" /> <Compile Include="ModFeatures.cs" />
<Compile Include="AssetStore\AudioStore.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\Board_Patch.cs" />
<Compile Include="Patches\GameObjects\ButtonObjects\MainMenu_Btn_Patch.cs" /> <Compile Include="Patches\GameObjects\ButtonObjects\MainMenu_Btn_Patch.cs" />
<Compile Include="Patches\GameObjects\MinorObjects\TreasureMoney_Patch.cs" /> <Compile Include="Patches\GameObjects\MinorObjects\TreasureMoney_Patch.cs" />

View file

@ -28,7 +28,7 @@ namespace PvZ_Fusion_Translator
{ {
ImageConversion.LoadImage(ogTexture, File.ReadAllBytes(texturePath)); ImageConversion.LoadImage(ogTexture, File.ReadAllBytes(texturePath));
Log.LogDebug("OK! Replaced Texture " + ogTexture.name); Log.LogDebug("OK! Replaced Texture " + ogTexture.name);
ogTexture.name = "replaced_" + ogTexture.name; ogTexture.name = "replaced_" + ogTexture.name;
return true; return true;
@ -203,7 +203,39 @@ namespace PvZ_Fusion_Translator
return thePlantName; return thePlantName;
} }
public static Dictionary<int, KeyValuePair<int, string>> plantIndices = new Dictionary<int, KeyValuePair<int, string>>(); 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() public static void RegisterPlantIndices()
{ {