public static void DoSpriteSwapHook(ref Selectable __instance, ref Sprite newSprite) { if (newSprite == null) { newSprite = __instance.image.sprite; } var go = __instance.gameObject; var path = GameObjectUtils.AbsoluteTransform(go); var scene = go.scene.name; ImageTranslator.RegisterTexture(newSprite, path, scene); ImageTranslator.ReplaceTexture(ref newSprite, path, scene); }
public static void ActionChangeUISetHook(ref ActionChangeUI __instance) { var image = (UnityEngine.UI.Image)AccessTools.Field(typeof(ActionChangeUI), "target").GetValue(__instance); if (image == null) { return; } var go = __instance.gameObject; var path = GameObjectUtils.AbsoluteTransform(go); var scene = go.scene.name; ImageTranslator.RegisterTexture(image, path, scene); ImageTranslator.ReplaceTexture(image, path, scene); }