少年修仙传客户端代码仓库
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
namespace Snxxz.UI
{
    public class TreasureSoulPattern4 : TreasureSoulPattern
    {
        [SerializeField] RectTransform m_ContainerNone;
        [SerializeField] RectTransform m_ContainerHas;
        [SerializeField] List<PropertyBehaviour> properties;
 
        PlayerSuitModel suitModel { get { return ModelCenter.Instance.GetModel<PlayerSuitModel>(); } }
        PlayerPackModel pack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
        public PlayerStrengthengDatas strengthengmodel
        {
            get
            {
                return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>();
            }
        }
        public override void Display(int _id)
        {
            base.Display(_id);
            Display();
        }
 
        public override void Dispose()
        {
            base.Dispose();
        }
 
        protected override void TreasurePrivilegeUpdateEvent(int _id)
        {
            base.TreasurePrivilegeUpdateEvent(_id);
            if (_id == (int)special.type)
            {
                Display();
            }
        }
 
        private void Display()
        {
            for (int i = 0; i < properties.Count; i++)
            {
                properties[i].gameObject.SetActive(false);
            }
            switch (special.type)
            {
                case TreasurePrivilege.Property:
                    m_ContainerHas.gameObject.SetActive(true);
                    m_ContainerNone.gameObject.SetActive(false);
                    var _index = 0;
                    foreach (var _key in special.propertyDict.Keys)
                    {
                        var _value = special.propertyDict[_key];
                        properties[_index].gameObject.SetActive(true);
                        properties[_index].DisplayUpper(_key, _value);
                        _index++;
                    }
                    break;
                case TreasurePrivilege.Suit:
                    var percentSuit = (float)special.propertyDict[87] / 10000;
                    var dict = suitModel.GetActiveSuitAttr();
                    var _suitIndex = 0;
                    foreach (var _key in dict.Keys)
                    {
                        var propertyConfig = PlayerPropertyConfig.Get(_key);
                        if (propertyConfig == null || propertyConfig.type != 1)
                        {
                            continue;
                        }
                        properties[_suitIndex].gameObject.SetActive(true);
                        properties[_suitIndex].DisplayUpper(_key, (int)(percentSuit * dict[_key]));
                        _suitIndex++;
                    }
                    m_ContainerHas.gameObject.SetActive(_suitIndex > 0);
                    m_ContainerNone.gameObject.SetActive(_suitIndex == 0);
                    break;
                case TreasurePrivilege.Wing:
                    var percentWing = (float)special.propertyDict[86] / 10000;
                    var itemModel = pack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWing);
                    m_ContainerHas.gameObject.SetActive(itemModel != null);
                    m_ContainerNone.gameObject.SetActive(itemModel == null);
                    if (itemModel != null)
                    {
                        var itemConfig = ItemConfig.Get(itemModel.itemId);
                        float value = 0;
                        if (ContainsProperty(itemConfig, 6, out value))
                        {
                            if (itemModel.GetUseDataModel(42) != null)
                            {
                                value += strengthengmodel.BackpackWings(itemModel.itemId, itemModel.GetUseDataModel(42)[0])[1];
                            }
                        }
                        properties[0].gameObject.SetActive(true);
                        properties[0].DisplayUpper(6, (int)(value * percentWing));
                    }
                    break;
            }
        }
 
        public bool ContainsProperty(ItemConfig config, int _property,out float value)
        {
            value = 0;
            if (config.Effect1== _property&& config.EffectValueA1 > 0)
            {
                value = config.EffectValueA1;
                return true;
            }
            if (config.Effect2 == _property && config.EffectValueA2 > 0)
            {
                value = config.EffectValueA2;
                return true;
            }
            if (config.Effect3 == _property && config.EffectValueA3 > 0)
            {
                value = config.EffectValueA3;
                return true;
            }
            if (config.Effect4 == _property && config.EffectValueA4 > 0)
            {
                value = config.EffectValueA4;
                return true;
            }
            if (config.Effect5 == _property && config.EffectValueA5 > 0)
            {
                value = config.EffectValueA5;
                return true;
            }
            return false;
        }
    }
}