/// <summary> /// 播放牌面合上再打开的动画 /// </summary> public IEnumerator PlayCloseCardAction() { int rotateAngle = GlobalData.SitCardCloseArr[sitOffset]; foreach (Transform item in handCardContainer) { if (item.gameObject.activeSelf) { item.localEulerAngles = new Vector3(rotateAngle, 0, 0); } } StartCoroutine(AudioSystem.Instance.PlayEffectAudio("Voices/Effect/RotateAllCard")); yield return(new WaitForSeconds(0.83f)); if (_data.userId == playerInfoProxy.userID || battleProxy.isReport) { _data.handCards.Sort(); for (int i = 0; i < handCards.Count; i++) { handCards[i].name = "HandCard" + i; } handCards.Sort(BattleAreaUtil.CompareCard); } BattleAreaUtil.ResortHandGangGetCard(this); foreach (Transform item in handCardContainer) { if (item.gameObject.activeSelf) { item.localEulerAngles = new Vector3(0, 0, 0); } } }
/// <summary> /// 播放胡牌动作 /// </summary> /// <param name="huedCard"></param> public void PlayHu(GameObject huedCard) { huedCard.transform.SetParent(handCardContainer); handCards.Add(huedCard); if (_data.userId == playerInfoProxy.userID || battleProxy.isReport) { for (int i = 0; i < handCards.Count; i++) { handCards[i].name = "HandCard" + i; } handCards.Sort(BattleAreaUtil.CompareCard); } BattleAreaUtil.ResortHandGangGetCard(this); RecoveryHandCardsColor(); }
/// <summary> /// 播放直杠动作 /// </summary> /// <param name="zhiGangedCard"></param> public void PlayZhiGang(GameObject zhiGangedCard) { zhiGangedCard.transform.DOKill(); List <GameObject> gangCards = new List <GameObject>(); gangCards.Add(zhiGangedCard); if (_data.userId == playerInfoProxy.userID || battleProxy.isReport) { for (int i = 0; i < handCards.Count;) { if (BattleAreaUtil.GetMeshCardValue(handCards[i]) == battleProxy.GetPlayerActS2C().actCard) { gangCards.Add(handCards[i]); handCards.RemoveAt(i); } else { i++; } if (gangCards.Count == 4) { break; } } } else { var randomIndex = UnityEngine.Random.Range(0, handCards.Count - 3); gangCards.Add(handCards[randomIndex]); gangCards.Add(handCards[randomIndex + 1]); gangCards.Add(handCards[randomIndex + 2]); handCards.RemoveAt(randomIndex); handCards.RemoveAt(randomIndex); handCards.RemoveAt(randomIndex); foreach (GameObject gangCard in gangCards) { ResourcesMgr.Instance.SetCardMesh(gangCard, battleProxy.GetPlayerActS2C().actCard); } } foreach (GameObject card in gangCards) { card.transform.SetParent(pengGangCardContainer); } pengGangCards.Add(gangCards); BattleAreaUtil.ResortHandGangGetCard(this); }
/// <summary> /// 播放自摸胡牌动作 /// </summary> public void PlaySelfHu() { if (getCard != null) { handCards.Add(getCard); getCard.transform.DOKill(); getCard = null; } if (_data.userId == playerInfoProxy.userID || battleProxy.isReport) { for (int i = 0; i < handCards.Count; i++) { handCards[i].name = "HandCard" + i; } handCards.Sort(BattleAreaUtil.CompareCard); } BattleAreaUtil.ResortHandGangGetCard(this); RecoveryHandCardsColor(); }
/// <summary> /// 播放摸牌动画 /// </summary> public IEnumerator PlayGetCard() { GameObject cardItem = null; if (GlobalData.hasHeap) { cardItem = (ApplicationFacade.Instance.RetrieveMediator(Mediators.BATTLE_AREA_MEDIATOR) as BattleAreaMediator).GetHeapCard(battleProxy.GetPlayerActS2C().actCard); cardItem.transform.SetParent(handCardContainer); cardItem.transform.localScale = sendCard.transform.localScale; cardItem.transform.localEulerAngles = sendCard.transform.localEulerAngles; } else { cardItem = ResourcesMgr.Instance.GetFromPool(battleProxy.GetPlayerActS2C().actCard); cardItem.transform.SetParent(handCardContainer); cardItem.transform.localPosition = sendCard.transform.localPosition; cardItem.transform.localScale = sendCard.transform.localScale; cardItem.transform.localEulerAngles = sendCard.transform.localEulerAngles; } Vector3 targetPos = Vector3.zero; if (handCards.Count > 0) { targetPos = handCards[handCards.Count - 1].transform.localPosition + getHandCardGap; } else { targetPos = getCardContainer.localPosition; } if (_data.userId == playerInfoProxy.userID) { targetPos.y = 0; targetPos.z = 0; } if (getCard != null) { handCards.Add(getCard); getCard.transform.DOKill(); getCard = null; } if (handCards.Count != _data.handCards.Count) { Debug.LogError("显示和数据不一致"); } getCard = cardItem; if (battleProxy.isSkipTween) { cardItem.transform.localPosition = targetPos; if (_data.userId == playerInfoProxy.userID) { cardItem.layer = GlobalData.SELF_HAND_CARDS; } else if (dir == AreaDir.RIGHT) { cardItem.layer = GlobalData.RIGHT_HAND_CARDS; } else { cardItem.layer = GlobalData.OTHER_CARDS; } BattleAreaUtil.ResortHandGangGetCard(this); } else { cardItem.transform.DOLocalMove(targetPos, 0.1f); if (_data.userId == playerInfoProxy.userID) { cardItem.layer = GlobalData.SELF_HAND_CARDS; } else if (dir == AreaDir.RIGHT) { cardItem.layer = GlobalData.RIGHT_HAND_CARDS; } else { cardItem.layer = GlobalData.OTHER_CARDS; } battleProxy.SetIsForbit(true); yield return(new WaitForSeconds(0.15f)); BattleAreaUtil.ResortHandGangGetCard(this); battleProxy.SetIsForbit(false); } }