Esempio n. 1
0
 private void CheckToDeleteCdEndEffect()
 {
     if (mCdEndEffect == null || mCdEndEffect.Count == 0)
     {
         return;
     }
     if (timeCount == 0)
     {
         timeCount = Time.time;
     }
     if (Time.time - timeCount < 0.5f)
     {
         return;
     }
     timeCount = Time.time;
     for (int i = mCdEndEffect.Count - 1; i >= 0; i--)
     {
         ShortCutBarBtn type = mCdEndEffectTime.ElementAt(i).Key;
         mCdEndEffectTime[type] = mCdEndEffectTime[type] - 0.5f;
         if (mCdEndEffectTime[type] <= 0)
         {
             ShowCdEndEffect(type, false);
         }
     }
 }
Esempio n. 2
0
 private void CheckToDeletePressEffect()
 {
     if (mPressBtnEffectTime == null || mPressBtnEffectTime.Count == 0)
     {
         return;
     }
     if (timePressCount == 0)
     {
         timePressCount = Time.time;
     }
     if (Time.time - timePressCount < 0.5f)
     {
         return;
     }
     timePressCount = Time.time;
     for (int i = mPressBtnEffect.Count - 1; i >= 0; i--)
     {
         ShortCutBarBtn type = mPressBtnEffectTime.ElementAt(i).Key;
         mPressBtnEffectTime[type] = mPressBtnEffectTime[type] - 0.5f;
         if (mPressBtnEffectTime[type] <= 0)
         {
             mPressBtnEffectTime.Remove(type);
             DeletePressEffect(type);
         }
     }
 }
Esempio n. 3
0
        //快键到技能类型转换
        private ShortCutBarBtn GetBtnType(SkillType type)
        {
            ShortCutBarBtn btnType = ShortCutBarBtn.BTN_END;

            switch (type)
            {
            case SkillType.SKILL_TYPE1:
                btnType = ShortCutBarBtn.BTN_SKILL_1;
                break;

            case SkillType.SKILL_TYPE2:
                btnType = ShortCutBarBtn.BTN_SKILL_2;
                break;

            case SkillType.SKILL_TYPE3:
                btnType = ShortCutBarBtn.BTN_SKILL_3;
                break;

            case SkillType.SKILL_TYPE4:
                btnType = ShortCutBarBtn.BTN_SKILL_4;
                break;

            case SkillType.SKILL_TYPEABSORB1:
                btnType = ShortCutBarBtn.BTN_SKILL_5;
                break;

            case SkillType.SKILL_TYPEABSORB2:
                btnType = ShortCutBarBtn.BTN_SKILL_6;
                break;
            }
            return(btnType);
        }
Esempio n. 4
0
 private void RemoveCdList(ShortCutBarBtn type)
 {
     if (!IsSkillInCd(type))
     {
         return;
     }
     ShowCdEndEffect(type, true);
     mSkillCdList.Remove(type);
 }
Esempio n. 5
0
        private void DeletePressEffect(ShortCutBarBtn btnType)
        {
            GameObject obj = null;

            if (mPressBtnEffect.TryGetValue(btnType, out obj))
            {
                GameObject.DestroyObject(obj);
                mPressBtnEffect.Remove(btnType);
            }
        }
Esempio n. 6
0
        public void ResetSkillAsignedSkill(ShortCutBarBtn btnType)
        {
            CdCountDown cdDown = null;

            if (mCdDownDic.TryGetValue(btnType, out cdDown) && IsSkillInCd(btnType))
            {
                cdDown.EndCdCountDown();
                RemoveCdList(btnType);
                ShowValideUseSkillBtn(btnType, true);
            }
        }
Esempio n. 7
0
        //清除某个技能CD
        public void RemoveSkillCountDown(ShortCutBarBtn type)
        {
            CdCountDown cd;

            if (mCdDownDic.TryGetValue(type, out cd) && IsSkillInCd(type))
            {
                cd.EndCdCountDown();
                RemoveCdList(type);
                ShowValideUseSkillBtn(type, true);
            }
        }
Esempio n. 8
0
        public void ShowValideUseSkillBtn(ShortCutBarBtn btnType, bool visiable)
        {
            Iselfplayer player = PlayerManager.Instance.LocalPlayer;

            if (null == player)
            {
                return;
            }
            int index               = (int)btnType;
            int skillId             = 0;
            SkillManagerConfig info = null;

            switch (btnType)
            {
            case ShortCutBarBtn.BTN_SKILL_1:
            case ShortCutBarBtn.BTN_SKILL_2:
            case ShortCutBarBtn.BTN_SKILL_3:
            case ShortCutBarBtn.BTN_SKILL_4:
                break;

            case ShortCutBarBtn.BTN_SKILL_5:
                if (player != null && player.BaseSkillIdDic.ContainsKey(SkillType.SKILL_TYPEABSORB1))
                {
                    skillId = player.BaseSkillIdDic[SkillType.SKILL_TYPEABSORB1];
                }
                info = ConfigReader.GetSkillManagerCfg(skillId);
                if (skillId == 0 || info == null)
                {
                    visiable = false;
                }
                break;

            case ShortCutBarBtn.BTN_SKILL_6:
                if (player != null && player.BaseSkillIdDic.ContainsKey(SkillType.SKILL_TYPEABSORB2))
                {
                    skillId = player.BaseSkillIdDic[SkillType.SKILL_TYPEABSORB2];
                }
                info = ConfigReader.GetSkillManagerCfg(skillId);
                if (skillId == 0 || info == null)
                {
                    visiable = false;
                }
                break;

            default:
                return;
            }
            if (!visiable)
            {
                ShowCdEndEffect(btnType, false);
            }
        }
Esempio n. 9
0
        // 开始技能CD显示,参数:按钮槽类型,总CD时间,CD时间;返回true 成功,否则 技能正在CD中
        public bool StartSkillCountDown(ShortCutBarBtn btnType, float totalTime, float lastTime)
        {
            CdCountDown cd;

            if (IsSkillInCd(btnType))
            {
                return(false);
            }
            if (mCdDownDic.TryGetValue(btnType, out cd) && lastTime > 0)
            {
                ShowValideUseSkillBtn(btnType, false);
                ShowPressEffect(btnType);
                cd.StartCdCountDown(totalTime, lastTime);
                cd.CdCountDownEvent += SkillCdEnd;
                mSkillCdList.Add(btnType);
            }
            return(true);
        }
Esempio n. 10
0
        public void ShowPressEffect(ShortCutBarBtn btnType)
        {
            if (IsSkillInCd(btnType) || mPressBtnEffect.ContainsKey(btnType))
            {
                return;
            }

            ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.PressBtnEffect, ResourceType.PREFAB);
            GameObject   obj     = GameObject.Instantiate(objUnit.Asset) as GameObject;

            int index = (int)btnType;

            obj.transform.parent        = mBtnArray[index].transform;
            obj.transform.localPosition = Vector3.zero;
            obj.transform.localScale    = Vector3.one;
            mPressBtnEffect.Add(btnType, obj);
            mPressBtnEffectTime.Add(btnType, 1.5f);
        }
Esempio n. 11
0
        //设计技能图片
        public void SetSkillBtnPic(ShortCutBarBtn btntype, string spriteName)
        {
            mBtnSprite[btntype].spriteName = spriteName;

            if (btntype == ShortCutBarBtn.BTN_SKILL_5 || btntype == ShortCutBarBtn.BTN_SKILL_6)
            {
                if (spriteName == "")
                {
                    mBtnSprite[btntype].enabled = false;
                    mBtnSelectPic[btntype].gameObject.SetActive(false);
                    RemoveSkillCountDown(btntype);
                }
                else
                {
                    mBtnSelectPic[btntype].gameObject.SetActive(true);
                    mBtnSprite[btntype].enabled = true;
                }
            }
        }
Esempio n. 12
0
        private void ShowBtnCanUseEffect(ShortCutBarBtn type)
        {
            if (PlayerManager.Instance == null || PlayerManager.Instance.LocalPlayer == null)
            {
                return;
            }
            if (PlayerManager.Instance.LocalPlayer.SkillIdDic == null || PlayerManager.Instance.LocalPlayer.SkillIdDic.Count == 0)
            {
                return;
            }
            Iselfplayer        player    = PlayerManager.Instance.LocalPlayer;
            SkillType          skillType = GetSkillType((int)type);
            int                skillId   = PlayerManager.Instance.LocalPlayer.SkillIdDic[skillType];
            SkillManagerConfig info      = ConfigReader.GetSkillManagerCfg(skillId);

            if (info == null)
            {
                return;
            }
            GameObject sprite = mCanPressEffect[type];
            bool       isInCd = IsSkillInCd(type);

            if (info.mpUse > player.Mp || info.cpUse > player.Cp || info.hpUse > player.Hp || isInCd)
            {
                if (sprite.activeInHierarchy)
                {
                    sprite.SetActive(false);
                }
            }
            else
            {
                if (!sprite.activeInHierarchy)
                {
                    sprite.SetActive(true);
                }
            }
        }
Esempio n. 13
0
        public void ShowCdEndEffect(ShortCutBarBtn btnType, bool show)
        {
            GameObject obj = null;

            if (show)
            {
                if (mCdEndEffect.ContainsKey(btnType))
                {
                    return;
                }

                ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.CdEndEffect, ResourceType.PREFAB);
                obj = GameObject.Instantiate(objUnit.Asset) as GameObject;


                int index = (int)btnType;
                obj.transform.parent        = mBtnArray[index].transform;
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localScale    = Vector3.one;
                mCdEndEffect.Add(btnType, obj);
                mCdEndEffectTime.Add(btnType, 1.5f);
            }
            else
            {
                if (!mCdEndEffect.ContainsKey(btnType))
                {
                    return;
                }
                obj = null;
                if (mCdEndEffect.TryGetValue(btnType, out obj))
                {
                    GameObject.DestroyObject(obj);
                }
                mCdEndEffect.Remove(btnType);
                mCdEndEffectTime.Remove(btnType);
            }
        }
Esempio n. 14
0
 //判断某个技能是否在CD中
 public bool IsSkillInCd(ShortCutBarBtn type)
 {
     return(mSkillCdList.Contains(type));
 }