public static object DeserializeBombInfo(byte[] bytes)
            {
                Vector3      startPos  = Vector3.zero;
                Vector3      direction = Vector3.zero;
                PhotonPlayer shooter   = PhotonNetwork.player;
                int          shooterID = 0;
                Vector3      speed     = Vector3.zero;
                int          id        = 0;

                int index = 0;

                ExitGames.Client.Photon.Protocol.Deserialize(out startPos.x, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out startPos.y, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out startPos.z, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out direction.x, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out direction.y, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out direction.z, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out shooterID, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out speed.x, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out speed.y, bytes, ref index);
                ExitGames.Client.Photon.Protocol.Deserialize(out speed.z, bytes, ref index);

                ExitGames.Client.Photon.Protocol.Deserialize(out id, bytes, ref index);

                shooter = shooter.Get(shooterID);

                BombInfo bombInfo = new BombInfo(startPos, direction, shooter, speed, id);

                return(bombInfo);
            }
Exemple #2
0
        /// <summary>
        /// 事件处理
        /// </summary>
        /// <param name="eventCode">事件编码</param>
        /// <param name="content">内容信息</param>
        /// <param name="senderId">发送者</param>
        private void OnEventCall(byte eventCode, object content, int senderId)
        {
            #region 过滤条件  找到自己在其他客户端上的投影玩家
            if (photonPlayer.ID != senderId)
            {
                return;
            }
            #endregion

            #region 显示自己牌的数量
            if (eventCode == SHOWPAITOOTHER)
            {
                ShowUI();
            }

            #endregion

            #region 显示计时器

            if (eventCode == ACTIVENEXT || eventCode == NEXTPLAYERGETMAH)
            {
            }
            #endregion

            #region 打牌
            if (eventCode == DAPAICODE)
            {
                int mahID = (int)content;

                Debug.Log(photonPlayer.Get(senderId).NickName + "打牌 " + mahID);
                MahJongObject mahObj = Abandan(mahID);

                GameManager.Instance.abandonMah = mahObj;
            }

            #endregion

            #region 碰牌
            if (eventCode == PONMAH)
            {
                Debug.Log("碰牌 ");
                Pon();
            }
            #endregion

            #region 杠牌
            if (eventCode == GANGPAI)
            {
                Debug.Log("杠牌 ");
                Gang();
            }

            #endregion

            #region 过滤条件 找到下一个玩家为本地玩家(而非投影玩家)的自己的投影
            if (!nextPlayer.photonPlayer.IsLocal)
            {
                return;
            }
            #endregion
            if (eventCode == DAPAICODE)
            {
                ActiveNext();
            }

            #region  一个玩家行动
            if (eventCode == ACTIVENEXT)
            {
                ActiveNext();
            }
            #endregion

            #region  一位玩家取牌
            if (eventCode == NEXTPLAYERGETMAH)
            {
                nextPlayer.GetMahJong(true);
            }
            #endregion
        }