| using UnityEngine;  | 
| using UnityEngine.UI;  | 
|   | 
| /// <summary>  | 
| /// 合成格子  | 
| /// </summary>  | 
| public class ComposeGirdCell : MonoBehaviour  | 
| {  | 
|     [SerializeField] ItemCell itemCell;  | 
|     [SerializeField] Image fillImage;  | 
|     [SerializeField] Image fullImage;  | 
|     [SerializeField] Text processText;  | 
|     [SerializeField] Image redImg;  | 
|     public void Display(int index)  | 
|     {  | 
|         if (index >= PackManager.Instance.composeItemGuidList.Count)  | 
|         {  | 
|             return;  | 
|         }  | 
|         var guid = PackManager.Instance.composeItemGuidList[index];  | 
|         var item = PackManager.Instance.GetItemByGuid(guid);  | 
|         if (item == null)  | 
|             return;  | 
|         itemCell.Init(item);  | 
|         itemCell.button.AddListener(() =>  | 
|         {  | 
|             //合成界面  | 
|             ComposeWin.guid = guid;  | 
|             UIManager.Instance.OpenWindow<ComposeWin>();  | 
|         });  | 
|           | 
|         var config = ItemCompoundConfig.GetItemCompoundConfig(item.itemId);  | 
|         var targetID = config.itemID;  | 
|         var targetCnt = config.itemCount;  | 
|         var haveCnt = PackManager.Instance.GetItemCountByID(PackType.Item, targetID);  | 
|         if (haveCnt >= targetCnt)  | 
|         {  | 
|             fullImage.SetActive(true);  | 
|             fillImage.SetActive(false);  | 
|             redImg.SetActive(true);  | 
|         }  | 
|         else  | 
|         {  | 
|             fullImage.SetActive(false);  | 
|             fillImage.SetActive(true);  | 
|             redImg.SetActive(false);  | 
|             fillImage.fillAmount = haveCnt / (float)targetCnt;  | 
|         }  | 
|         processText.text = haveCnt+ "/" + targetCnt;  | 
|   | 
|     }  | 
| }  |