Backbone - Localization
 
Loading...
Searching...
No Matches
Backbone::LocalizedTexture Class Reference

Represents a texture localized by language, either through a global key or direct per-language assignment. More...

Classes

class  LocalizedTextureValue
 Structure representing a texture for a specific language. More...
 

Public Member Functions

 if (!string.IsNullOrEmpty(key))
 
 if (match !=null &&match.texture !=null) return match.texture
 
 foreach (var t in textures)
 

Static Public Member Functions

static implicit operator Texture (LocalizedTexture localizedTexture)
 Implicit conversion from LocalizedTexture to Texture. Allows using LocalizedTexture where a Texture is expected.
 

Public Attributes

string key
 Key used to retrieve a localized texture from the LocalizationManager. If empty or not found, the system falls back to local textures list.
 
List< LocalizedTextureValuetextures = new List<LocalizedTextureValue>()
 List of localized texture entries for each language. Used when no key is provided or key lookup fails.
 
class Backbone::LocalizedTexture::LocalizedTextureValue language = LocalizationManager.instance?.currentLanguage
 Returns the texture corresponding to the current language. Priority: Lookup by key in manager -> fallback to local list -> fallback to first texture or null.
 
var match = textures.Find(t => t.language == language)
 
return null
 

Detailed Description

Represents a texture localized by language, either through a global key or direct per-language assignment.

This class supports two localization strategies:

  1. Using a key that maps to a centralized texture in the LocalizationManager.
  2. Using a list of localized textures assigned directly in the inspector.

The system prioritizes the key lookup. If no match is found or key is empty, it falls back to the local list.

Example usage:

  1. LocalizedTexture with direct values: LocalizedTexture myTex = new LocalizedTexture(); myTex.textures.Add(new LocalizedTexture.LocalizedTextureValue { language = "English", texture = texEN }); Texture t = myTex.Texture;
  2. LocalizedTexture using key: LocalizedTexture myTex = new LocalizedTexture(); myTex.key = "ui.panel.background"; Texture t = myTex.Texture;

Member Function Documentation

◆ foreach()

Backbone::LocalizedTexture::foreach ( var t in textures)

◆ if() [1/2]

Backbone::LocalizedTexture::if ( !string. IsNullOrEmptykey)

◆ if() [2/2]

Backbone::LocalizedTexture::if ( match ! = null &&match.texture !=null)

◆ operator Texture()

static implicit Backbone::LocalizedTexture::operator Texture ( LocalizedTexture localizedTexture)
static

Implicit conversion from LocalizedTexture to Texture. Allows using LocalizedTexture where a Texture is expected.

Member Data Documentation

◆ key

string Backbone::LocalizedTexture::key

Key used to retrieve a localized texture from the LocalizationManager. If empty or not found, the system falls back to local textures list.

◆ language

class Backbone::LocalizedTexture::LocalizedTextureValue Backbone::LocalizedTexture::language = LocalizationManager.instance?.currentLanguage

Returns the texture corresponding to the current language. Priority: Lookup by key in manager -> fallback to local list -> fallback to first texture or null.

◆ match

var Backbone::LocalizedTexture::match = textures.Find(t => t.language == language)

◆ null

return Backbone::LocalizedTexture::null

◆ textures

List<LocalizedTextureValue> Backbone::LocalizedTexture::textures = new List<LocalizedTextureValue>()

List of localized texture entries for each language. Used when no key is provided or key lookup fails.


The documentation for this class was generated from the following file: