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

Represents an audio clip localized by language, either through direct assignment or via a global key. More...

Classes

class  LocalizedClip
 Represents a localized audio clip for a specific language. More...
 

Public Member Functions

 if (!string.IsNullOrEmpty(key))
 
 if (match !=null &&match.clip !=null) return match.clip
 
 foreach (var c in clips)
 

Static Public Member Functions

static implicit operator AudioClip (LocalizedAudioClip localizedAudioClip)
 Implicitly converts the LocalizedAudioClip to an AudioClip for convenience.
 

Public Attributes

string key
 Optional key used to fetch the audio clip from the LocalizationManager.
 
List< LocalizedClipclips = new List<LocalizedClip>()
 List of audio clips associated with specific languages. Used as fallback if no key is provided or found.
 
class Backbone::LocalizedAudioClip::LocalizedClip language = LocalizationManager.instance?.currentLanguage
 Resolves and returns the localized AudioClip for the current language. First checks the key in the LocalizationManager. If not found, it looks in the local list.
 
var match = clips.Find(c => c.language == language)
 
return null
 

Detailed Description

Represents an audio clip localized by language, either through direct assignment or via a global key.

This class supports two localization strategies:

  1. Define a key that maps to a centralized audio clip in the LocalizationManager.
  2. Define localized audio clips directly in the clips 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 audio clips.

Example usage:

  1. LocalizedAudioClip with direct values: LocalizedAudioClip myClip = new LocalizedAudioClip(); myClip.clips.Add(new LocalizedAudioClip.LocalizedClip { language = "English", clip = myEnglishClip }); AudioClip c = myClip.Clip;
  2. LocalizedAudioClip using key: LocalizedAudioClip myClip = new LocalizedAudioClip(); myClip.key = "dialog.greeting"; AudioClip c = myClip.Clip;

Member Function Documentation

◆ foreach()

Backbone::LocalizedAudioClip::foreach ( var c in clips)

◆ if() [1/2]

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

◆ if() [2/2]

Backbone::LocalizedAudioClip::if ( match ! = null &&match.clip !=null)

◆ operator AudioClip()

static implicit Backbone::LocalizedAudioClip::operator AudioClip ( LocalizedAudioClip localizedAudioClip)
static

Implicitly converts the LocalizedAudioClip to an AudioClip for convenience.

Member Data Documentation

◆ clips

List<LocalizedClip> Backbone::LocalizedAudioClip::clips = new List<LocalizedClip>()

List of audio clips associated with specific languages. Used as fallback if no key is provided or found.

◆ key

string Backbone::LocalizedAudioClip::key

Optional key used to fetch the audio clip from the LocalizationManager.

◆ language

class Backbone::LocalizedAudioClip::LocalizedClip Backbone::LocalizedAudioClip::language = LocalizationManager.instance?.currentLanguage

Resolves and returns the localized AudioClip for the current language. First checks the key in the LocalizationManager. If not found, it looks in the local list.

◆ match

var Backbone::LocalizedAudioClip::match = clips.Find(c => c.language == language)

◆ null

return Backbone::LocalizedAudioClip::null

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