少年修仙传客户端代码仓库
client_Zxw
2018-08-21 15d189aa46ddf7a3b2c8efc52d18002c8e830daa
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, August 21, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using System;
using TableConfig;
//神兽强化(神兽属性展示)
namespace Snxxz.UI {
 
    public class GodBeastAttributes:MonoBehaviour {
        [SerializeField] ItemCell m_ItemCell;
        [SerializeField] GameObject m_FrameNull;
        [SerializeField] GameObject m_FullLevel;
        [SerializeField] GameObject m_BottomDisplay;
        [SerializeField] IntensifySmoothSlider m_ExpSlider;
        [SerializeField] Text m_ExpNum;
        [SerializeField] Text m_TextAttributes;
        [SerializeField] Text m_TextAttributesAdd;
        [SerializeField] GodBeastSlidingList m_GodBeastSlidingList;
        DogzModel Dogz_model;
        DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
        private Dictionary<int, int> QualityLimit = new Dictionary<int, int>();
        PlayerPackModel _playerPack;
        PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } }
        private int GodBeastNumber=0;//神兽编号
        private int GodBeastPart = 0;//神兽装备ID
 
        private int SingleProficiency = 0;//单倍熟练度
        private int DoubleProficiency = 0;//双倍熟练度
        private int NeedFairyJade = 0;//所需仙玉
        private  void Start()
        {
            
        }
        private void OnEnable()
        {
            GodBeastReinforcementWin.ChooseToModify += ChooseToModify;
            GodBeastSlidingList.AbsorbEvent += AbsorbEvent;
        }     
        private void OnDisable()
        {
            GodBeastReinforcementWin.ChooseToModify -= ChooseToModify;
            GodBeastSlidingList.AbsorbEvent -= AbsorbEvent;
        }
 
        public void Init()
        {
            if (QualityLimit.Count <= 0)
            {
                string DogzAssist = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("DogzAssist").Numerical4;//获取不同品质的神兽强化上限
                QualityLimit = ConfigParse.GetDic<int, int>(DogzAssist);
            }
        }
 
        public void Unit()
        {
 
        }
 
        private void ChooseToModify(int locationMarker)
        {
            GetGodBeastLocationMarker(locationMarker);
        }
        private void AbsorbEvent(Dictionary<int, int> absorb)
        {
            AttributeAssignment();
        }
        public void GetGodBeastLocationMarker(int LocationMarker)//获取神兽装备的标记信息
        {
            if (LocationMarker != 0)
            {
                m_ItemCell.gameObject.SetActive(true);
                GodBeastNumber = LocationMarker % 100;//神兽编号
                GodBeastPart = LocationMarker / 100;//神兽装备位ID
                List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber);
                if (itemModel != null)
                {
                    for (int i = 0; i < itemModel.Count; i++)
                    {
                        if (itemModel[i].EquipPlace == GodBeastPart)
                        {
                            ItemCellModel ItemModel = new ItemCellModel(itemModel[i].itemId, true, 0, 1);
                            m_ItemCell.Init(ItemModel);
                        }
                    }
                }
                m_FrameNull.SetActive(true);
                m_FullLevel.SetActive(false);
                AttributeAssignment();
            }
            else
            {
                m_ItemCell.gameObject.SetActive(false);
                m_ExpSlider.stage = 0;
                m_ExpSlider.delay = 0f;
                m_ExpSlider.ResetStage();
                m_ExpSlider.value = 0;
                m_ExpNum.text = "0/0";
                m_FrameNull.SetActive(false);
                m_FullLevel.SetActive(false);
            }
        }
 
        public void AttributeAssignment()
        {
            List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber);
            ItemModel ItemModel=null;
            if (itemModel != null)
            {
                for (int i = 0; i < itemModel.Count; i++)
                {
                    if (itemModel[i].EquipPlace == GodBeastPart)
                    {
                        ItemModel = itemModel[i];
                    }
                }
            }
            if (ItemModel == null)
            {
                return;
            }
 
            GainProficiency();//获取熟练度
            var IudetDogzEquipPlus = ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
            if (IudetDogzEquipPlus != null)
            {
                int lv = QualityLimit[ItemModel.chinItemModel.ItemColor];
                var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
                if (IudetDogzEquipPlus[0] >= lv)
                {
                    m_FrameNull.SetActive(false);
                    m_FullLevel.SetActive(true);
                    m_ExpSlider.stage = lv;
                    m_ExpSlider.delay = 0f;
                    m_ExpSlider.ResetStage();
                    m_ExpSlider.value = 1;
                    m_ExpNum.text = DogzEquipConfig.upExpTotal + "/" + DogzEquipConfig.upExpTotal;
                }
                else
                {
 
 
                }
            }
            else
            {
                var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart,0);
                m_ExpNum.text =  "0/" + DogzEquipConfig.upExpTotal;
            }
        }
        private void  GainProficiency()//获取熟练度
        {
            SingleProficiency = 0;
            DoubleProficiency = 0;
            NeedFairyJade = 0;
            Dictionary<int,int> DicAb=m_GodBeastSlidingList.Absorption_Dic;
            foreach (var key in DicAb.Keys)
            {
                ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzItem, key);
                if (itemModel != null)
                {
                    if (itemModel.chinItemModel.Effect1 == 235)
                    {
                        var IudetDogzEquipPlus = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
                        SingleProficiency += itemModel.chinItemModel.EffectValueA1* DicAb[key];
                        if (IudetDogzEquipPlus != null)
                        {
                            SingleProficiency += IudetDogzEquipPlus[1];
                            DoubleProficiency += itemModel.chinItemModel.EffectValueA1;
                        }
                        else
                        {
                            DoubleProficiency += itemModel.chinItemModel.EffectValueA1 * 2* DicAb[key];
                            NeedFairyJade += itemModel.chinItemModel.Effect2* DicAb[key];
                        }
                    }
                }
            }
 
        }
 
 
    }
 
}