CloudBuilder  2.8.4
Making social games is easy !
Public Member Functions | List of all members
CloudBuilder::CMatchEventListener Struct Referenceabstract

#include <CMatchManager.h>

Inheritance diagram for CloudBuilder::CMatchEventListener:
CotCHelpers::CRefClass

Public Member Functions

virtual void onMatchEventReceived (const CCloudResult *aEvent)=0
 
- Public Member Functions inherited from CotCHelpers::CRefClass
void Retain ()
 
void Release ()
 
 CRefClass (const CRefClass &other)
 
CRefClassoperator= (const CRefClass &other)
 

Additional Inherited Members

- Static Public Member Functions inherited from CotCHelpers::CRefClass
template<class T >
static T * Retain (T *t)
 
template<class T >
static T * Release (T *t)
 
- Public Attributes inherited from CotCHelpers::CRefClass
unsigned __ref_count
 

Detailed Description

Implement this to get notified of events related to matches.

Member Function Documentation

virtual void CloudBuilder::CMatchEventListener::onMatchEventReceived ( const CCloudResult aEvent)
pure virtual

Called when an event is received. The event has a type, which can be determined and processed as follows:

// Default to "" for non-null string comparison
const char *type = event->GetJSON()->GetString("type", "");
if (!strcmp(type, "match.move")) {
int change = event->GetJSON()->GetSafe("event")->GetSafe("move")->GetInt("change");
}

The following types of events may be received:

  • match.joined: broadcasted when a player joins a match. The player himself doesn't receive the event.
    {
    "type": "match.join",
    "event": {
    "_id": "548866edba0ec600005e1941",
    "match_id": "548866ed74c2e0000098db95",
    "playersJoined": [{
    "gamer_id": "548866ed74c2e0000098db94",
    "profile": {
    "displayName": "Guest",
    "lang": "en"
    }
    }]
    },
    "id": "9155987d-6322-46d4-9403-e90ab4ba5fa3"
    }
  • match.leave: broadcasted when a player leaves the match. The player himself doesn't receive the event.
    {
    "type": "match.leave",
    "event": {
    "_id": "548866edba0ec600005e1941",
    "match_id": "548866ed74c2e0000098db95",
    "playersLeft": [{
    "gamer_id": "548866ed74c2e0000098db94",
    "profile": {
    "displayName": "Guest",
    "lang": "en"
    }
    }]
    },
    "id": "9155987d-6322-46d4-9403-e90ab4ba5fa3"
    }
  • match.finish: broadcasted to all participants except the one who initiated the request when a match is finished.
    {
    "type": "match.finish",
    "event": {
    "_id": "54784d07a0fcf2000086457d",
    "finished": 1,
    "match_id": "54784d07f10c190000cb96e3"
    },
    "id": "d2f908d1-40d8-4f73-802e-fe0086bb6cd5"
    }
  • match.move: broadcasted when a player makes a move. The player himself doesn't receive the event.
    {
    "type": "match.move",
    "event": {
    "_id": "54784176a8df72000049340e",
    "player_id": "547841755e4cfe0000bf6907",
    "move": { "what": "changed" }
    },
    "id": "d0fb71c1-3cd0-4bbd-a9ec-29cb46cf9203"
    }
  • match.invite: received by another player when someone invites him to the match.
    {
    "type": "match.invite",
    "event": {
    "_id": "54784d07a0fcf2000086457d",
    "match_id": "54784d07f10c190000cb96e3"
    "inviter": {
    "gamer_id": "5487260cf45e5f84c7cd7223",
    "profile": {
    "displayName": "Guest",
    "lang": "en"
    }
    }
    },
    "id": "d2f908d1-40d8-4f73-802e-fe0086bb6cd9"
    }

The documentation for this struct was generated from the following file: