unity开发 --------- NGUI
NGUI支持动态加载资源功能。比如语言选择:假如当前语言为中文,当将语言更改为英文时,所有UI上的文字也立即变成了英文。此功能是用Localization和UILocalize两个脚本配合完成的。
Localization中记录多种配置方案,当更改配置方案时,由Localization发送通知,通知各UILocalize更新。
NGUI中自带的UILocalize目前只支持更新UILabel和UISprite,若想支持其他widget,可以重写Localize函数。
Localization用list存储多套配置方案,而每套方案都是一个文本文件。格式以key-value的形式,成对列出。
- Flag = Flag-US
- Language = English
- English = English
- French = Français
- Info = Localization example
- Sound = Sound
- Music = Music
- Desc = English localization
- Paragraph = This example shows how to implement localization using NGUI. In order to localize a widget, simply attach [000000]UILocalize[-] script to it. The script will localize the sprite if it's a [000000]UISprite[-], or the text if it's a [000000]UILabel[-]. If you want to localize something else, just implement the [000000]OnLocalize[-] function. Either way, the actual data is defined via text assets specified on the [000000]Localization[-] script which must be present in the scene.
配置文件中列出的key用于UILocalize脚本。