Example #1
0
        private void Manager_OnDataMessageNoCopyReceived(object sender, PlayFabPlayer from, IntPtr buffer, uint bufferSize)
        {
            var messageType = PartyNetworkMessageHelper.GetTypeFromMessageWrapper(buffer, bufferSize);

            switch (messageType)
            {
            case PartyNetworkMessageEnum.GameState:
                OnGameStateReceived?.Invoke(PartyNetworkMessageHelper.GetDataFromMessageWrapper <GameState>(buffer, bufferSize));
                break;

            case PartyNetworkMessageEnum.Move:
                OnMoveReceived?.Invoke(from.EntityKey.Id, PartyNetworkMessageHelper.GetDataFromMessageWrapper <TicTacToeMove>(buffer, bufferSize));
                break;

            case PartyNetworkMessageEnum.MatchAbandonment:
                OnMatchAbandonment?.Invoke();
                break;
            }
        }
Example #2
0
        /// <summary>
        /// Handles the move played packet
        /// </summary>
        /// <param name="inMsg">The message to decode</param>
        private void HandleMoveReceived(NetIncomingMessage inMsg)
        {
            GameMove move = GameMove.Decode(inMsg, myKnownPlayers);

            OnMoveReceived?.Invoke(this, move);
        }