少年修仙传客户端代码仓库
hch
3 天以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using vnxbqy.UI;
using System.Collections.Generic;
using UnityEngine.UI;
 
public class GarbageCollectionCell : ILBehaviour
{
    Text btnText;
    Button colButton;
    Text taskName;
    Text taskPro;
    UIEffect uiEffect;
    Image overState;
 
    protected override void Awake() 
    {
        colButton = proxy.GetWidgtEx<Button>("colButton");
        btnText = proxy.GetWidgtEx<Text>("btnText");
        taskName = proxy.GetWidgtEx<Text>("taskName");
        taskPro = proxy.GetWidgtEx<Text>("taskPro");
        uiEffect = proxy.GetWidgtEx<UIEffect>("uieffect");
        overState = proxy.GetWidgtEx<Image>("overstate");
    }
 
 
    //index档位字典的数组索引
    public void Display(int id)
    {
        var config = ILActGarbageTaskConfig.Get(id);
        if (config == null) return;
 
        taskName.text = config.Title;
        var taskInfo = HolidayRefuseClassificationModel.Instance.TryGetTaskInfo(id);
 
        var isEnoughHandCol = false;  //是否足够手动收集
        var curProcess = taskInfo.x - taskInfo.y * config.FinishNeedValue;
        if (config.isShowProcess == 0)
        { 
            taskPro.text = string.Empty;
        }
        else
        {
            taskPro.text = UIHelper.AppendColor(curProcess >= config.FinishNeedValue ? TextColType.Green : TextColType.Red, curProcess.ToString(), true) + "/" + config.FinishNeedValue;
        }
 
        if (config.AutoProduce == 0 && curProcess >= config.FinishNeedValue)
        { 
            //手动领取,且未完成总次数
            isEnoughHandCol = true;
        }
 
        if (config.FinishTimeMax != 0 && taskInfo.y >= config.FinishTimeMax)
        {
            overState.SetActiveIL(true);
            colButton.SetActiveIL(false);
        }
        else
        {
            overState.SetActiveIL(false);
            colButton.SetActiveIL(true);
        }
 
        uiEffect.Stop();
        if (isEnoughHandCol)
        {
            uiEffect.Play();
            if (config.isShowMax == 0)
            {
                btnText.text = Language.Get("GarbageCollect2");
            }
            else
            {
                btnText.text = Language.Get("GarbageCollect2") + "(" + (config.FinishTimeMax - taskInfo.y) + ")";
            }
 
            colButton.SetListener(() => {
                HolidayRefuseClassificationModel.Instance.SendActGarbageGetTaskAward(id);
 
            });
        }
        else
        {
            btnText.text = Language.Get("GarbageCollect1");
            colButton.SetListener(()=> {
                if (!FuncOpen.Instance.IsFuncOpen(config.FuncID))
                {
                    FuncOpen.Instance.ProcessorFuncErrorTip(config.FuncID);
                    return;
                }
 
                WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)config.JumpID);
 
            });
        }
 
    }
 
}