XUnity.AutoTranslator icon indicating copy to clipboard operation
XUnity.AutoTranslator copied to clipboard

Help: Some Text Not Being Hooked

Open thos-grol opened this issue 3 years ago • 6 comments

This tool works great. Just some minor issues where the text is not being hooked. I'm interested in how I can modify some code so that the translator can hook these texts. A high level explanation would be enough.

thos-grol avatar Feb 03 '22 16:02 thos-grol

Untitled

ndrwln avatar Feb 03 '22 17:02 ndrwln

For example, the image above, how do I target this text. I tried the hook button, but nothing found.

ndrwln avatar Feb 03 '22 17:02 ndrwln

  1. Determine what component you need to hook.
  2. Hook the setter methods of the text (postfix) and methods that initializes the component such as Awake/OnEnable, etc. See https://github.com/bbepis/XUnity.AutoTranslator/tree/master/src/XUnity.AutoTranslator.Plugin.Core/Hooks
  3. Register the hooks. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Hooks/HooksSetup.cs
  4. If the text property of the component is not called exactly "text" and is a string, implement a custom ITextComponentManipulator and register it. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Extensions/ComponentExtensions.cs#L86
  5. Update IsKnownTextType to regcognize the component. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Extensions/ComponentExtensions.cs#L187
  6. If targetting IL2CPP as well, update CreateDerivedProxyIfRequiredAndPossible. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Extensions/ComponentExtensions.cs#L409

gravydevsupreme avatar Feb 07 '22 17:02 gravydevsupreme

Thanks, am going to try soon.

thos-grol avatar Feb 17 '22 22:02 thos-grol

  1. Determine what component you need to hook.
  2. Hook the setter methods of the text (postfix) and methods that initializes the component such as Awake/OnEnable, etc. See https://github.com/bbepis/XUnity.AutoTranslator/tree/master/src/XUnity.AutoTranslator.Plugin.Core/Hooks
  3. Register the hooks. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Hooks/HooksSetup.cs
  4. If the text property of the component is not called exactly "text" and is a string, implement a custom ITextComponentManipulator and register it. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Extensions/ComponentExtensions.cs#L86
  5. Update IsKnownTextType to regcognize the component. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Extensions/ComponentExtensions.cs#L187
  6. If targetting IL2CPP as well, update CreateDerivedProxyIfRequiredAndPossible. See https://github.com/bbepis/XUnity.AutoTranslator/blob/master/src/XUnity.AutoTranslator.Plugin.Core/Extensions/ComponentExtensions.cs#L409

Untitled

Ok so I found the component, but I dont know how to reference it. I looked at all the hooks and they seem general, but the type of component Im hooking seems specific?

The component in question is WXB.SymbolText.

ndrwln avatar Feb 19 '22 00:02 ndrwln

Untitled I assume you do this, but I dont know how to make a custom hook class :/.

ndrwln avatar Feb 19 '22 22:02 ndrwln