少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
using System;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.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:
                    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 =  Language.Get("LoadIconLV", _PetBackpack.PetClass);
            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 = UIHelper.ReplaceLargeNum(_scoreNumAll);
            if (_PetBackpack.PetClass >= petinfo.MaxRank)
            {
                curPetAttackText1.transform.parent.SetActive(false);
                curPetHitText1.transform.parent.SetActive(false);
                curPetAttackSpeedText1.transform.parent.SetActive(false);
                m_LVtext1.transform.parent.SetActive(false);
                m_ManJiImageP.SetActive(true);
            }
            else
            {
                curPetAttackText1.transform.parent.SetActive(true);
                curPetHitText1.transform.parent.SetActive(true);
                curPetAttackSpeedText1.transform.parent.SetActive(true);
                m_LVtext1.transform.parent.SetActive(true);
                m_ManJiImageP.SetActive(false);
                m_LVtext1.text = Language.Get("LoadIconLV", (_PetBackpack.PetClass + 1));
                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 = UIHelper.ReplaceLargeNum(_scoreNumAll1);
            }
        }
 
    }
}