/// <summary>
        /// GUI displayed when the user is authenticated and we have an inactive match loaded
        /// </summary>
        private void authenticatedWithInactiveMatchGUI()
        {
            GUILayout.Label("Match Status: " + currentMatch.status + ", Description: " + currentMatch.matchDescription);

            // we have this check here to work around what appears to be a Play bug on Android. Sometimes it is possible to get
            // a match in a state where it is our turn even though the match is completed. We need to get that status properly set
            // to MatchCompleted so we call finishMatch to do so.
            if (currentMatch.isLocalPlayersTurn)
            {
                if (GUILayout.Button("Finish Match Without Data"))
                {
                    GPGTurnBasedMultiplayer.finishMatchWithoutData(currentMatch.matchId);
                    currentMatch = null;
                }
            }
            else
            {
                if (currentMatch.canRematch)
                {
                    if (GUILayout.Button("Rematch"))
                    {
                        GPGTurnBasedMultiplayer.rematch(currentMatch.matchId);
                        currentMatch = null;
                    }
                }
            }

            dismissMatchGuiButton();
        }
        /// <summary>
        /// GUI displayed when the user is authenticated and we have an active match loaded
        /// </summary>
        private void authenticatedWithActiveMatchGUI()
        {
            GUILayout.Label("Match Status: " + currentMatch.status + ", Description: " + currentMatch.matchDescription);

            // is it our turn?
            if (currentMatch.isLocalPlayersTurn)
            {
                GUILayout.Label("It is Our Turn");

                if (GUILayout.Button("Take Turn"))
                {
                    GPGTurnBasedMultiplayer.takeTurn(currentMatch.matchId, getMatchDataWithNewDataAppended(), getPendingParticipantId());
                    currentMatch = null;
                }


                if (GUILayout.Button("Finish Match Without Data"))
                {
                    GPGTurnBasedMultiplayer.finishMatchWithoutData(currentMatch.matchId);
                    currentMatch = null;
                }


                if (GUILayout.Button("Finish Match With Data"))
                {
                    var results = new List <GPGTurnBasedParticipantResult>();

                    // we will need to create a GPGTurnBasedParticipantResult for each player in the match
                    // for demonstration purposes we will just set the result to Tie
                    foreach (var player in currentMatch.players)
                    {
                        results.Add(new GPGTurnBasedParticipantResult(player.participantId, GPGTurnBasedParticipantResultStatus.Tie));
                    }

                    GPGTurnBasedMultiplayer.finishMatchWithData(currentMatch.matchId, getMatchDataWithNewDataAppended(), results);
                    currentMatch = null;
                }


                if (GUILayout.Button("Leave Match During Turn"))
                {
                    GPGTurnBasedMultiplayer.leaveDuringTurn(currentMatch.matchId, getPendingParticipantId());
                    currentMatch = null;
                }

                dismissMatchGuiButton();
            }
            else
            {
                GUILayout.Label("It is Not Our Turn");

                if (GUILayout.Button("Leave Match Out of Turn"))
                {
                    GPGTurnBasedMultiplayer.leaveOutOfTurn(currentMatch.matchId);
                    currentMatch = null;
                }

                dismissMatchGuiButton();
            }
        }
        // this is only broken out due to it being present 3 times
        void dismissMatchGuiButton()
        {
            if (GUILayout.Button("Dismiss Match"))
            {
                GPGTurnBasedMultiplayer.dismissMatch(currentMatch.matchId);
                currentMatch = null;
            }


            if (GUILayout.Button("Clear Current Local Match"))
            {
                currentMatch = null;
            }
        }
 void matchChanged(GPGTurnBasedMatch match)
 {
     // in this simple demo, any time we get a matchChangedEvent we load it up immediately which updates the GUI
     currentMatch = match;
 }
 void authenticationSucceededEvent(string playerId)
 {
     currentMatch = null;
 }
 void matchEndedEvent( GPGTurnBasedMatch match )
 {
     Debug.Log( "matchEndedEvent" );
     Debug.Log( match );
 }
 void matchChanged( GPGTurnBasedMatch match )
 {
     // in this simple demo, any time we get a matchChangedEvent we load it up immediately which updates the GUI
     currentMatch = match;
 }
        // this is only broken out due to it being present 3 times
        void dismissMatchGuiButton()
        {
            if( GUILayout.Button( "Dismiss Match" ) )
            {
                GPGTurnBasedMultiplayer.dismissMatch( currentMatch.matchId );
                currentMatch = null;
            }

            if( GUILayout.Button( "Clear Current Local Match" ) )
            {
                currentMatch = null;
            }
        }
 void matchEndedEvent(GPGTurnBasedMatch match)
 {
     Debug.Log("matchEndedEvent");
     Debug.Log(match);
 }