少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
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
98
99
100
101
102
103
104
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
 
namespace vnxbqy.UI
{
    public class WytjRulesWin : Window,SecondWindowInterface
    {
        [SerializeField]
        List<GameObject> rewardlist = new List<GameObject>();
 
        TaiChiModel _taiChiModel;
        TaiChiModel taiChiModel
        {
            get { return _taiChiModel ?? (_taiChiModel = ModelCenter.Instance.GetModel<TaiChiModel>()); }
        }
 
        public Button close { get; set; }
 
        protected override void BindController()
        {
            if (this is SecondWindowInterface)
            {
                var frame = this.GetComponentInChildren<SecondFrameLoader>();
                frame.Create();
                close = frame.GetComponentInChildren<Button>();
            }
        }
 
        protected override void AddListeners()
        {
            close.AddListener(CloseWin);
        }
 
        protected override void OnPreOpen()
        {
            InitUI();
        }
        protected override void OnAfterOpen()
        {
 
        }
        protected override void OnPreClose()
        {
 
        }
        protected override void OnAfterClose()
        {
 
        }
 
        private void InitUI()
        {
            int i = 0;
            for(i = 0; i < rewardlist.Count; i++)
            {
                DiceReward diceReward = taiChiModel.GetDiceReward(i);
                if (diceReward == null)
                    return;
 
                int j = 0;
                for(j = 0; j < rewardlist[i].transform.childCount; j++)
                {
                    Text numText = rewardlist[i].transform.GetChild(j).Find("num").GetComponent<Text>();
                    Button iconBtn = rewardlist[i].transform.GetChild(j).GetComponent<Button>();
                    Image itemIcon = rewardlist[i].transform.GetChild(j).GetComponent<Image>();
                    iconBtn.RemoveAllListeners();
                    ItemConfig itemConfig = null;
                    switch (j)
                    {
                        case 0:
                            itemConfig = ItemConfig.Get(diceReward.itemID);
                            numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.itemCount);
                            break;
                        case 1:
                            itemConfig = ItemConfig.Get(diceReward.goldId);
                            numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.gold);
                            break;
                        case 2:
                            itemConfig = ItemConfig.Get(diceReward.expId);
                            numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)taiChiModel.GetDiceRewardExp(diceReward.exp));
                            break;
                    }
 
                    if(itemConfig != null)
                    {
                        itemIcon.SetSprite(itemConfig.IconKey);
                        iconBtn.AddListener(() =>
                        {
                            ItemTipUtility.Show(itemConfig.ID);
                        });
                    }
                }
            }
        }
 
        private void CloseWin()
        {
            CloseImmediately();
        }
    }
}