PositionStoreForLocalize.cs 566 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using I2.Loc;
  3. using UnityEngine;
  4. public class PositionStoreForLocalize : UIWFPositionStore
  5. {
  6. public void Awake()
  7. {
  8. LocalizationManager.OnLocalizeEvent += this.OnLocalize;
  9. }
  10. public void OnEnable()
  11. {
  12. this.OnLocalize();
  13. }
  14. private void OnDestroy()
  15. {
  16. LocalizationManager.OnLocalizeEvent -= this.OnLocalize;
  17. }
  18. protected void OnLocalize()
  19. {
  20. if (!base.gameObject.activeInHierarchy || this.targetLanguage != Product.systemLanguage)
  21. {
  22. return;
  23. }
  24. base.Apply();
  25. }
  26. [SerializeField]
  27. protected Product.Language targetLanguage;
  28. }