Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
        /// <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;
            }
        }