Bug in EditorTools - DrawEventCallBack()

More
9 years 9 months ago #127 by Jos
I'm trying to get the "On Localize Call" bits of the Localize component to work correctly. It seems that the event, when sent, does include a reference to the component itself, however, the DrawEventCallBack() method only lists methods with no arguments, thus you can never actually receive the Localize component via the callback, and programatically actually do something with that text. Also, since the callback is called before the TextMesh's (in my case) .text value is updated, so i can't get the translated text that way either.

Suggestions? Is this an error?

Thanks
Jos

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago - 9 years 9 months ago #128 by Frank
Hi,
Version (2.1.0 b3) fixes the bug regarding methods accepting 1 argument not been selectable in the EventCallBack.
That will allow you to get the Localize component passed as a parameter.

Nonetheless, the Localization Call Back should use temporal translations on the static variables:
Localize.MainTranslation and Localize.SecondaryTranslation;

In Assets\I2\Localization\Examples\Common\Scripts\CallbackNotification.cs you can find an example on how to modify those values:
	public void OnModifyLocalization()
	{
		if (string.IsNullOrEmpty(Localize.MainTranslation))
			return;
		
		string PlayerColor = LocalizationManager.GetTermTranslation( "Color/Red" );
		
		Localize.MainTranslation = Localize.MainTranslation.Replace("{PLAYER_COLOR}", PlayerColor);
	}

When the Localize component is translating a text, it stores the translations in the Localize.MainTranslation and Localize.SecondaryTranslation so that they can be modified by the callback.

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
Last edit: 9 years 9 months ago by Frank.

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #129 by Jos
Ah, ok, great - that will let me move forward!

Thanks
Jos

Please Log in or Create an account to join the conversation.

Time to create page: 0.253 seconds
Template by JoomlaShine