|
Here us the complete GC code that I use for saving scores:
When game starts, I attempt to sign the gamer in with:
Guide.IsVisible = true;
Guide.ShowSignIn(1, true);
Then, I call the following SaveScoreToIosGameCenter() function when I want to submit the scores:
public static bool IsSignedIntoGameCenter() {
if ( ( Gamer.SignedInGamers.Count > 0 ) && ( Gamer.SignedInGamers[0].IsSignedInToLive ) ) {
return true;
}
return false;
}
public static SignedInGamer GetSignedInGamer() {
if (IsSignedIntoGameCenter()) {
return Gamer.SignedInGamers[0];
}
return null;
}
public static void SaveScoreToIosGameCenter(String category, long score) {
if (IsSignedIntoGameCenter())
{
var gamer = GetSignedInGamer();
if (gamer != null) {
gamer.UpdateScore(category, score);
}
}
}
|