NGUI_LanguagePopup.cs 622 B

123456789101112131415161718192021222324
  1. using System;
  2. using UnityEngine;
  3. namespace I2.Loc
  4. {
  5. public class NGUI_LanguagePopup : MonoBehaviour
  6. {
  7. private void Start()
  8. {
  9. UIPopupList component = base.GetComponent<UIPopupList>();
  10. component.items = this.Source.GetLanguages(true);
  11. EventDelegate.Add(component.onChange, new EventDelegate.Callback(this.OnValueChange));
  12. int num = component.items.IndexOf(LocalizationManager.CurrentLanguage);
  13. component.value = component.items[(num < 0) ? 0 : num];
  14. }
  15. public void OnValueChange()
  16. {
  17. LocalizationManager.CurrentLanguage = UIPopupList.current.value;
  18. }
  19. public LanguageSource Source;
  20. }
  21. }