少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
    public class SkillExpertBehaviour : MonoBehaviour
    {
        [SerializeField] ImageEx m_Bottom;
        [SerializeField] ImageEx m_Icon;
        [SerializeField] Text m_SkillName;
        [SerializeField] Text m_Active; //使用中
        [SerializeField] RedpointBehaviour m_Redpoint;
        [SerializeField] Button m_Select;
        [SerializeField] UIEffect ActiveEffect;
        [SerializeField] Image SelectImg;
        [SerializeField] ImageEx m_ReikiBottom;
 
        const float dragDelay = 0.2f;
 
 
        public int skillId { get; private set; }
 
        bool isUnlock = false;
 
        bool onPress = false;
        float m_Time = 0.0f;
 
        public RectTransform flyContainer
        {
            get { return m_Icon.rectTransform; }
        }
 
        TreasureSkillModel model { get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); } }
        ReikiRootModel reikiModel { get { return ModelCenter.Instance.GetModel<ReikiRootModel>(); } }
 
        private int GetLimitLV()
        {
            var skillConfig = SkillConfig.Get(skillId);
            var property = skillConfig.RequireProperty();
            var condition = 0;
            if (!reikiModel.IsSatisfyReikiRootCondition(property, out condition))
            {
                return condition == 1 ? reikiModel.resetReikiLimitLevel : reikiModel.afterReikiRootLimitLevel;
            }
            return 1;
        }
 
 
        public void Display(int skillId, int level)
        {
            this.skillId = skillId;
            this.isUnlock = level > 0;
 
            var skillConfig = SkillConfig.Get(skillId);
 
            m_Icon.SetSprite(PlayerDatas.Instance.baseData.LV < GetLimitLV() ? "UnKnowIcon" : skillConfig.IconName);
 
            string addLV = level > 0 ? " " + Language.Get("ExpertSkillLV", Language.Get("Num_CHS_" + level)) : string.Empty;
            m_SkillName.text = skillConfig.SkillName + addLV;
 
            var property = skillConfig.RequireProperty();
            m_ReikiBottom.SetSprite("XT_LGDT_" + property);
 
            var selectExpertSkill = 0;
            model.TryGetExpertSkill(ExpertSkillSelectWin.skillId, out selectExpertSkill);
 
            TreasurePotential expert;
            model.TryGetPotential(skillId, out expert);
 
            int tmpSkillID = 0;
            model.TryGetExpertSkill(model.selectSkill, out tmpSkillID);
            ActiveEffect.Stop();
            if (tmpSkillID == skillId)
            {
                m_Active.SetActive(true);
                ActiveEffect.Play();
            }
            else
            {
                m_Active.SetActive(false);
            }
 
            SelectImg.SetActive(model.selecttExpertSkill == skillId);
 
            m_Bottom.gray = !isUnlock;
            m_Icon.gray = !isUnlock;
            m_ReikiBottom.gray = !isUnlock;
 
 
            m_Redpoint.redpointId = expert.activeRedpoint.id;
 
            m_Select.SetListener(OnSelect);
        }
 
        private void OnSelect()
        {
            var limitLV = GetLimitLV();
            if (PlayerDatas.Instance.baseData.LV < limitLV)
            {
                SysNotifyMgr.Instance.ShowTip("RuneSpecialHoleLevelError", limitLV);
                return;
            }
            model.selecttExpertSkill = skillId;
        }
    }
}