LanguageSelection.cs 746 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using UnityEngine;
  3. [RequireComponent(typeof(UIPopupList))]
  4. [AddComponentMenu("NGUI/Interaction/Language Selection")]
  5. public class LanguageSelection : MonoBehaviour
  6. {
  7. private void Start()
  8. {
  9. this.mList = base.GetComponent<UIPopupList>();
  10. if (Localization.knownLanguages != null)
  11. {
  12. this.mList.items.Clear();
  13. int i = 0;
  14. int num = Localization.knownLanguages.Length;
  15. while (i < num)
  16. {
  17. this.mList.items.Add(Localization.knownLanguages[i]);
  18. i++;
  19. }
  20. this.mList.value = Localization.language;
  21. }
  22. EventDelegate.Add(this.mList.onChange, new EventDelegate.Callback(this.OnChange));
  23. }
  24. private void OnChange()
  25. {
  26. Localization.language = UIPopupList.current.value;
  27. }
  28. private UIPopupList mList;
  29. }