123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using UnityEngine;
- public class UIEnhancementDescController : MonoBehaviour
- {
- private int Coin
- {
- get
- {
- return int.Parse(this._coin.text);
- }
- set
- {
- this._coin.text = value.ToString();
- }
- }
- private int TotalCoin
- {
- get
- {
- return this._totalCoinCache;
- }
- set
- {
- if (this._totalCoinCache != value)
- {
- this._totalCoinCache = value;
- this._totalCoin.text = value.ToString();
- }
- }
- }
- private string Desc
- {
- get
- {
- return this._desc.text;
- }
- set
- {
- this._desc.text = value;
- }
- }
- private string NextLevelDesc
- {
- get
- {
- return this._nextLevelDesc.text;
- }
- set
- {
- this._nextLevelDesc.text = value;
- }
- }
- private string Controlkeys
- {
- get
- {
- return this.control_keys.text;
- }
- set
- {
- this.control_keys.text = value;
- }
- }
- private void Awake()
- {
- this._deadlyDiscIcon = this.control_keys.transform.GetChild(0).gameObject;
- }
- private void OnEnable()
- {
- if(UIEnhancementItem.Current!=null)
- this._coin.color = ((!UIEnhancementItem.Current.CoinEnough) ? UIEnhancementDescController.ColorRed : Color.white);
- }
- private void Update()
- {
- this.TotalCoin = R.Equipment.CoinNum;
- EnhancementItem current = UIEnhancementItem.Current;
- if (current != null && !current.Equals(this._currentItem))
- {
- this._currentItem = current;
- this._level = this._currentItem.Level;
- if (this._level == 3)
- {
- this._coin.gameObject.SetActive(false);
- this._nextLevelDesc.gameObject.SetActive(false);
- this._upGradeGameObject.SetActive(false);
- }
- else
- {
- this._coin.gameObject.SetActive(true);
- this._nextLevelDesc.gameObject.SetActive(true);
- this._upGradeGameObject.SetActive(true);
- this.Coin = this._currentItem.Cost;
- this.NextLevelDesc = this._currentItem.NextLevelDesc;
- }
- this.Desc = this._currentItem.Desc;
- string controlkeys = this._currentItem.Controlkeys;
- if (controlkeys == "流")
- {
- this.Controlkeys = string.Empty;
- this._deadlyDiscIcon.SetActive(true);
- }
- else
- {
- if (this._deadlyDiscIcon.activeSelf)
- {
- this._deadlyDiscIcon.SetActive(false);
- }
- this.Controlkeys = controlkeys;
- }
- this._coin.color = ((!current.CoinEnough) ? UIEnhancementDescController.ColorRed : Color.white);
- }
- }
- private static readonly Color ColorRed = new Color(1f, 0.333333343f, 0.333333343f);
- private EnhancementItem _currentItem;
- [SerializeField]
- private UILabel _desc;
- [SerializeField]
- private UILabel _coin;
- [SerializeField]
- private UILabel _totalCoin;
- [SerializeField]
- private UILabel _nextLevelDesc;
- [SerializeField]
- private UILabel control_keys;
- private GameObject _deadlyDiscIcon;
- [SerializeField]
- private GameObject _upGradeGameObject;
- private int _level;
- private int _totalCoinCache;
- }
|