TopBarView.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. public void GoToSetup() {
  30. AudioMgr.ins.PlayBtn();
  31. GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView1"), Vector3.zero, new Quaternion());
  32. }
  33. }