NGUI_LanguagePopup.cs 599 B

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