public static void TranslateComponents(GameObject go) { var zettai = GameObjectUtils.AbsoluteTransform(go); var scene = go.scene.name; if (scene == "DontDestroyOnLoad") { scene = SceneManager.GetActiveScene().name; } foreach (var comp in go.GetComponents <Component>()) { switch (comp) { case Image i: TranslateImage(i, zettai, scene); break; case RawImage i: TranslateRawImage(i, zettai, scene); break; case Button b: TranslateButton(b, zettai, scene); break; case SpriteChangeCtrl s: TranslateHSpriteChangeCtrl(s, zettai, scene); break; } } }
public static void TranslateComponents(GameObject go) { var zettai = GameObjectUtils.AbsoluteTransform(go); var scene = go.scene.name; if (scene == "DontDestroyOnLoad") { scene = SceneManager.GetActiveScene().name; } foreach (var comp in go.GetComponents <Component>()) { if (comp is Image) { TranslateImage((Image)comp, zettai, scene); } else if (comp is RawImage) { TranslateRawImage((RawImage)comp, zettai, scene); } else if (comp is Button) { TranslateButton((Button)comp, zettai, scene); } else if (comp is H.SpriteChangeCtrl) { TranslateHSpriteChangeCtrl((H.SpriteChangeCtrl)comp, zettai, scene); } } }
public static void LoadSpriteHook(ref Image image) { var go = image.gameObject; var path = GameObjectUtils.AbsoluteTransform(go); var scene = go.scene.name; DynamicTranslator.TranslateImage(image, path, scene); }
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; DynamicTranslator.RegisterTexture(newSprite, path, scene); DynamicTranslator.ReplaceTexture(ref newSprite, path, scene); }