1234567891011121314151617181920212223242526272829303132 |
- using System;
- using UnityEngine;
- [RequireComponent(typeof(UIPopupList))]
- [AddComponentMenu("NGUI/Interaction/Language Selection")]
- public class LanguageSelection : MonoBehaviour
- {
- private void Start()
- {
- this.mList = base.GetComponent<UIPopupList>();
- if (Localization.knownLanguages != null)
- {
- this.mList.items.Clear();
- int i = 0;
- int num = Localization.knownLanguages.Length;
- while (i < num)
- {
- this.mList.items.Add(Localization.knownLanguages[i]);
- i++;
- }
- this.mList.value = Localization.language;
- }
- EventDelegate.Add(this.mList.onChange, new EventDelegate.Callback(this.OnChange));
- }
- private void OnChange()
- {
- Localization.language = UIPopupList.current.value;
- }
- private UIPopupList mList;
- }
|