TopBarView.cs 910 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class TopBarView : MonoBehaviour
  6. {
  7. [SerializeField] Text[] itemValueTexts;
  8. [SerializeField] Button[] itemPlusButtons;
  9. int[] itemValues = {-1, -1, -1};
  10. void Start()
  11. {
  12. }
  13. void Update()
  14. {
  15. if (itemValues[0] != LoginMgr.myUserInfo.diamond) {
  16. itemValues[0] = LoginMgr.myUserInfo.diamond;
  17. itemValueTexts[0].text = itemValues[0].ToString();
  18. }
  19. if (itemValues[1] != LoginMgr.myUserInfo.coin) {
  20. itemValues[1] = LoginMgr.myUserInfo.coin;
  21. itemValueTexts[1].text = itemValues[1].ToString();
  22. }
  23. if (itemValues[2] != LoginMgr.myUserInfo.integral) {
  24. itemValues[2] = LoginMgr.myUserInfo.integral;
  25. itemValueTexts[2].text = itemValues[2].ToString();
  26. }
  27. }
  28. }