spriterenderer + remove dev thing
This commit is contained in:
parent
92de889fac
commit
9766957a86
4 changed files with 61 additions and 7 deletions
|
|
@ -81,11 +81,6 @@ namespace PvZ_Fusion_Translator
|
|||
{
|
||||
TowerManager_Patch.UpdateText();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.P))
|
||||
{
|
||||
Time.timeScale = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGUI()
|
||||
|
|
|
|||
25
MelonLoader/Patches/GameObjects/SpriteRenderer_Patch.cs
Normal file
25
MelonLoader/Patches/GameObjects/SpriteRenderer_Patch.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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" />
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace PvZ_Fusion_Translator
|
|||
{
|
||||
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;
|
||||
return true;
|
||||
|
|
@ -196,7 +196,39 @@ namespace PvZ_Fusion_Translator
|
|||
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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue