Sdkbox Game Center signin

I am integrating Game Center and everything is working but I have one question regarding the sign-in functionality.

First, setting connect_on_start to true has no effect on iOS when the app is launched. It doesn’t do anything and I don’t receive any callbacks in SdkboxPlayListener#onConnectionStatusChanged() (is that flag only used on Google Play)?

Second, I want to avoid showing the Game Center sign-in dialog when the user is not logged in to Game Center at startup - it sucks for most people to have to go through that when they just want to play the game. Is there a way to call sdkbox::PluginSdkboxPlay::signin() but only attempt to sign in if the user is already connected to Game Center (so that the Game Center login dialog won’t show up) ?

One more observation related to the sdkbox play plugin (but unrelated to sign-in functionality):

  • when I call sdkbox::PluginSdkboxPlay::loadAllData(), the callback onGameData(…) gets called for every save separately and there is no way to know when it’s done calling back with all the saves. Is it safe to assume that they’re all going to callback within a couple seconds?

@nite Hi Nite, could you help me answer the above questions?

Thanks!

yes, only for Google Play Services.

         * connect_on_start:
         *    tells the plugin to make an automatic connection to Google Play Services on application startup.

nice suggestion. will fix in next release.

you can use a counter to do this. ++saves when saveGameData, --saves in callback onGameData.

Great. Is there a planned ETA? (I wonder if I can squeeze it into my release, it’d be great).

I’m not actually calling saveGameData in this case. I am only calling loadAllData and basically, for every Game Data entry that exists on iCloud, it calls back separately invoking onGameData for each. I don’t know when they’re all called back so that I can present the user with a list of all the game data’s that exist on iCloud.

PS. sorry, I used my other account but I’m the same user (praubic)

Any update on the fix ?

I check this feature again.
For iOS, we can not check the user GameCenter status. For example:
User logged in GameCenter in Setting panel, we can not get the user status.

If you have any document about get user gamecenter system status, plz paste here.
Thanks.

UP: u can add one GameCenter button for user login manually, not login automatically.

*UP2: or I can add an argument for sdkbox::PluginSdkboxPlay::signin();, If you do not want to show the GameCenter UI, call sdkbox::PluginSdkboxPlay::signin(false); And will call onConnectionStatusChanged(GPS_CONNECTION_ERROR);. Is it ok for you ?

Yes. Signin with a boolean parameter would work great - it would try to log in automatically but if it fails and requires a login, it would avoid showing the GameCenter UI right?

Yes. I would like to send you a developing plugin to test.
sdkbox-sdkboxplay_v2.3.17.5.tar.gz.zip (9.0 MB)

I tried the new package and calling signin(false) prevents showing the sign in dialog and it calls back with
onConnectionStatusChanged(GPS_CONNECTION_ERROR) if I’m not sign in which is correct. But, afterwards, when i call signin(true), the dialog does not display.

The way I was envisioning it was like this:

  1. Game starts up, call signin(false) to avoid forcing the dialog for people that don’t care about it
  2. If the user is not signed in, they can manually tap a button inside of the app to “connect to game center” which would call signin(true) - this doesn’t allow the signin dialog to appear anymore

Is it possible to allow the user to sign some time after signin(false) was called ?

Thanks for quick responses.

It seems that we can not sign-in more than one time.

Ok. Would you be able to paste the objective C code that your working with to access game center api if you dont mind ?

There is one more issue I noticed with this sdkboz plugin. Basically when i call loadAllGameData the first time after installing an app it never calls back even though saves exist. When i call it a second time it returns correctly. This is also the case with the deprecated loadAllData.

just important code, remove some :

-(void)signin:(BOOL)showLoginUI {
    __weak GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

    localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
        auto listener = SdkboxPlayWrapper::getInstance()->getListener();
        if (viewController != nil) {
            if (showLoginUI) {
                [self presentViewController:viewController animated:YES completion:nil];
            } else {
                if (listener) {
                    listener->onConnectionStatusChanged(GPS_CONNECTION_ERROR);
                }
            }
        }
        else {
            if ([GKLocalPlayer localPlayer].authenticated) {
                if (listener) {
                    listener->onConnectionStatusChanged(GPS_CONNECTED);
                }
            }
            else{
                if (listener) {
                    listener->onConnectionStatusChanged(GPS_CONNECTION_ERROR);
                }
            }
        }
    };
}

we’ll check it today.

For Gamecenter login, I think it’s better to change you game logic. Wait for user’s operation.

UPDATE:

Basically when i call loadAllGameData the first time after installing an app it never calls back even though saves exist. When i call it a second time it returns correctly.

my test steps:

  1. remove test app from my phone
  2. run app with Xcode
connection status change: 1000
onLoadGameData, name:key1, device:尹 的 iPhone, timestamp:1502356901, e:
onLoadGameData, name:key3, device:jimi 4s, timestamp:1514433901, e:

works with me.

I did some research and it appears you can save the viewController to be displayed at a later time.

You should show the view controller only when it is necessary for your player to proceed with the task at hand. It shouldn’t pop up at a weird time. That is why I save the view controller, so I can display later when it makes sense to.

Also, about the onLoadGameData issue - I tried it on another device and it worked fine, so:

  • iPhone 5c running 10.3.3 doesn’t work (every time the issue occurs after installing an app)
  • iPhone 4s 9.3.2 works fine

Thanks for your research, I make a new plugin here.
PluginSdkboxPlay.framework.zip (1.5 MB)

We need to test the iOS 10.x, feedback here.

Thanks,

I’ll let you know in 2 to 3 days. I’m away for the weekend.

Works very well. Thanks!

Can you let me know when you test the onLoadGameData issue on iOS 10 ?

we checked on iOS 10 Simulator, because we just have iOS9/11 Device.
The result is: can not test this function on iOS 10 Simulator.