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;
|
|
|
public void Display(int workerID)
|
{
|
var config = GoldRushWorkerConfig.Get(workerID);
|
nameText.text = config.Name;
|
heroModel.Create(config.SkinID, 0.7f);
|
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);
|
lockLVText.text = Language.Get("L1037", lockLV);
|
}
|
else
|
{
|
unLockBtn.SetActive(true);
|
unLockBtn.AddListener(() =>
|
{
|
if (PlayerDatas.Instance.baseData.LV < lockLV)
|
return;
|
|
GoldRushManager.Instance.SendGoldRushUnlock(1, workerID);
|
});
|
}
|
lockMoneyBtn.SetActive(false);
|
}
|
else if (lockState == 2)
|
{
|
lockRect.SetActive(true);
|
lockLVRect.SetActive(false);
|
unLockBtn.SetActive(false);
|
lockMoneyBtn.SetActive(true);
|
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);
|
});
|
|
});
|
}
|
}
|
|
}
|