少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
using vnxbqy.UI;
using System;
using System.Collections.Generic;
using UnityEngine.UI;
using System.Collections;
 
public class investCell : ILBehaviour
{
    Image Img_Got;
    Image Img_UnReach;
    Button Btn_Goto;
    Button Btn_Get;
    List<ItemCell> items = new List<ItemCell>();
    Text info;
 
    protected override void Awake() 
    {
        Img_Got = proxy.GetWidgtEx<Image>("Img_Got");
        Img_UnReach = proxy.GetWidgtEx<Image>("Img_UnReach");
        Btn_Goto = proxy.GetWidgtEx<Button>("Btn_Goto");
        Btn_Get = proxy.GetWidgtEx<Button>("Btn_Get");
        items.Clear();
        items.Add(proxy.GetWidgtEx<ItemCell>("itemcell0"));
        items.Add(proxy.GetWidgtEx<ItemCell>("itemcell1"));
        info = proxy.GetWidgtEx<Text>("Text_Amount");
 
    }
 
    public void Display(int index)
    {
        var result = InvestModel.Instance.GetSingleInvestState(InvestModel.Instance.selectType, index);
        Img_Got.SetActiveIL(false);
        Img_UnReach.SetActiveIL(false);
        Btn_Goto.SetActiveIL(false);
        Btn_Get.SetActiveIL(false);
 
        var config = InvestConfig.Get(index);
        info.text = config.info;
 
        if (result == 1)
        {
            if (InvestModel.Instance.selectType == InvestModel.InvestType_Boss)
            { 
                Btn_Goto.SetActiveIL(true);
                Btn_Goto.SetListener(()=> {
                    
                    BossModel.Instance.GotoKillBoss(config.needNPCID, ()=> {
                        WindowCenter.Instance.CloseEx<OpenServerActivityWin>();
                    });
                });
            }
            else
                Img_UnReach.SetActiveIL(true);
        }
        else if (result == 2)
        {
            Btn_Get.SetActiveIL(true);
            Btn_Get.SetListener(()=> {
                InvestModel.Instance.SendGetReward(InvestModel.Instance.selectType, index);
            });
        }
        else if (result == 3)
        {
            Img_Got.SetActiveIL(true);
        }
 
        for (int i = 0; i < items.Count; i++)
        {
            List<ItemEx> awards = new List<ItemEx>();
            InvestModel.Instance.TryGetItems(InvestModel.Instance.selectType, index, out awards);
            if (i < awards.Count)
            {
                items[i].SetActiveIL(true);
                var itemId = awards[i].id;
                var model = new ItemCellModel(itemId, false, (ulong)awards[i].count);
                items[i].Init(model);
                items[i].auctionIcon.SetActiveIL(awards[i].bind != 0);
                items[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemId);
                });
            }
            else
            {
                items[i].SetActiveIL(false);
            }
        }
    }
 
 
}