少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-14 2a241254d505af92f4cde197b0283cd3da20d7c4
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
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;
 
        PackModel pack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        public StrengthenModel strengthengmodel
        {
            get
            {
                return ModelCenter.Instance.GetModel<StrengthenModel>();
            }
        }
        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.Wing:
                    var percentWing = (float)special.propertyDict[86] / 10000;
                    var itemModel = pack.GetItemByIndex(PackType.Equip, (int)RoleEquipType.Wing);
                    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.GetUseData(42) != null)
                            {
                                value += strengthengmodel.BackpackWings(itemModel.itemId, itemModel.GetUseData(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;
        }
    }
}