private void Active() { abandonMah = GameManager.Instance.abandonMah; if (abandonMah.player.photonPlayer.ID == photonPlayer.ID) { //下一位玩家取牌 PhotonNetwork.RaiseEvent(NEXTPLAYERGETMAH, null, true, null); } else { bool isCanWin = MahJongTools.IsCanHU(keepedMah, abandonMah.ID); bool isCanPon = MahJongTools.IsCanPon(keepedMah, abandonMah.ID, state); bool isCanGang = MahJongTools.IsCanGang(keepedMah, abandonMah.ID, state); btnWin.gameObject.SetActive(isCanWin); btnPon.gameObject.SetActive(isCanPon); btnGang.gameObject.SetActive(isCanGang); if (!isCanWin && !isCanPon && !isCanGang) { // 行动权交给下一个玩家 PhotonNetwork.RaiseEvent(ACTIVENEXT, null, true, null); } else { btnpass.gameObject.SetActive(true); } } }
/// <summary> /// 取牌 /// </summary> public void GetMahJong(bool isfirst) { int GotID = GameManager.Instance.GetMahjong(isfirst); bool isZimo = MahJongTools.IsCanHU(keepedMah, GotID); keepedMah.Add(GotID); GameObject d = Instantiate(Resources.Load("MahJong/" + GotID) as GameObject); d.name = GotID + ""; d.transform.SetParent(plane_keep.transform); d.transform.localScale = Vector3.one; d.transform.localRotation = Quaternion.identity; MahJongObject mah = d.GetComponent <MahJongObject>(); mah.ID = GotID; mah.CanCilcked = true; mah.player = this; gotMah = mah; state = STATE.playing; if (isZimo) { btnWin.gameObject.SetActive(isZimo); btnpass.gameObject.SetActive(true); } }
/// <summary> /// /// </summary> private void Update() { if (state == STATE.playing || activable) { if (timer.image.IsActive()) { return; } int[] param = { photonPlayer.ID }; photonView.RPC("ShowTimer", PhotonTargets.All, param); } if (activable) { abandonMah = GameManager.Instance.abandonMah; if (abandonMah.player.photonPlayer.ID == photonPlayer.ID) { //下一位玩家取牌 PhotonNetwork.RaiseEvent(NEXTPLAYERGETMAH, null, true, null); } else { bool isCanWin = MahJongTools.IsCanHU(keepedMah, abandonMah.ID); bool isCanPon = MahJongTools.IsCanPon(keepedMah, abandonMah.ID, state); bool isCanGang = MahJongTools.IsCanGang(keepedMah, abandonMah.ID, state); btnWin.gameObject.SetActive(isCanWin); btnPon.gameObject.SetActive(isCanPon); btnGang.gameObject.SetActive(isCanGang); if (!isCanWin && !isCanPon && !isCanGang) { // 行动权交给下一个玩家 PhotonNetwork.RaiseEvent(ACTIVENEXT, null, true, null); } else { btnpass.gameObject.SetActive(true); } } //行动完 activable = false; } }