少年修仙传客户端代码仓库
client_linchunjie
2019-04-17 f1f2599ba0e6b64358ffef7ae5c9f9af3ed8b8b4
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
using System;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public enum PropertyTip
    {
        Mount = 0,
        Pet = 1,
    }
    public class TargetPetAttrWin : Window
    {
        [Header("当前属性名称")]
        [SerializeField]
        Text m_Property_Text;//属性名称
        [Header("当前宠物属性弹框")]
        [SerializeField]
        GameObject NowAttTipPet;//当前属性列表
        [SerializeField] Text m_LVtext;//等级
        [SerializeField] Text curPetAttackText;//战斗力
        [SerializeField] Text curPetHitText;//攻击力
        [SerializeField] Text curPetAttackSpeedText;//攻击速度
 
        [SerializeField]
        GameObject NowAttTipPet1;//下级属性列表
        [SerializeField] Text m_LVtext1;//等级
        [SerializeField] Text curPetAttackText1;//战斗力
        [SerializeField] Text curPetHitText1;//攻击力
        [SerializeField] Text curPetAttackSpeedText1;//攻击速度
        [SerializeField] GameObject m_ManJiImageP;//满级
 
        [Header("当前坐骑属性弹框")]
        [SerializeField]
        GameObject NowAttTipMount;//当前属性面板
        [SerializeField] Text m_LVtextP;//等级
        [SerializeField] Text curMountFightingText;//战斗力
        [SerializeField] Text curMountAttackText;//攻击
        [SerializeField] Text curMountLifeText;//生命
        [SerializeField] Text curMountSpeedText;//速度
 
        [SerializeField]
        GameObject NowAttTipMount1;//下级属性面板
        [SerializeField] Text m_LVtextP1;//等级
        [SerializeField] Text curMountFightingText1;//战斗力1
        [SerializeField] Text curMountAttackText1;//攻击1
        [SerializeField] Text curMountLifeText1;//生命1
        [SerializeField] Text curMountSpeedText1;//速度1
        [SerializeField] GameObject m_ManJiImage;//满级
 
        [Header("关闭按钮")]
        [SerializeField]
        Button m_CloseButton;//满级
        PetModel petmodel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
        MountModel m_MountModel;
        MountModel mountModel { get { return m_MountModel ?? (m_MountModel = ModelCenter.Instance.GetModel<MountModel>()); } }
        RidingAndPetActivationModel ridingModel { get { return ModelCenter.Instance.GetModel<RidingAndPetActivationModel>(); } }
 
        protected override void BindController()
        {
 
        }
        protected override void AddListeners()
        {
            m_CloseButton.AddListener(()=> { Close(); });
        }
       
        protected override void OnPreOpen()
        {
            PropertyMountAndPet(ridingModel.property, ridingModel.RidingId);
        }
        protected override void OnAfterOpen()
        {
 
        }
        protected override void OnPreClose()
        {
 
        }
        protected override void OnAfterClose()
        {
 
        }
        public void PropertyMountAndPet(PropertyTip propertyTip, int Id)
        {
            switch (propertyTip)
            {
                case PropertyTip.Mount:
                    CurMountAttrCtrl(Id);
                    break;
                case PropertyTip.Pet:
                    CurPetAttrCtrl();
                    break;
            }
 
        }
 
        private void CurPetAttrCtrl()
        {
            NowAttTipMount.SetActive(false);
            NowAttTipMount1.SetActive(false);
            NowAttTipPet.SetActive(true);
            NowAttTipPet1.SetActive(true);
            var petInfoConfig = PetInfoConfig.Get(petmodel.curPetId);
            if (petInfoConfig == null) return;
 
            PetBackpack _PetBackpack = petmodel._DicPetBack[petInfoConfig.ID];
            PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(petInfoConfig.ID, _PetBackpack.PetClass);
            PetInfoConfig petinfo = PetInfoConfig.Get(petmodel.curPetId);
            m_Property_Text.text = Language.Get("SpiritPetAttribute_Z");
            curPetHitText.text = _tagPetClass.AtkAdd.ToString();//攻击力
            m_LVtext.text = _PetBackpack.PetClass + Language.Get("Z1041");
            float AtkNum = (float)UIHelper.GetPropertyValue(PropertyType.ATKSPEED) / 100;
            curPetAttackSpeedText.text = ((float)Math.Round(AtkNum, 1)).ToString();
 
            PetInfoConfig config = PetInfoConfig.Get(petmodel.curPetId);
            
            int[] strNumberSkill = config.SkillID;    
            int[] strSkillUnLock = config.SkillUnLock;
            int _scoreNum = 0;
            int _scoreNumAll = 0;
            for (int i = 0; i < strSkillUnLock.Length; i++)
            {
                if (_PetBackpack.PetClass >= strSkillUnLock[i])
                {
                    SkillConfig skillconfig = SkillConfig.Get(strNumberSkill[i]);
                    if (skillconfig != null)
                    {
                        _scoreNum += skillconfig.FightPower;
                    }
                }
            }
            _scoreNumAll = Mathf.FloorToInt(_tagPetClass.AtkAdd * 2.5f) + _scoreNum;
            curPetAttackText.text = _scoreNumAll.ToString();
            if (_PetBackpack.PetClass >= petinfo.MaxRank)
            {
                curPetAttackText1.transform.parent.gameObject.SetActive(false);
                curPetHitText1.transform.parent.gameObject.SetActive(false);
                curPetAttackSpeedText1.transform.parent.gameObject.SetActive(false);
                m_LVtext1.transform.parent.gameObject.SetActive(false);
                m_ManJiImageP.SetActive(true);
            }
            else
            {
                curPetAttackText1.transform.parent.gameObject.SetActive(true);
                curPetHitText1.transform.parent.gameObject.SetActive(true);
                curPetAttackSpeedText1.transform.parent.gameObject.SetActive(true);
                m_LVtext1.transform.parent.gameObject.SetActive(true);
                m_ManJiImageP.SetActive(false);
                m_LVtext1.text= (_PetBackpack.PetClass+1) + Language.Get("Z1041");
                PetClassCostConfig _tagPetClassNext = PetClassCostConfig.GetPetIdAndRank(petInfoConfig.ID, _PetBackpack.PetClass+1);
                curPetHitText1.text = _tagPetClassNext.AtkAdd.ToString();//攻击力
                curPetAttackSpeedText1.text= ((float)Math.Round(AtkNum, 1)).ToString();
                int _scoreNum1 = 0;
                int _scoreNumAll1 = 0;
                for (int i = 0; i < strSkillUnLock.Length; i++)
                {
                    if ((_PetBackpack.PetClass+1) >= strSkillUnLock[i])
                    {
                        SkillConfig skillconfig = SkillConfig.Get(strNumberSkill[i]);
                        if (skillconfig != null)
                        {
                            _scoreNum1 += skillconfig.FightPower;
                        }
                    }
                }
                _scoreNumAll1 = Mathf.FloorToInt(_tagPetClassNext.AtkAdd * 2.5f) + _scoreNum1;
                curPetAttackText1.text = _scoreNumAll1.ToString();
            }
        }
        List<HorseSkillClass> MountSkills = new List<HorseSkillClass>();
        private void CurMountAttrCtrl(int ID)
        {
            MountSkills.Clear();
            foreach (var key in mountModel.GetMountSkillAndItem.Keys)
            {
                if (mountModel.GetMountSkillAndItem[key].HorseID == ID)
                {
                    MountSkills.Add(mountModel.GetMountSkillAndItem[key]);
                }
            }
            NowAttTipPet1.SetActive(false);
            NowAttTipPet.SetActive(false);
            NowAttTipMount.SetActive(true);
            NowAttTipMount1.SetActive(true);
            HorseConfig horseconfig = HorseConfig.Get(ID);
            HorseUpConfig horseUpconfig = HorseUpConfig.GetHorseIDAndLV(ID, mountModel._DicHorse[ID].Lv);
            m_Property_Text.text = Language.Get("MountAttributes_Z");
            m_LVtextP.text = mountModel._DicHorse[ID].Lv + Language.Get("Z1041");
            int[] strAttrValue = horseUpconfig.AttrValue;
            Dictionary<int, int> AddPowerDic = new Dictionary<int, int>();
            AddPowerDic.Clear();
            if (strAttrValue.Length != 0)
            {
                curMountLifeText.text = strAttrValue[0].ToString();//生命
                curMountAttackText.text = strAttrValue[1].ToString();//攻击
                curMountSpeedText.text = strAttrValue[2].ToString();//速度
                AddPowerDic.Add(6, strAttrValue[0]);
                AddPowerDic.Add(7, strAttrValue[1]);
            }
            int _scoreNum = 0;
            int _scoreNumAll = 0;
            for (int i = 0; i < MountSkills.Count; i++)
            {
                if (mountModel._DicHorse[ID].Lv >= MountSkills[i].HorseLV)
                {
                    SkillConfig skillconfig = SkillConfig.Get(MountSkills[i].SkillID);
                    if (skillconfig != null)
                    {
                        _scoreNum += skillconfig.FightPower;
                    }
                }
            }
            _scoreNumAll = UIHelper.GetFightPower(AddPowerDic) + _scoreNum;
            curMountFightingText.text = _scoreNumAll.ToString();
            if (mountModel._DicHorse[ID].Lv >= horseconfig.MaxLV)
            {
                m_LVtextP1.transform.parent.gameObject.SetActive(false);
                curMountFightingText1.transform.parent.gameObject.SetActive(false);
                curMountLifeText1.transform.parent.gameObject.SetActive(false);
                curMountAttackText1.transform.parent.gameObject.SetActive(false);
                curMountSpeedText1.transform.parent.gameObject.SetActive(false);
                m_ManJiImage.SetActive(true);
            }
            else
            {
                m_ManJiImage.SetActive(false);
                m_LVtextP1.transform.parent.gameObject.SetActive(true);
                curMountFightingText1.transform.parent.gameObject.SetActive(true);
                curMountLifeText1.transform.parent.gameObject.SetActive(true);
                curMountAttackText1.transform.parent.gameObject.SetActive(true);
                curMountSpeedText1.transform.parent.gameObject.SetActive(true);
                m_LVtextP1.text = (mountModel._DicHorse[ID].Lv+1) + Language.Get("Z1041");
                HorseUpConfig horseUpconfigNext = HorseUpConfig.GetHorseIDAndLV(ID, mountModel._DicHorse[ID].Lv + 1);
                int[] strAttrValueNext = horseUpconfigNext.AttrValue;
                Dictionary<int, int> AddPowerDic1 = new Dictionary<int, int>();
                AddPowerDic1.Clear();
                if (strAttrValueNext.Length != 0)
                {
                    curMountLifeText1.text = strAttrValueNext[0].ToString();//生命
                    curMountAttackText1.text = strAttrValueNext[1].ToString();//攻击
                    curMountSpeedText1.text = strAttrValueNext[2].ToString();//速度
                    AddPowerDic1.Add(6, strAttrValueNext[0]);
                    AddPowerDic1.Add(7, strAttrValueNext[1]);
                }
                int _scoreNum1 = 0;
                int _scoreNumAll1 = 0;
                for (int i = 0; i < MountSkills.Count; i++)
                {
                    if (mountModel._DicHorse[ID].Lv+1 >= MountSkills[i].HorseLV)
                    {
                        SkillConfig skillconfig = SkillConfig.Get(MountSkills[i].SkillID);
                        if (skillconfig != null)
                        {
                            _scoreNum1 += skillconfig.FightPower;
                        }
                    }
                }
                _scoreNumAll1 = UIHelper.GetFightPower(AddPowerDic1) + _scoreNum1;
                curMountFightingText1.text = _scoreNumAll1.ToString();//战斗力
            }
        }
 
    }
}