Example #1
0
        void OnNewGameState(GameState gs)
        {
            players = gs.AllPlayers.PlayerList as List <PlayerNode>;
            DataEventArgs args = new DataEventArgs
            {
                Data = gs
            };

            OnGameStateReceived?.Invoke(this, args);
        }
Example #2
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;
            }
        }