少年修仙传客户端代码仓库
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, January 31, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
 
 
//灵宠的技能
namespace Snxxz.UI
{
 
    public class SkillButtonPet : CellView
    {
 
        [SerializeField] Button skillBtn;
        [SerializeField] Image skillIcon;
        [SerializeField] GameObject lockObj;
        [SerializeField] Text lockLvText;
 
        public void SetModel(int skillId, int skillUnlock, bool isUnlock, int petId, SkillType skillType, bool isAll = false)
        {
            SkillConfig skillConfig = SkillConfig.Get(skillId);
            if (skillConfig == null) return;
 
            skillIcon.SetSprite(skillConfig.IconName);
            if (isUnlock)
            {
                lockObj.SetActive(false);
                lockLvText.gameObject.SetActive(false);
            }
            else
            {
                lockObj.SetActive(true);
                if (!isAll)
                {
                    lockLvText.gameObject.SetActive(true);
                    lockLvText.text = skillUnlock +Language.Get("Z1041");
 
                }
                else
                {
                    lockLvText.gameObject.SetActive(false);
                }
            }
 
            skillBtn.RemoveAllListeners();
            skillBtn.AddListener(() =>
            {
                string[] str = new string[3];
                str[0] = string.Empty;
                str[1] = string.Empty;
                //if (!isAll)
                //{
                switch (skillType)
                {
                    case SkillType.PetSkill:
                        PetInfoConfig petInfo = PetInfoConfig.Get(petId);
                        if (petInfo != null)
                        {
                            str[2] = Language.Get("pet_SkillTipLv", petInfo.Name, skillUnlock);
                        }
                        break;
                    case SkillType.MountSkill:
                        HorseConfig horseInfo = HorseConfig.Get(petId);
                        if (horseInfo != null)
                        {
                            str[2] = Language.Get("pet_SkillTipLv", horseInfo.Name, skillUnlock);
                        }
                        break;
                }
 
 
                //}
                //else
                //{
                //    str[2] = string.Empty;
                //}
                int fightPower = 0;
                if (skillConfig.FightPower > 0)
                {
                    fightPower = skillConfig.FightPower;
                }
                SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.PetSkill, fightPower, str);
            });
        }
 
    }
 
    public enum SkillType
    {
        PetSkill,
        MountSkill,
    }
}