public void RememberRegiste(GameObject skillBtn, SkillBtnRemember.RememberBtnType rememberBtnType) { var skillBtnRemember = skillBtn.GetComponent <SkillBtnRemember>(); if (skillBtnRemember == null) { skillBtnRemember = skillBtn.AddComponent <SkillBtnRemember>(); } skillBtnRemember.BtnRememberType = rememberBtnType; skillBtnRemember.OnSkillBtnClicked = (flag) => { StopCoroutine("BtnRemberTimeDown"); if (RememberBtn != null) { RememberBtn.ShowRememberEff(false); RememberBtn.BtnMemTime = 0; RememberBtn = null; } //技能施放失败,进入记忆状态并开始倒计时 //Debug.Log(skillBtnRemember.name+" Fire:"+flag); if (!flag) { RememberBtn = skillBtn.GetComponent <SkillBtnRemember>(); RememberBtn.ResetBtnMemTime(); RememberBtn.ShowRememberEff(true); StartCoroutine("BtnRemberTimeDown"); } }; m_skillBtnRemembers.Add(skillBtnRemember); }
IEnumerator BtnRemberTimeDown() { while (true) { if (RememberBtn != null) { if (RememberBtn.BtnMemTime > 0) { RememberBtn.BtnMemTime -= Time.deltaTime; switch (RememberBtn.BtnRememberType) { case SkillBtnRemember.RememberBtnType.NormalSkillBtn: if (PlayerManager.Instance.OnRememberNormalPress()) { StopCoroutine("BtnRemberTimeDown"); RememberBtn.ShowRememberEff(false); RememberBtn.BtnMemTime = 0; RememberBtn = null; PlayerManager.Instance.NormalAttackRemembering = false; } break; case SkillBtnRemember.RememberBtnType.ScrollBtn: case SkillBtnRemember.RememberBtnType.ExplosiveBtn: case SkillBtnRemember.RememberBtnType.LoreBtn: case SkillBtnRemember.RememberBtnType.SkillBtn: if (RememberBtn.GetComponent <BattleSkillButton>().ButtonClickWithRet(null)) { StopCoroutine("BtnRemberTimeDown"); RememberBtn.ShowRememberEff(false); RememberBtn.BtnMemTime = 0; RememberBtn = null; } //else //{ //Debug.Log(RememberBtn.name+" Fire:"+false); //} break; } } else { StopCoroutine("BtnRemberTimeDown"); RememberBtn.ShowRememberEff(false); RememberBtn.BtnMemTime = 0; RememberBtn = null; } } else { StopCoroutine("BtnRemberTimeDown"); } yield return(null); } }