| | |
| | | { |
| | | 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>(); |
| | |
| | | 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>(); } } |
| | | |
| | |
| | | |
| | | 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() |
| | |
| | | forbidxp.value = false; |
| | | |
| | | skillPlaceMap.Clear(); |
| | | placeSkillMap.Clear(); |
| | | } |
| | | |
| | | public LogicStruct<SkillCD> GetSkillCD(int index) |
| | |
| | | |
| | | 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)) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | 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++) |
| | | { |
| | |
| | | { |
| | | 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; |