少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-13 c7f64d977c4e2884d5411a5a2d0f37b6afa52963
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
105
106
107
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public class TreasureSoulPattern2 : TreasureSoulPattern
    {
        [SerializeField] RectTransform m_ContainerPresentNone;
        [SerializeField] RectTransform m_ContainerPresentHas;
        [SerializeField] RectTransform m_ContainerNextNone;
        [SerializeField] RectTransform m_ContainerNextHas;
        [SerializeField] List<PropertyBehaviour> m_PresentProperties;
        [SerializeField] List<PropertyBehaviour> m_NextProperties;
        [SerializeField] Button m_Goto;
        [SerializeField] Button m_Get;
        [SerializeField] Text m_Progress;
        [SerializeField] Image m_Complete;
 
        private void Awake()
        {
            m_Goto.onClick.AddListener(OnGoto);
            m_Get.onClick.AddListener(OnGet);
        }
 
        public override void Display(int _id)
        {
            base.Display(_id);
            Display();
        }
 
        protected override void TreasurePrivilegeUpdateEvent(int _id)
        {
            base.TreasurePrivilegeUpdateEvent(_id);
            if (_id == (int)TreasurePrivilege.StrengthenAdd)
            {
                Display();
            }
        }
 
        public override void Dispose()
        {
            base.Dispose();
        }
 
        private void Display()
        {
            var configs = Config.Instance.GetAllValues<ItemPlusSumAttrConfig>();
            var present = -1;
            var next = 0;
            for (int i = 0; i < configs.Count; i++)
            {
                if (special.presentFinishCount >= configs[i].countNeed)
                {
                    present = i;
                }
            }
            next = present + 1;
            m_ContainerPresentNone.gameObject.SetActive(present == -1);
            m_ContainerPresentHas.gameObject.SetActive(present >= 0);
            if (present >= 0)
            {
                var config = configs[present];
                for (int i = 0; i < m_PresentProperties.Count; i++)
                {
                    m_PresentProperties[i].gameObject.SetActive(i < config.attType.Length);
                    if (i < config.attType.Length)
                    {
                        m_PresentProperties[i].DisplayUpper(config.attType[i], config.attValue[i]);
                    }
                }
            }
            m_ContainerNextNone.gameObject.SetActive(next >= configs.Count);
            m_ContainerNextHas.gameObject.SetActive(next < configs.Count);
            if (next < configs.Count)
            {
                var config = configs[next];
                for (int i = 0; i < m_NextProperties.Count; i++)
                {
                    m_NextProperties[i].gameObject.SetActive(i < config.attType.Length);
                    if (i < config.attType.Length)
                    {
                        m_NextProperties[i].DisplayUpper(config.attType[i], config.attValue[i]);
                    }
                }
            }
            m_Complete.gameObject.SetActive(special.state == TreasurePrivilegeState.Complete);
            m_Goto.gameObject.SetActive(special.state == TreasurePrivilegeState.Doing);
            m_Get.gameObject.SetActive(special.state == TreasurePrivilegeState.Reward);
            m_Progress.text = special.ProgressDisplay();
            //m_Progress.color = specialData.state == TreasurePrivilegeState.Doing ? UIHelper.GetUIColor(TextColType.Red, true) : UIHelper.GetUIColor(TextColType.Green, true);
        }
 
        private void OnGoto()
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.RebornOpenStrength);
            model.gotoSoul = (int)special.type;
        }
 
        private void OnGet()
        {
            special.GetReward();
        }
    }
}