| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- /* 主界面右上方信息栏 */
- public class TopBarView : MonoBehaviour
- {
- [SerializeField] Text[] itemValueTexts;
- [SerializeField] Button[] itemPlusButtons;
- int[] itemValues = {-1, -1, -1};
- void Start()
- {
- if (CommonConfig.needToExamine) {
- Transform tf = transform.Find("TopBar");
- for (int i = 0; i < tf.childCount; i++) {
- if (tf.GetChild(i).name.StartsWith("Item")) {
- tf.GetChild(i).gameObject.SetActive(false);
- }
- }
- }
- }
- void Update()
- {
- if (itemValues[0] != LoginMgr.myUserInfo.diamond) {
- itemValues[0] = LoginMgr.myUserInfo.diamond;
- itemValueTexts[0].text = itemValues[0].ToString();
- }
- if (itemValues[1] != LoginMgr.myUserInfo.coin) {
- itemValues[1] = LoginMgr.myUserInfo.coin;
- itemValueTexts[1].text = itemValues[1].ToString();
- }
- if (itemValues[2] != LoginMgr.myUserInfo.integral) {
- itemValues[2] = LoginMgr.myUserInfo.integral;
- itemValueTexts[2].text = itemValues[2].ToString();
- }
- }
- public void GoToSetup() {
- AudioMgr.ins.PlayBtn();
- GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/SetUpView1"), Vector3.zero, new Quaternion());
- }
- }
|