Search code examples
androidgoogle-play-servicesgoogle-play-games

How to determine if Local Player won a Google Play TurnBasedMatch?


I am making an Android game using Xamarin.Android and MonoGame. I am using Google Play's TurnBasedMatch API to handle the multiplayer aspect of the game.

At the end of a match I would like to determine if the local player (the player who is logged into Google Play on the device) has won the match. Basically, I want to be able to say "You Win!" or "You Lose!" appropriately.

Suprisingly I haven't been able to find anything in the TurnBasedMatch library to find out if I won the match. I am sure I must be missing something obvious. Has anyone figured out a way to determine this information?

Thanks!!


Solution

  • I was able to work around this limitation by deduction. My game is only 2 players, so I check the name of my opponent with getDescriptionParticipant ("Get the participant representing the primary opponent in the match.") and if that is not the name of the winning participant (which my game stores) then I know that the local player has won.