TK2d Sprite Localization: Texture or Collection?

More
4 years 8 months ago #361 by grit
Dear I2 team,

I am using your Localize component with a TK2d sprite. It works, but I wonder what happens under the hood and if I use this as intended:
The sprite refers to a sprite collection and a texture inside of it. I put the localized versions of my single textures all inside this one TK2d sprite collection. In the localize component I chose "Texture" as the term type and dropped the sprites into it. Now I wonder if the localize component pulls the localized textures from this TK2d sprite collection (I wish it would do) or if it loads the several localized textures all separately into memory and does not use the collection referenced by the TK2d sprite at all?
I saw that there is the other term type "TK2D Collection". That's why I started wondering, if the localize component rather integrates TK2d sprites by localizing whole collections with equivalent sprites in it, than by localizing sprites inside one collection – which I am trying to do right now.

Best,
Grit.

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

More
4 years 8 months ago - 4 years 8 months ago #363 by Frank
Hi,
Under the hood, (file Scripts/Targets/Localize2DToolKit.cs)
it calls
			//--[ Localize Atlas ]----------
			tk2dSpriteCollection newCollection = GetSecondaryTranslatedObj<tk2dSpriteCollection>(ref MainTranslation, ref SecondaryTranslation);
			if (newCollection!=null) 
				mTarget_tk2dBaseSprite.SetSprite(newCollection.spriteCollection, MainTranslation);
			else
				mTarget_tk2dBaseSprite.SetSprite(MainTranslation);

So, that if you set a collection as a Secondary translation, it will set the collection and the sprite from that collection.

If you leave the Secondary translation empty it will just set the sprite, so that will internally set a single texture or a texture from the collection already set in the tk2dBaseSprite.


That will allow you to have one collection for each language and it will pick the sprite with the given name from the collection that correspond to the set language.

You could also add all the sprites for all the languages into the same collection and change the sprite name while leaving the collection untouched.

So, either way will work (a single collection with sprites for each language or a collection for each language)

Hope that helps,
Frank

EDIT: I just added a fix to (2.3.2) for a case where changing languages wasn't correctly updating the localization until restarting the game or loading a different level if the sprite had the same name on all languages and only the collection was changing.

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 8 months ago by Frank.
The following user(s) said Thank You: grit

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

More
4 years 8 months ago #364 by grit
Cool, thank you Frank,

in fact I did not notice the Secondary tab before! Wow, nice that both ways work.
So I left the Secondary translation empty and I also changed my term type from "Texture" to "Text", so now I am sure, that the sprite is beeing grabbed from my collection, the TK2d sprite is using already, with all the language sprites in it.

Thanks again.

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

Time to create page: 0.110 seconds
Template by JoomlaShine