TopBarView.cs 943 B

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