少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
提交 | 用户 | age
d56e0c 1 //--------------------------------------------------------
H 2 //    [Author]:           第二世界
3 //    [  Date ]:           Tuesday, March 26, 2019
4 //--------------------------------------------------------
5 using UnityEngine;
6 using System.Collections;
7 using UnityEngine.UI;
8
4465b6 9 namespace vnxbqy.UI
d56e0c 10 {
H 11
12     public class EquipStarUpgradeSpecialMaterialBehaviour : MonoBehaviour
13     {
14         [SerializeField] RectTransform m_Empty;
15         [SerializeField] ItemCell m_Item;
16         [SerializeField] RectTransform m_Locked;
17
18         PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
19
20         bool isUnLocked = false;
21         int itemId = 0;
22         int itemNeed = 0;
23
24         public void Display(bool isUnLocked, int itemId, int itemNeed)
25         {
26             this.isUnLocked = isUnLocked;
27             this.itemId = itemId;
28             this.itemNeed = itemNeed;
29
30             DisplayBaseInfo();
31         }
32
33         private void DisplayBaseInfo()
34         {
35             m_Locked.SetActive(!isUnLocked);
36             m_Empty.SetActive(!isUnLocked);
37             m_Item.SetActive(isUnLocked);
38
39             if (isUnLocked)
40             {
41                 var own = packModel.GetItemCountByID(PackType.Item, itemId);
42                 m_Item.Init(new ItemCellModel(itemId, false, 1));
43                 m_Item.button.AddListener(() => {
44                     ItemTipUtility.Show(itemId);
45                 });
46                 m_Item.countText.SetActive(true);
47                 m_Item.countText.text = StringUtility.Contact(own, "/", itemNeed);
48                 m_Item.countText.color = UIHelper.GetUIColor(own >= itemNeed ? TextColType.Green : TextColType.Red);
49             }
50         }
51     }
52
53 }
54
55
56