Namespace: GameCenter

Cocoon.Multiplayer. GameCenter

This namespace provides an abstraction API for the Game Center Multiplayer Service.

Example

var GameCenter = Cocoon.Social.GameCenter;
var SocialGameCenter = gc.getSocialInterface();
var MultiplayerGameCenter = gc.getMultiplayerInterface();

SocialGameCenter.login(function(loggedIn, error) {
	if(loggedIn){
		var request = new Cocoon.Multiplayer.MatchRequest(2,2);
		var handleMatch = function(match, error){

		}
		...
		MultiplayerGameCenter.findMatch(request, handleMatch);
		...
	}
});

Methods

<static> addPlayersToMatch(matchRequest, matchRequest, callback)

Automatically adds players to an ongoing match owned by the user.

Parameters:
Name Type Description
matchRequest Cocoon.Multiplayer.MatchRequest

The parameters for the match.

matchRequest Cocoon.Multiplayer.Match

The match where new players will be added.

callback function

The callback function. Response parameters: error.

<static> cancelAutoMatch()

Cancels the ongoing automatch request.

<static> findAutoMatch(matchRequest, callback)

Sends an automatch request to join the authenticated user to a match. It doesn't present a system view while waiting to other players.

Parameters:
Name Type Description
matchRequest Cocoon.Multiplayer.MatchRequest

The parameters for the match.

callback function

The callback function. It receives the following parameters:

<static> findMatch(matchRequest, callback)

Presents a system View for the matchmaking and creates a new Match.

Parameters:
Name Type Description
matchRequest Cocoon.Multiplayer.MatchRequest

The parameters for the match.

callback function

The callback function. It receives the following parameters:

<static> getMatch() → {Cocoon.Multiplayer.Match}

Get the current match reference.

Returns:

The current match reference.

Type
Cocoon.Multiplayer.Match
Atomic Plugins - JavaScript Documentation by Ludei, DocStrap Copyright © 2012-2013
The contributors to the JSDoc3 and DocStrap projects.