/// <summary> /// 显示玩家手牌信息 /// </summary> /// <param name="panel"></param> /// <param name="user"></param> private void ShowOnesCards(DuifenPlayerPanel panel, ISFSObject user) { panel.CleanCards(); if (!user.ContainsKey("cards")) { return; } int[] cards = user.GetIntArray("cards"); YxDebug.LogArray(cards); int[] hidden = new int[2]; if (cards != null && cards.Length > 0) { if (user.ContainsKey("hidden")) { hidden = user.GetIntArray("hidden"); YxDebug.LogArray(cards); } int[] allCards = new int[hidden.Length + cards.Length]; if (panel.PlayerType != (int)PlayerGameType.Fold) { Array.Copy(hidden, 0, allCards, 0, hidden.Length); Array.Copy(cards, 0, allCards, hidden.Length, cards.Length); } DealerMgr.DealOnesPokers(allCards, panel); panel.ShowPointLabel(); } }
/// <summary> /// 刷新玩家数据 /// </summary> /// <param name="panel"></param> /// <param name="user"></param> private void RefreshSomeone(DuifenPlayerPanel panel, ISFSObject user) { if (panel.ReadyState) { if (user.ContainsKey("state") && user.GetBool("state")) { int localSeat = panel.LocalSeat; ReadyLocalSeatList.Add(localSeat); } } panel.ConnectMark.SetActive(!(user.ContainsKey("network") && user.GetBool("network"))); panel.ShowUserInfo(); if (user.ContainsKey("systemAuto")) { bool isAuto = user.GetBool("systemAuto"); panel.OnGetAutoInfo(isAuto); } if (!App.GetGameData <DuifenGlobalData>().IsGameing) //如果游戏结束,不接受数据 { return; } ShowOnesState(panel, user); ShowOnesBetVal(panel, user); ShowOnesCards(panel, user); }
public void PlayerBet(DuifenPlayerPanel playerPanel, int money, int depth = 99) { if (money <= 0) { return; } GameObject[] bets = CreatBetArray(money, 9, playerPanel.transform, depth); for (int i = 0; i < bets.Length; i++) { Bet bet = bets[i].GetComponent <Bet>(); bet.transform.parent = BetParent; BetParent.GetComponent <UIPanel>().depth = 4; //为下注筹码在牌上方飞出,设置层级关系 bet.BeginMove( bet.transform.localPosition, bet.GetTableRandomPos(), i * App.GetGameData <DuifenGlobalData>().BetSpeace, BetFinishedType.None, 0.3f, () => { gameObject.SetActive(true); bet.transform.parent = BetParent; BetParent.GetComponent <UIPanel>().depth = 2; //将层级重置回正常,为发牌时牌在桌面筹码上方飞出 }); } }
/// <summary> /// 发送一个人的手牌,无过程 /// </summary> /// <param name="pokerValues"></param> /// <param name="panel"></param> public void DealOnesPokers(int[] pokerValues, DuifenPlayerPanel panel) { Transform[] pokerTrans = panel.PokersTrans; for (int i = 0; i < pokerValues.Length; i++) { int cardValue = pokerValues[i]; var pokerCard = DealOnes(pokerTrans[i], cardValue, i); panel.UserBetPoker.AddPoker(pokerCard); pokerCard.SetDiPaiMark(i <= 1); } panel.ShowPointLabel(); }
/// <summary> /// 初始化玩家状态 /// </summary> /// <param name="panel"></param> /// <param name="user"></param> private void ShowOnesState(DuifenPlayerPanel panel, ISFSObject user) { if (user.ContainsKey("kaipai") && user.GetBool("kaipai")) { panel.ShowGameType(PlayerGameType.KaiPai); } if (user.ContainsKey("qili") && user.GetBool("qili")) { panel.ShowGameType(PlayerGameType.QiLi); } //没在游戏且有下注的玩家是弃牌玩家 if (!user.GetBool("state") && user.GetInt("ttxz") > 0) { panel.ShowGameType(PlayerGameType.Fold); panel.PlayerType = (int)PlayerGameType.Fold; panel.Mask.SetActive(true); } }
/// <summary> /// 显示玩家下注信息 /// </summary> /// <param name="panel"></param> /// <param name="user"></param> private void ShowOnesBetVal(DuifenPlayerPanel panel, ISFSObject user) { if (!user.ContainsKey("ttxz")) { return; } int betVal = user.GetInt("ttxz"); if (betVal <= 0) { return; } BetMgr.PlayerBet(panel, betVal); panel.PlayerBet(betVal); LaddyMgr.AllBetMoney += betVal; panel.ShowBetLabel(); panel.Coin = user.GetLong("ttgold") - betVal; }