Welcome, Guest
Username: Password: Remember me

TOPIC: Bug in EditorTools - DrawEventCallBack()

Bug in EditorTools - DrawEventCallBack() 4 years 10 months ago #127

  • Jos
  • Jos's Avatar
  • Offline
  • Junior Member
  • Posts: 32
  • Karma: 0
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
The administrator has disabled public write access.

Bug in EditorTools - DrawEventCallBack() 4 years 10 months ago #128

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1206
  • Thank you received: 256
  • Karma: 78
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: 4 years 10 months ago by Frank.
The administrator has disabled public write access.

Bug in EditorTools - DrawEventCallBack() 4 years 9 months ago #129

  • Jos
  • Jos's Avatar
  • Offline
  • Junior Member
  • Posts: 32
  • Karma: 0
Ah, ok, great - that will let me move forward!

Thanks
Jos
The administrator has disabled public write access.
Time to create page: 0.113 seconds
Template by JoomlaShine