public void Bao(int dice, int oldBao) { IsBusy = true; MJPlayer player = Game.MJMgr.GetPlayerByPosition(position); //Time.timeScale = 0.1f; bool hasOldBao = (oldBao != -1); if (hasOldBao) { HideBaoEffect(); Game.SoundManager.PlayHuanBao(player.postion); int card = oldBao; //Game.SoundManager.PlayCardSound(card); if (player.baoRoot.childCount > 0) { Transform old = player.baoRoot.GetChild(0); Game.PoolManager.CardPool.Despawn(old.gameObject); } Transform dropCLTrans = player.dropCardLayout.transform; int childCount = dropCLTrans.childCount; anim.gameObject.SetActive(true); Vector3 toPos = player.dropCardLayout.GetLocalPos(childCount); Vector3 endPos = dropCLTrans.TransformPoint(toPos); hand.transform.position = endPos; GameObject child = Game.PoolManager.CardPool.Spawn(card.ToString()); //Game.MJMgr.LastDropCard = child.GetComponent<MJEntity>(); //Game.MJMgr.LastDropCard.Card = card; Transform cardTrans = child.transform; cardTrans.SetParent(handMJRoot); cardTrans.localPosition = Vector3.zero; cardTrans.localRotation = Quaternion.identity; cardTrans.localScale = Vector3.one; anim.Play("Drop"); handAnima.OnDropCallback = () => { Game.SoundManager.PlayDropCard(); player.dropCardLayout.AddCard(card, child); MJCardGroup.TryDragCard(); //MJCardGroup.DragBaoCard(dice); Game.Delay(0.5f, () => { PutBao(); }); }; } else { MJCardGroup.TryDragCard(); //MJCardGroup.DragBaoCard(); PutBao(); } }
public int Dice(int diceIndex1, int diceIndex2) { DiceAnimation.Play("Dice"); Debug.LogFormat("Dice:[{0},{1}]", diceIndex1, diceIndex2); dice1.SetDice(diceIndex1); dice2.SetDice(diceIndex2); diceNum = Mathf.Min(diceIndex1, diceIndex2); MJCardGroup.GetStartGroup(); return(diceNum); }
IEnumerator doLicensing(List <GameOperHandCardSyn> handCards) { float waitTime = 0.3f; foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); player.handCardLayout.PlayDefault(); } yield return(new WaitForEndOfFrame()); foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); for (int i = 0; i < 6; i++) { int sCard = hc.handCards[i]; player.handCardLayout.AddCard(sCard, true); MJCardGroup.TryDragCard(); } Game.SoundManager.PlayGet4Card(); } yield return(new WaitForSeconds(waitTime)); foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); for (int i = 6; i < 12; i++) { int sCard = hc.handCards[i]; player.handCardLayout.AddCard(sCard, true); MJCardGroup.TryDragCard(); } Game.SoundManager.PlayGet4Card(); } yield return(new WaitForSeconds(waitTime)); foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); int sCard = hc.handCards[12]; player.handCardLayout.AddCard(sCard, true); MJCardGroup.TryDragCard(); } }
public static void TryDragCard(bool countdown = true) //countdown表示要不要减剩余牌数。 { MJCardGroup group = Game.MJMgr.ActiveGroup; if (Game.Instance.Gang == true) { group.doGangDragCard(countdown); } else { group.doTryDragCard(countdown); } }
internal static void DragBaoCard(int dice = -1) { MJCardGroup group = Game.MJMgr.ActiveGroup; //if (Game.MJMgr.BaoDize == -1) { // 第一次确定宝 group.doDragBaoCard(); } //else { // 换宝 //doChangeBaoCard(dice); } }
public Vector3 DragCard(int card, GameObject child) { child.transform.SetParent(this.transform); child.transform.localScale = Vector3.one; child.transform.localRotation = Quaternion.identity; Transform newPos = FindRightCard(); Vector3 pos = Vector3.zero; if (null != newPos) { if (newPos.localPosition.x > -0.1f && newPos.localPosition.x < 0.01f) { pos = new Vector3(newPos.localPosition.x - 0.04425f, 0, 0); print(" >>>>>>.newPos 1-222222 <<<<<<" + newPos.localPosition.x); } else if (newPos.localPosition.x > 0.013f) { pos = new Vector3(newPos.localPosition.x - 0.13275f, 0, 0); print(" >>>>>>.newPos 1-333333 <<<<<<" + newPos.localPosition.x); } else { pos = newPos.localPosition; print(" >>>>>>.newPos 1-444444 <<<<<<" + newPos.localPosition.x); } } child.transform.localPosition = pos + Vector3.right * width * 1.5f; last = child.GetComponent <MJEntity>(); last.Card = card; list.Add(last); HandCards.Add(card); MJCardGroup.TryDragCard(); return(child.transform.position); }
public Vector3 DragCard(int card, GameObject child) { child.transform.SetParent(this.transform); child.transform.localScale = Vector3.one; child.transform.localRotation = Quaternion.identity; Transform newPos = FindRightCard(); Vector3 pos = Vector3.zero; if (null != newPos) { pos = newPos.localPosition; } child.transform.localPosition = pos + Vector3.right * width * 1.2f; last = child.GetComponent <MJEntity>(); last.Card = card; list.Add(last); HandCards.Add(card); MJCardGroup.TryDragCard(true); return(child.transform.position); }
void LicensingOnReconnect(List <GameOperHandCardSyn> handCards) { foreach (GameOperHandCardSyn hc in handCards) { Debug.LogFormat("===CardSyn: {0} HandCard[{1}],DropCards[{2}],TableCards[{3}],reconnect:{4},jiuyaocards{5}", strs[hc.position], ToStr(hc.handCards), ToStr(hc.cardsBefore), ToStr(hc.downCards, true), true, ToStr(hc.yaojiuCards)); MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); player.dropCardLayout.Clear(); player.tableCardLayout.Clear(); player.handCardLayout.Clear(); player.handCardLayout.PlayDefault(); player.jiuYaoCardLayout.Clear(); for (int i = 0; i < hc.handCards.Count; i++) { int sCard = hc.handCards[i]; player.handCardLayout.AddCard(sCard); MJCardGroup.TryDragCard(); } for (int i = 0; i < hc.cardsBefore.Count; i++) { int sCard = hc.cardsBefore[i]; player.dropCardLayout.AddCard(sCard); MJCardGroup.TryDragCard(); } for (int i = 0; i < hc.yaojiuCards.Count; i++) { int sCard = hc.yaojiuCards[i]; player.jiuYaoCardLayout.AddCard(sCard); MJCardGroup.TryDragCard(); } for (int i = 0; i < hc.downCards.Count; i++) { int sCard = hc.downCards[i]; int card1 = (sCard & 0xff); int card2 = ((sCard >> 8) & 0xff); int card3 = ((sCard >> 16) & 0xff); if (card3 == 0xf) //杠特殊处理 //TODO 技术债务 { player.tableCardLayout.AddCard(card1); player.tableCardLayout.AddCard(card1); player.tableCardLayout.AddCard(card1); player.tableCardLayout.AddCard(card1); MJCardGroup.TryDragCard(); MJCardGroup.TryDragCard(); MJCardGroup.TryDragCard(); MJCardGroup.TryDragCard(); Game.Instance.Gang = true; MJCardGroup.TryDragCard();//杠摸 } else { player.tableCardLayout.AddCard(card1); player.tableCardLayout.AddCard(card2); player.tableCardLayout.AddCard(card3); MJCardGroup.TryDragCard(); MJCardGroup.TryDragCard(); MJCardGroup.TryDragCard(); } } } }
public static void TryDragCard(bool countdown = false) { MJCardGroup group = Game.MJMgr.ActiveGroup; group.doTryDragCard(countdown); }
//显示会牌 public static void ShowHuiCard(int cardPoint) { MJCardGroup group = Game.MJMgr.ActiveGroup; group.DOShowHuiPai(cardPoint); }
void LicensingOnReconnect(List <GameOperHandCardSyn> handCards) { foreach (GameOperHandCardSyn hc in handCards) { Debug.LogFormat("===CardSyn: {0} HandCard[{1}],DropCards[{2}],TableCards[{3}],reconnect:{4}", strs[hc.position], ToStr(hc.handCards), ToStr(hc.cardsBefore), ToStr(hc.downCards, true), true); MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); player.dropCardLayout.Clear(); player.tableCardLayout.Clear(); player.handCardLayout.Clear(); player.handCardLayout.PlayDefault(); for (int i = 0; i < hc.handCards.Count; i++) { int sCard = hc.handCards[i]; player.handCardLayout.AddCard(sCard); MJCardGroup.TryDragCard(); } for (int i = 0; i < hc.cardsBefore.Count; i++) { int sCard = hc.cardsBefore[i]; player.dropCardLayout.AddCard(sCard); MJCardGroup.TryDragCard(); } for (int i = 0; i < hc.downCards.Count; i++) { /* if (hc.handCards[0] == -1) * { * int sCard = hc.downCards[i]; * int card1 = (sCard & 0xff); * int card2 = ((sCard >> 8) & 0xff); * int card3 = ((sCard >> 16) & 0xff); * int card4 = ((sCard >> 24) & 0xff); * * * if (card1 == card2 && card1 == card3) * { * if (card4 != 0) * { * player.tableCardLayout.AddCard(-1); * player.tableCardLayout.AddCard(-1); * player.tableCardLayout.AddCard(-1); * player.tableCardLayout.AddCard(-1); * }else * { * player.tableCardLayout.AddCard(card1); * player.tableCardLayout.AddCard(card2); * player.tableCardLayout.AddCard(card3); * * } * }else * { * player.tableCardLayout.AddCard(card1); * player.tableCardLayout.AddCard(card2); * player.tableCardLayout.AddCard(card3); * * } * * MJCardGroup.TryDragCard(); * MJCardGroup.TryDragCard(); * MJCardGroup.TryDragCard(); * if (card1 == card2 && card1 == card3) * { * if (card4 != 0) * MJCardGroup.TryDragCard(); * } * } * else */ { int sCard = hc.downCards[i]; int card1 = (sCard & 0xff); int card2 = ((sCard >> 8) & 0xff); int card3 = ((sCard >> 16) & 0xff); int card4 = ((sCard >> 24) & 0xff); player.tableCardLayout.AddCard(card1); player.tableCardLayout.AddCard(card2); player.tableCardLayout.AddCard(card3); if (card1 == card2 && card1 == card3) { if (card4 != 0) { //player.tableCardLayout.AddCard(card4); player.tableCardLayout.ChangeCard(card4); } } MJCardGroup.TryDragCard(); MJCardGroup.TryDragCard(); MJCardGroup.TryDragCard(); if (card1 == card2 && card1 == card3) { if (card4 != 0) { MJCardGroup.TryDragCard(); } } } } } }
IEnumerator doLicensing(List <GameOperHandCardSyn> handCards) { float waitTime = 0.3f; foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); player.handCardLayout.PlayDefault(); } yield return(new WaitForEndOfFrame()); foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); for (int i = 0; i < 6; i++) { int sCard = hc.handCards[i]; player.handCardLayout.AddCard(sCard, true); MJCardGroup.TryDragCard(); } Game.SoundManager.PlayGet4Card(); } yield return(new WaitForSeconds(waitTime)); foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); for (int i = 6; i < 12; i++) { int sCard = hc.handCards[i]; player.handCardLayout.AddCard(sCard, true); MJCardGroup.TryDragCard(); } Game.SoundManager.PlayGet4Card(); } yield return(new WaitForSeconds(waitTime)); foreach (GameOperHandCardSyn hc in handCards) { MJPlayer player = Game.MJMgr.GetPlayerByPosition(hc.position); int sCard = hc.handCards[12]; player.handCardLayout.AddCard(sCard, true); MJCardGroup.TryDragCard(); } //yield 可能要yield。 //刚摸完牌的时候: if ((RoomMgr.playerGamingSyn != null) && ((RoomMgr.playerGamingSyn.wanfa & MJUtils.MODE_SHUAIJIUYAO) != 0)) { Game.UIMgr.PushScene(UIPage.JiuYaoPage); } else //跳过界面,直接准备完成 { Game.SocketGame.DoREADYL(1, 2); } if (tmpHui != -1) //根据传来的会牌值 判断是否要显示最后一张牌 { cardHui = tmpHui; MJCardGroup.ShowHuiCard(cardHui); EventDispatcher.DispatchEvent(MessageCommand.MJ_UpdatePlayPage); } }