/// <summary>"提示"按钮事件 /// </summary> public void ClickBtnTripPokerEnvet() { if (PokerRules.SelectPoker(player[curPlayer].pokerList, PokerManage.maxPokerValue, PokerManage.lastPoker)) { if (PokerManage.waitPoker.Count == 0) { } for (int i = 0; i < PokerManage.waitPoker.Count; i++) { PokerManage.waitPoker[i].ChangeSelect(); } PokerManage.waitPoker.Clear(); } else { ClickBtnPassPokerEvent(); } }
void Update() { if (Input.GetMouseButtonDown(1)) { ClickBtnOutPokerEvent(); } switch (state) { case GameState.Empty: break; case GameState.GameStart: //游戏开始发牌(协程动画) StartCoroutine(DealPoker()); //开启发牌协程后为空等待 state = GameState.Empty; break; ///抢地主阶段 case GameState.GrabLandLord: timeCanvas.GetComponent <Canvas>().enabled = true; ShowTime.text = (int)(waitTime - time + 1) + ""; //当前(上一把)没有人是赢家 if (curPlayer == -1) { //随机玩家 //curPlayer = Random.Range(0, player.Length); curPlayer = 0; } timeCanvas.SetParent(player[curPlayer].transform.Find("Time")); time += Time.deltaTime; //电脑随机选择抢不抢地主 if (player[curPlayer].playerType != PlayerType.player) { if (time >= 1) { //有几率选择抢地主 if (Random.Range(0, 3) < 1.5f) { ClickBtnIsGrabEvent(); } else { ClickBtnNoGrabEvent(); } time = 0; } } else { //玩家抢地主按钮控制 View_GrabLandLord.SetActive(true); } //超过等待时间自动不抢 if (time >= waitTime) { ClickBtnNoGrabEvent(); } break; ///出牌阶段 case GameState.OutPoker: timeCanvas.SetParent(player[curPlayer].transform.Find("Time")); //如果当前玩家是最大 if (maxPlayerIndex == curPlayer) { //牌值为空,为准备下一次随意出牌 PokerManage.maxPokerValue = -1; //牌型为空,为准备下一次随意出牌 PokerRules.SelectPokerAct = null; //上次轮最大牌为空 PokerManage.lastPoker.Clear(); ShowTime.text = "oo"; } else { ShowTime.text = (int)(waitTime - time + 1) + ""; } time += Time.deltaTime; //如果玩家是电脑 if (player[curPlayer].playerType != PlayerType.player) { //等待时间 if (time > 0.5f) { //如果是同一家不出牌 if (player[maxPlayerIndex].roleType == player[curPlayer].roleType && curPlayer != maxPlayerIndex) { ClickBtnPassPokerEvent(); } //电脑找牌 else if (PokerRules.SelectPoker(player[curPlayer].pokerList, PokerManage.maxPokerValue, PokerManage.lastPoker)) { ClickBtnOutPokerEvent(); } else { ClickBtnPassPokerEvent(); } time = 0; } } else { //玩家准备出牌,显示出牌按钮 View_OutAndPassPoker.SetActive(true); } //等待时间自动过牌 并且 当前最大没有时间限制 if (time >= waitTime && maxPlayerIndex != curPlayer) { //等待时间内未出牌时,过牌 ClickBtnPassPokerEvent(); } break; case GameState.GameOver: GameOver(); break; default: break; } }