Sub ShowLeaderboard(Page As Page, BoardId As String, viewState As Int)
Dim gc As NativeObject
gc = gc.Initialize("GKGameCenterViewController").RunMethod("new", Null)
gc.SetField("leaderboardCategory", BoardId)
gc.SetField("viewState", viewState)
Dim ac As NativeObject
ac = ac.Initialize("GKLeaderboard").RunMethod("new", Null)
ac.SetField("playerScope", 1)
Log(ac.GetField("playerScope"))
Dim del As NativeObject
del = del.Initialize("B4IGameCenterViewControllerDelegate").RunMethod("new", Null)
gc.SetField("gameCenterDelegate", del)
Dim native As NativeObject = Page
native.RunMethod("presentViewController:animated:completion:", Array(gc, True, Null))
End Sub
#if OBJC
@end
@interface B4IGameCenterViewControllerDelegate :NSObject<GKGameCenterControllerDelegate>
@end
@implementation B4IGameCenterViewControllerDelegate
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController {
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
#End If