hch
3 天以前 18fe79ffe26f3591c322701001a73d4270e9d931
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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);
                        });
 
            });
        }
    }
 
}