少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-13 f94112a6427fa69d3e244e49eb677ec7fb94e0d6
6498 【前端】【2.0】主界面技能转盘修改
3个文件已修改
161 ■■■■■ 已修改文件
System/MainWin/MainWinSkillController.cs 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainWin/SkillButton.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainWin/SkillContainer.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainWin/MainWinSkillController.cs
@@ -8,6 +8,8 @@
    {
        const int SKILL_COUNT_MAX = 7;
        public bool enable { get; set; }
        public readonly LogicStruct<SkillCD> skillcd0 = new LogicStruct<SkillCD>();
        public readonly LogicStruct<SkillCD> skillcd1 = new LogicStruct<SkillCD>();
        public readonly LogicStruct<SkillCD> skillcd2 = new LogicStruct<SkillCD>();
@@ -29,6 +31,7 @@
        public readonly LogicBool forbidxp = new LogicBool();
        Dictionary<int, int> skillPlaceMap = new Dictionary<int, int>();
        Dictionary<int, int> placeSkillMap = new Dictionary<int, int>();
        SkillModel model { get { return ModelCenter.Instance.GetModel<SkillModel>(); } }
@@ -42,6 +45,50 @@
            StatusMgr.OnGainCantCastSkillStatus += OnGainCantCastSkillStatus;
            StatusMgr.OnReleaseCantCastSkillStatus += OnReleaseCantCastSkillStatus;
        }
        public void InitSkill()
        {
            skillPlaceMap.Clear();
            placeSkillMap.Clear();
            for (int i = 0; i < SKILL_COUNT_MAX; i++)
            {
                var skillData = PlayerDatas.Instance.skill.GetQuickSkillByPos(i);
                placeSkillMap[i + 1] = skillData != null ? skillData.id : 0;
                if (skillData != null)
                {
                    skillPlaceMap[skillData.id] = i + 1;
                }
            }
            var blinkSkill = PlayerDatas.Instance.skill.GetSKillById(190);
            placeSkillMap[0] = blinkSkill != null ? blinkSkill.id : 0;
            if (blinkSkill != null)
            {
                skillPlaceMap[blinkSkill.id] = 0;
            }
            var skillXpId = model.GetXpSkillID();
            var skillXpData = PlayerDatas.Instance.skill.GetSKillById(skillXpId);
            placeSkillMap[8] = skillXpData != null ? skillXpData.id : 0;
            if (skillXpData != null)
            {
                skillPlaceMap[skillXpId] = 8;
            }
            if (PlayerDatas.Instance.hero != null)
            {
                foreach (var skillId in skillPlaceMap.Keys)
                {
                    var skill = PlayerDatas.Instance.hero.SkillMgr.Get(skillId);
                    if (skill != null)
                    {
                        UpdateSkillExclusiveCountDown(skillId, skill.cd, skill.skillInfo.config.CoolDownTime * Constants.F_GAMMA);
                    }
                }
            }
            UpdateSkillForbidStates();
        }
        public void Reset()
@@ -67,6 +114,7 @@
            forbidxp.value = false;
            skillPlaceMap.Clear();
            placeSkillMap.Clear();
        }
        public LogicStruct<SkillCD> GetSkillCD(int index)
@@ -125,30 +173,35 @@
        private void OnSkillRefresh()
        {
            skillPlaceMap.Clear();
            for (int i = 0; i < SKILL_COUNT_MAX; i++)
            {
                var skillData = PlayerDatas.Instance.skill.GetQuickSkillByPos(i);
                if (skillData != null)
                {
                    skillPlaceMap[skillData.id] = i + 1;
                }
            }
            var blinkSkill = PlayerDatas.Instance.skill.GetSKillById(190);
            if (blinkSkill != null)
            {
                skillPlaceMap[blinkSkill.id] = 0;
            }
            var skillXpId = model.GetXpSkillID();
            if (skillXpId != 0)
            {
                skillPlaceMap[skillXpId] = 8;
            }
            InitSkill();
        }
        private void OnSkillCDRefresh(int skillId, float cd, float total)
        {
            UpdateSkillExclusiveCountDown(skillId, cd, total);
        }
        private void OnSkillStateEnter(float time)
        {
            UpdateSkillCommonCountDown(time);
        }
        private void OnSkillStateEnd()
        {
            UpdateSkillCommonCountDown(0);
        }
        private void OnGainCantCastSkillStatus(float duration)
        {
            UpdateSkillForbidStates();
        }
        private void OnReleaseCantCastSkillStatus()
        {
            UpdateSkillForbidStates();
        }
        private void UpdateSkillExclusiveCountDown(int skillId, float cd, float total)
        {
            if (skillPlaceMap.ContainsKey(skillId))
            {
@@ -158,40 +211,20 @@
            }
        }
        private void OnSkillStateEnter(float time)
        private void UpdateSkillCommonCountDown(float time)
        {
            Debug.Log("OnSkillStateEnter");
            for (int i = 0; i <= 8; i++)
            {
                var skillcd = GetSkillCD(i);
                skillcd.value = skillcd.value.SetCommonCountDown(time);
                if (placeSkillMap.ContainsKey(i) && placeSkillMap[i] != 0)
                {
                    var skillcd = GetSkillCD(i);
                    skillcd.value = skillcd.value.SetCommonCountDown(time);
                }
            }
        }
        private void OnSkillStateEnd()
        private void UpdateSkillForbidStates()
        {
            Debug.Log("OnSkillStateEnd");
            for (int i = 0; i <= 8; i++)
            {
                var skillcd = GetSkillCD(i);
                skillcd.value = skillcd.value.SetCommonCountDown(0);
            }
        }
        private void OnGainCantCastSkillStatus(float duration)
        {
            Debug.Log("OnGainCantCastSkillStatus");
            var forbid = !StatusMgr.Instance.CanCastSkill(PlayerDatas.Instance.baseData.PlayerID);
            for (int i = 0; i <= 8; i++)
            {
                var skillForbid = GetSkillForbid(i);
                skillForbid.value = forbid;
            }
        }
        private void OnReleaseCantCastSkillStatus()
        {
            Debug.Log("OnReleaseCantCastSkillStatus");
            var forbid = !StatusMgr.Instance.CanCastSkill(PlayerDatas.Instance.baseData.PlayerID);
            for (int i = 0; i <= 8; i++)
            {
@@ -242,12 +275,12 @@
            {
                if (exclusiveOverTime > Time.realtimeSinceStartup)
                {
                    return exclusiveOverTime - Time.realtimeSinceStartup / exclusiveTotal;
                    return (exclusiveOverTime - Time.realtimeSinceStartup) / exclusiveTotal;
                }
                if (commonOverTime > Time.realtimeSinceStartup)
                {
                    return commonOverTime - Time.realtimeSinceStartup / commonTotal;
                    return (commonOverTime - Time.realtimeSinceStartup) / commonTotal;
                }
                return 0f;
System/MainWin/SkillButton.cs
@@ -49,7 +49,7 @@
        float timer = 0f;
        int skillId = 0;
        public void SetSkill(int skillId)
        public void Initialize(int skillId)
        {
            this.skillId = skillId;
            if (this.skillId == 0)
@@ -73,6 +73,8 @@
            DisplaySkillDynamicInfo(true);
            m_Selected.gameObject.SetActive(false);
            HideSkillTip();
            this.enabled = true;
        }
        public void Dispose()
@@ -87,6 +89,8 @@
            {
                HideSkillTip();
            }
            this.enabled = false;
        }
        public void AddDownListener(UnityAction _action)
System/MainWin/SkillContainer.cs
@@ -76,6 +76,7 @@
            m_Skill7.AddUpListener(PrepareCastSkill7);
            m_SkillXP.AddUpListener(PrepareCastSkillXp);
            MainWinSkillController.Instance.InitSkill();
            OnSkillRefresh();
            HandleAchievement();
            PlayerSkillDatas.OnRefreshSkill += OnSkillRefresh;
@@ -121,20 +122,21 @@
                indexSkillDataDict[i] = skillData == null ? 0 : skillData.id;
            }
            m_Skill1.SetSkill(indexSkillDataDict[0]);
            m_Skill2.SetSkill(indexSkillDataDict[1]);
            m_Skill3.SetSkill(indexSkillDataDict[2]);
            m_Skill4.SetSkill(indexSkillDataDict[3]);
            m_Skill5.SetSkill(indexSkillDataDict[4]);
            m_Skill6.SetSkill(indexSkillDataDict[5]);
            m_Skill7.SetSkill(indexSkillDataDict[6]);
            m_Skill1.Initialize(indexSkillDataDict[0]);
            m_Skill2.Initialize(indexSkillDataDict[1]);
            m_Skill3.Initialize(indexSkillDataDict[2]);
            m_Skill4.Initialize(indexSkillDataDict[3]);
            m_Skill5.Initialize(indexSkillDataDict[4]);
            m_Skill6.Initialize(indexSkillDataDict[5]);
            m_Skill7.Initialize(indexSkillDataDict[6]);
            var blinkSkillData = PlayerDatas.Instance.skill.GetSKillById(190);
            m_BlinkSkill.SetSkill(blinkSkillData == null ? 0 : blinkSkillData.id);
            m_BlinkSkill.Initialize(blinkSkillData == null ? 0 : blinkSkillData.id);
            var model = ModelCenter.Instance.GetModel<SkillModel>();
            var skillXpId = model.GetXpSkillID();
            m_SkillXP.SetSkill(skillXpId);
            var skillXpId = model.GetXpSkillID();
            var skillXpData = PlayerDatas.Instance.skill.GetSKillById(skillXpId);
            m_SkillXP.Initialize(skillXpData != null ? skillXpId : 0);
        }
        void SwitchTarget()