本文主要是介绍unity开发 --------- NGUI(Localization、UILocalize),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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脚本。
这篇关于unity开发 --------- NGUI(Localization、UILocalize)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!