BuyLabel.cs 586 B

12345678910111213141516171819202122232425262728
  1. using UnityEngine;
  2. using System.Collections;
  3. using ICTS.Localization;
  4. using TMPro;
  5. public class BuyLabel : MonoBehaviour
  6. {
  7. public StoreProductId productId;
  8. TextMeshProUGUI label;
  9. void Awake()
  10. {
  11. label = GetComponent<TextMeshProUGUI>();
  12. }
  13. void OnEnable()
  14. {
  15. IAPProduct product = StoreManager.Instance.GetProduct(productId);
  16. if (product != null)
  17. {
  18. label.text = string.Format(Localization.instance.Get("button.label.buyProduct"), product.currencyCode+product.price);
  19. } else
  20. {
  21. label.text = Localization.instance.Get("button.label.buyProductNoPrice");
  22. }
  23. }
  24. }