Version 5.0

GameCenterManager events refactored:

  • C# Actons added for all GameCenterManager events

  • Event results unified

  • Fail events removed, now you can check if an event was failed with event result

For example, if, in the older version, you had 2 events for Authentication

like: GAME_CENTER_PLAYER_AUTHENTICATED and GAME_CENTER_PLAYER_AUTHENTIFICATION_FAILED.

Now there is only one event GAME_CENTER_PLAYER_AUTHENTICATED all similar fail events are removed.

 

All Events now contains result ISN_Result as data. Or classes extended from ISN_Result. For example:

GAME_CENTER_USER_INFO_LOADED  contains ISN_UserInfoLoadResult

GAME_CENTER_LEADER_BOARD_SCORE_LOADED contains ISN_PlayerScoreLoadedResult

GAME_CENTER_ACHIEVEMENT_PROGRESS contains ISN_AcheivmentProgressResult

 

Here is demonstration of new approach how me can listen for events and parse the result. We will use authentication events as an example

Subscribing on event (now we do not need to subscribe to the failed event):

GameCenterManager.dispatcher.addEventListener (GameCenterManager.GAME_CENTER_PLAYER_AUTHENTICATED, OnAuth);

Getting the result

private void OnAuth(CEvent e) {

    ISN_Result result = e.data as ISN_Result;

    if (result.IsSucceeded) {

        Debug.Log("Player Authed");

    } else {

        Debug.Log("Player Authed Failed");

    }

}

 

And the same but using the C# Actions:

 

Subscribing on event

GameCenterManager.OnAuthFinished += OnAuthFinished;

Getting the result

void OnAuthFinished (ISN_Result res) {
    if (res.IsSucceeded) {
        Debug.Log("Player Authed");
    } else {
        Debug.Log("Player Authed Failed");
    }
}