bbepis / XUnity.AutoTranslator

MIT License
1.81k stars 277 forks source link

Help: Some Text Not Being Hooked #254

Open thos-grol opened 2 years ago

thos-grol commented 2 years ago

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.

ndrwln commented 2 years ago

Untitled

ndrwln commented 2 years ago

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

gravydevsupreme commented 2 years ago
  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
thos-grol commented 2 years ago

Thanks, am going to try soon.

ndrwln commented 2 years ago
  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 commented 2 years ago

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