//处理战斗view的事件 public IEnumerator FightViewTouchFn(Const.FIGHT_BTN_TYPE state) { //场上必须得有卡牌才能响应 if (MineFightData.getInstance().usingCardsNumber() > 0 && FightController.getInstance().RightToPlay == FightController.RIGHTTOPLAY.MINE) { if (Const.FIGHT_BTN_TYPE.NO_OUT == state) { noOut(); FightController.getInstance().RightToPlay = FightController.RIGHTTOPLAY.ENEMY; } else if (Const.FIGHT_BTN_TYPE.TIP == state) { noOut(); if (currOutCardRule.Count == 0) { currOutCardRule = getItemOutCardRule(); } if (currOutCardRule.Count > 0) { List <int> l = new List <int>(); l = currOutCardRule[0]; currOutCardRule.RemoveAt(0); foreach (var pos in l) { cardToWaitPos(pos); } } } //出击 else if (Const.FIGHT_BTN_TYPE.ATK == state) { //此时是否有卡片可以出 bool isHaveCardCanOut = false; for (int i = 1; i <= Const.FRIST_CARD_NUM; ++i) { if (viewCardDic.ContainsKey(i) && viewCardDic[i].getCardState() == Card.CardState.waitFight) { isHaveCardCanOut = true; FightController.getInstance().RightToPlay = FightController.RIGHTTOPLAY.MINEING; viewCardDic[i].getObj().transform.SetAsLastSibling(); viewCardDic [i].getObj().GetComponent <RectTransform> ().DOLocalMove(FightUIData.getInstance().EnemyVec3 + new Vector3(0, Screen.height * 0.2f, 0), 0.1f) .SetEase(Ease.InBack).SetUpdate(true); yield return(new WaitForSeconds(0.3f)); } } if (isHaveCardCanOut) { yield return(new WaitForSeconds(0.6f)); FightController.getInstance().RightToPlay = FightController.RIGHTTOPLAY.ENEMY; } else { MsgPrompts.create("请选择至少一张卡牌", Color.red); } } } }
/// <summary> /// 执行攻击 /// </summary> /// <returns></returns> override public IEnumerator DoAtk() { //foreach (KeyValuePair<int, GameObject> item in dicCardObj) //{ // FightCard vFightCard = item.Value.GetComponent<FightCard>(); // if (vFightCard.postionState == FightCard.PostionState.choice) // { // } //} List <int> canAtkCardList = new List <int>(); List <FightCard> list = new List <FightCard>(); int numberSum = 0; foreach (KeyValuePair <int, GameObject> item in dicCardObj) { FightCard vFightCard = item.Value.GetComponent <FightCard>(); if (vFightCard.postionState == FightCard.PostionState.choice) { list.Add(vFightCard); FightAtkAnim atkAnim = item.Value.GetComponent <FightAtkAnim>(); atkAnim.PlayAtk(canAtkCardList.Count * atkSpaceTime); canAtkCardList.Add(vFightCard.GetCardDetail().id); if (!listSpcaePos.ContainsKey(vFightCard.pos)) { listSpcaePos.Add(vFightCard.pos, vFightCard.pos); this.listFightCard.Remove(vFightCard); numberSum = numberSum + vFightCard.GetCardDetail().number; } } } lastFightData.CalculationType(list, numberSum); if (canAtkCardList.Count == 0) { MsgPrompts.create("未选择一张卡片"); } else { for (int i = 0; i < canAtkCardList.Count; ++i) { this.dicCardObj.Remove(canAtkCardList[i]); } yield return(new WaitForSeconds(canAtkCardList.Count * atkSpaceTime + 1)); this.Licensing(); yield return(new WaitForSeconds(canAtkCardList.Count * atkSpaceTime + 1)); this.fightState.Waiver(); } }
void EveSure(GameObject obj) { string touchTag = obj.transform.parent.gameObject.name; Debug.Log(touchTag); int tag = int.Parse(touchTag); if (tag == 1) { SceneManager.LoadSceneAsync("ChoiceEnemy"); } else { MsgPrompts.create(string.Format("角色Lv{0:0}级开放", unlock[tag]), Color.red); } }
//我方获得出牌权 public void MineGetWaiver() { if (lastFightData.GetOutType() == OUTTYPE.None) { MsgPrompts.create("表示敌方要不起我方牌 我方可以随意出牌"); } else { List <FightCard> temp = this.isCanWantLastCard(lastFightData); if (temp.Count == 0) { MsgPrompts.create("要不起自动交出出牌权"); } else { MsgPrompts.create("要的起"); } } }
/// <summary> /// 蓄力按钮事件回调 /// </summary> public void EveStorage() { MsgPrompts.create("我方蓄力"); this.lastFightData.ClearUp(); this.fightState.Waiver(); }