How to integrate ios gamecenter!?

Hello.
How can one integrate to an iOS project with MOE?
Thanks,

Dear DangTB,

could you please be more specific? MOE provides bindings for GameKit under the apple.gamekit package in MOE 1.2.

Best Regards,
Gergely

Hi, here is code sample for authorization through GameCenter:


    GKLocalPlayer localPlayer = GKLocalPlayer.localPlayer();
        localPlayer.setAuthenticateHandler(new GKLocalPlayer.Block_setAuthenticateHandler() {
            @Override public void call_setAuthenticateHandler(UIViewController viewController, NSError nsError) {
                if (viewController != null) {
                    window.rootViewController().showDetailViewControllerSender(viewController, null);
                } else if (localPlayer.isAuthenticated()) {
                    localPlayer.generateIdentityVerificationSignatureWithCompletionHandler(new GKLocalPlayer.Block_generateIdentityVerificationSignatureWithCompletionHandler() {
                        @Override public void call_generateIdentityVerificationSignatureWithCompletionHandler(NSURL publicKeyUrl, NSData signature, NSData salt, long timestamp, NSError error) {
                           ... 
                            });
                        }
                    });
                } else { // canceled by user or GameCenter is disabled
                    UIAlertView alert = UIAlertView.alloc().init();
                    alert.setTitle("Info");
                    alert.setMessage("Game Center account is required");
                    alert.addButtonWithTitle("Ok");
                    alert.show();
                }
            }
        }); 

believe it’s good point to start

2 Likes

@sten How do you get the window to show the view controller?

EDIT: Sorry, I got it now.