This commit is contained in:
TuanAnh2901 2025-10-05 00:59:53 +07:00
parent 8b1d045dab
commit 2ba78838f7
4 changed files with 59 additions and 5 deletions

View file

@ -94,10 +94,6 @@ public class Core : BasePlugin
Log.LogInfo("del del");
Utils.OpenTrello();
}
if (Input.GetKeyDown(KeyCode.P))
{
Time.timeScale = 0;
}
if (TowerManager.Instance != null)
{
TowerManager_Patch.UpdateText();

View file

@ -0,0 +1,25 @@
using HarmonyLib;
using TMPro;
using BepInEx.Unity.IL2CPP;
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
using UnityEngine;
namespace PvZ_Fusion_Translator__BepInEx_.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

@ -179,6 +179,7 @@
<Compile Include="Patches\GameObjects\RogueStartMenu_Patch.cs" />
<Compile Include="Patches\GameObjects\ShootingMenu_Patch.cs" />
<Compile Include="Patches\GameObjects\ShootingSelectWindow_Patch.cs" />
<Compile Include="Patches\GameObjects\SpriteRenderer_patch.cs" />
<Compile Include="Patches\GameObjects\SeedLibrary_Patch.cs" />
<Compile Include="Patches\GameObjects\TowerOption_Patch.cs" />
<Compile Include="Patches\GameObjects\TowerUpgradeMenu_Patch.cs" />

View file

@ -235,7 +235,39 @@ namespace PvZ_Fusion_Translator
return theZombieName;
}
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>>(); Dictionary<int, KeyValuePair<int, string>>();
public static void RegisterPlantIndices()
{