using System.Collections.Generic; 
 | 
using UnityEngine; 
 | 
using UnityEngine.UI; 
 | 
  
 | 
  
 | 
//淘金工人的列表显示 
 | 
public class GoldRushWorkerCell : CellView 
 | 
{ 
 | 
    [SerializeField] Text nameText; 
 | 
    [SerializeField] UIHeroController heroModel; 
 | 
    [SerializeField] Transform lockRect; 
 | 
    [SerializeField] Transform lockLVRect; 
 | 
    [SerializeField] Text lockLVText; 
 | 
    [SerializeField] Button unLockBtn; 
 | 
    [SerializeField] Button lockMoneyBtn; 
 | 
    [SerializeField] Text lockMoneyText; 
 | 
    [SerializeField] Image lockMoneyIcon; 
 | 
    [SerializeField] Image lockMoneyRedpoint; 
 | 
  
 | 
  
 | 
    public void Display(int workerID) 
 | 
    { 
 | 
        var config = GoldRushWorkerConfig.Get(workerID); 
 | 
        nameText.text = config.Name; 
 | 
        heroModel.Create(config.SkinID, 0.8f); 
 | 
        var lockState = GoldRushManager.Instance.GetWorkerLockState(workerID); 
 | 
        if (lockState == 0) 
 | 
        { 
 | 
            lockRect.SetActive(false); 
 | 
        } 
 | 
        else if (lockState == 1) 
 | 
        { 
 | 
            lockRect.SetActive(true); 
 | 
            int lockLV = config.PlayerLVUnlock; 
 | 
            if (PlayerDatas.Instance.baseData.LV < lockLV) 
 | 
            { 
 | 
                lockLVRect.SetActive(true); 
 | 
                unLockBtn.SetActive(false); 
 | 
                lockLVText.text = Language.Get("L1037", lockLV); 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                lockLVRect.SetActive(false); 
 | 
                unLockBtn.SetActive(true); 
 | 
                unLockBtn.AddListener(() => 
 | 
                { 
 | 
                    if (PlayerDatas.Instance.baseData.LV < lockLV) 
 | 
                        return; 
 | 
  
 | 
                    GoldRushManager.Instance.SendGoldRushUnlock(1, workerID); 
 | 
                    SysNotifyMgr.Instance.ShowTip("GoldRush7"); 
 | 
                }); 
 | 
            } 
 | 
            lockMoneyBtn.SetActive(false); 
 | 
        } 
 | 
        else if (lockState == 2) 
 | 
        { 
 | 
            lockRect.SetActive(true); 
 | 
            lockLVRect.SetActive(false); 
 | 
            unLockBtn.SetActive(false); 
 | 
            lockMoneyBtn.SetActive(true); 
 | 
            lockMoneyRedpoint.SetActive(UIHelper.CheckMoneyCount(config.MoneyUnlock[0], config.MoneyUnlock[1], 0)); 
 | 
            lockMoneyIcon.SetIconWithMoneyType(config.MoneyUnlock[0]); 
 | 
            lockMoneyText.text = config.MoneyUnlock[1].ToString(); 
 | 
            lockMoneyBtn.AddListener(() => 
 | 
            { 
 | 
  
 | 
                ConfirmCancel.MoneyIconToggleConfirmByType(ToggleCheckType.GoldRush, config.MoneyUnlock[1], config.MoneyUnlock[0], 
 | 
                    Language.Get("GoldRush36", UIHelper.GetIconNameWithMoneyType(config.MoneyUnlock[0]), config.MoneyUnlock[1]), () => 
 | 
                        { 
 | 
                            if (!UIHelper.CheckMoneyCount(config.MoneyUnlock[0], config.MoneyUnlock[1], 2)) 
 | 
                            { 
 | 
                                return; 
 | 
                            } 
 | 
                            GoldRushManager.Instance.SendGoldRushUnlock(1, workerID); 
 | 
                            SysNotifyMgr.Instance.ShowTip("GoldRush7"); 
 | 
                        }); 
 | 
  
 | 
            }); 
 | 
        } 
 | 
    } 
 | 
  
 | 
} 
 |