Represents a sprite localized by language, either through direct assignment or via a global key. More...
Classes | |
class | LocalizedSpriteValue |
Structure representing a sprite for a specific language. More... | |
Public Member Functions | |
if (!string.IsNullOrEmpty(key)) | |
if (match !=null &&match.sprite !=null) return match.sprite | |
foreach (var s in sprites) | |
Static Public Member Functions | |
static implicit | operator Sprite (LocalizedSprite localizedSprite) |
Implicit conversion from LocalizedSprite to Sprite. Allows using LocalizedSprite where a Sprite is expected. | |
Public Attributes | |
string | key |
Key used to retrieve a localized sprite from the LocalizationManager. If empty or not found, the system falls back to local sprites list. | |
List< LocalizedSpriteValue > | sprites = new List<LocalizedSpriteValue>() |
List of localized sprite entries for each language. Used when no key is provided or key lookup fails. | |
class Backbone::LocalizedSprite::LocalizedSpriteValue | language = LocalizationManager.instance?.currentLanguage |
Returns the sprite corresponding to the current language. Priority: Lookup by key in manager -> fallback to local list -> fallback to first sprite or null. | |
var | match = sprites.Find(s => s.language == language) |
return | null |
Represents a sprite localized by language, either through direct assignment or via a global key.
This class allows for two localization strategies:
key
that maps to a centralized sprite in the LocalizationManager.sprites
list for each language.The system will first try to resolve the key through the LocalizationManager. If no match is found or the key is empty, it will fallback to the internal list of localized sprites.
Example usage:
Backbone::LocalizedSprite::foreach | ( | var s in | sprites | ) |
Backbone::LocalizedSprite::if | ( | !string. | IsNullOrEmptykey | ) |
|
static |
Implicit conversion from LocalizedSprite to Sprite. Allows using LocalizedSprite where a Sprite is expected.
string Backbone::LocalizedSprite::key |
Key used to retrieve a localized sprite from the LocalizationManager. If empty or not found, the system falls back to local sprites
list.
class Backbone::LocalizedSprite::LocalizedSpriteValue Backbone::LocalizedSprite::language = LocalizationManager.instance?.currentLanguage |
Returns the sprite corresponding to the current language. Priority: Lookup by key in manager -> fallback to local list -> fallback to first sprite or null.
var Backbone::LocalizedSprite::match = sprites.Find(s => s.language == language) |
return Backbone::LocalizedSprite::null |
List<LocalizedSpriteValue> Backbone::LocalizedSprite::sprites = new List<LocalizedSpriteValue>() |
List of localized sprite entries for each language. Used when no key is provided or key lookup fails.