CustomLocalizeCallback.cs 565 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.Events;
  4. namespace I2.Loc
  5. {
  6. [AddComponentMenu("I2/Localization/I2 Localize Callback")]
  7. public class CustomLocalizeCallback : MonoBehaviour
  8. {
  9. public void Enable()
  10. {
  11. LocalizationManager.OnLocalizeEvent -= this.OnLocalize;
  12. LocalizationManager.OnLocalizeEvent += this.OnLocalize;
  13. }
  14. public void OnDisable()
  15. {
  16. LocalizationManager.OnLocalizeEvent -= this.OnLocalize;
  17. }
  18. public void OnLocalize()
  19. {
  20. this._OnLocalize.Invoke();
  21. }
  22. public UnityEvent _OnLocalize = new UnityEvent();
  23. }
  24. }