public static void CustomSelectListCtrlHook(ChaCustom.CustomSelectListCtrl __instance) { var objContent = (GameObject)AccessTools.Field(typeof(ChaCustom.CustomSelectListCtrl), "objContent").GetValue(__instance); foreach (Transform t in objContent.transform) { var go = t.gameObject; var csic = go.GetComponent <ChaCustom.CustomSelectInfoComponent>(); if (!csic) { continue; } var image = csic.img; if (image == null) { return; } var path = GameObjectUtils.AbsoluteTransform(go); var scene = go.scene.name; var mt = csic?.img?.mainTexture; if (mt) { if (mt.name.StartsWith("*")) { mt.name = mt.name.Substring(1); } } ImageTranslator.TranslateImage(csic.img, path, scene); } }
public static void LoadSpriteHook(ref UnityEngine.UI.Image image) { var go = image.gameObject; var path = GameObjectUtils.AbsoluteTransform(go); var scene = go.scene.name; ImageTranslator.TranslateImage(image, path, scene); }
public static bool SetCursorHook(ref Texture2D texture) { var scene = "Cursors"; ImageTranslator.RegisterTexture(texture, string.Empty, scene); ImageTranslator.ReplaceTexture(texture, string.Empty, scene); return(true); }
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 bool RegisterGraphicForCanvasHook(ref Canvas c, ref Graphic graphic) { if (graphic) { var go = graphic.gameObject; if (go == null) { return(true); } ImageTranslator.TranslateComponents(go); } return(true); }
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); }