| using System.Collections.Generic; | 
| using UnityEngine; | 
| using UnityEngine.UI; | 
|   | 
| //公会捐赠 | 
| public class GuildDonateCell : MonoBehaviour | 
| { | 
|     [SerializeField] int donateType; | 
|     [SerializeField] Text nameText; | 
|     [SerializeField] Image nameBg; | 
|     [SerializeField] ItemCell[] itemCells; | 
|     [SerializeField] Text countText; | 
|     [SerializeField] Text moneyText; | 
|     [SerializeField] Image moneyIcon; | 
|     [SerializeField] Button donateBtn; | 
|     [SerializeField] Text donateText; | 
|   | 
|     public void Display() | 
|     { | 
|         var config = FamilyDonateConfig.Get(donateType); | 
|         nameText.text = config.Name; | 
|         nameBg.SetSprite("DonateType" + donateType); | 
|         for (int i = 0; i < itemCells.Length; i++) | 
|         { | 
|             if (i < config.AwardItemList.Length) | 
|             { | 
|                 itemCells[i].SetActive(true); | 
|                 int itemID = config.AwardItemList[i][0]; | 
|                 itemCells[i].Init(new ItemCellModel(itemID, false, config.AwardItemList[i][1])); | 
|                 itemCells[i].button.AddListener(() => | 
|                 { | 
|                     ItemTipUtility.Show(itemID); | 
|                 }); | 
|             } | 
|             else | 
|             { | 
|                 itemCells[i].SetActive(false); | 
|             } | 
|         } | 
|   | 
|         int donateCnt = 0; | 
|         if (GuildManager.Instance.donateCntList != null && GuildManager.Instance.donateCntList.Length > 0) | 
|         { | 
|             donateCnt = GuildManager.Instance.donateCntList[donateType - 1]; | 
|         } | 
|         countText.text = Language.Get("Guild_65") + donateCnt + "/" + config.DailyCnt; | 
|   | 
|   | 
|         moneyText.text = config.MoneyValue.ToString(); | 
|         moneyIcon.SetIconWithMoneyType(config.MoneyType); | 
|   | 
|         if (donateCnt >= config.DailyCnt) | 
|         { | 
|             donateBtn.SetInteractable(false); | 
|             donateText.text = Language.Get("Guild_67"); | 
|         } | 
|         else | 
|         { | 
|             donateBtn.SetInteractable(true); | 
|             donateText.text = Language.Get("Guild_66"); | 
|             donateBtn.AddListener(Donate); | 
|         } | 
|   | 
|     } | 
|   | 
|     void Donate() | 
|     { | 
|         var config = FamilyDonateConfig.Get(donateType); | 
|         if (!UIHelper.CheckMoneyCount(config.MoneyType, config.MoneyValue, 2)) | 
|         { | 
|             return; | 
|         } | 
|         var pack = new CA612_tagCMFamilyMoneyDonate(); | 
|         pack.DonateType = (byte)donateType; | 
|         GameNetSystem.Instance.SendInfo(pack); | 
|     } | 
| } |