Skip to content

Event (Unity)

Arezoo Nazer edited this page Mar 13, 2022 · 3 revisions

What is the Event?

Game events such as collecting coins, unlocking new levels, etc which take place over a period of time. It is possible for game developers to promote the game events within the main pages of the CafeBazaar.

In the Event details page event descriptions, the remaining time, photos and videos related to the Event can be provided.

Implementations

To use the Event service features, first add the GameHub library to your project, according to the documentation guide. Installation and connection

I. Get a list of the active Events

You can get the list of your game’s active Events that are currently active in CafeBazaar by package name via the following command:


var result = await gameHub.GetEvents();
Debug.Log(result.ToString());

Output:

{
  "events": [
    {
      "eventId": "1", //String
      "startTimestamp": "1644654639", //String
      "endTimestamp": "1647335148" //String
    }
  ]
}

II. Notify Event done by user

If the user participated in the game Event and completed the steps, invoke the following command so that CafeBazaar will be informed about the Event done by the user. Note that before calling this command, the user must be logged in to her/his account in CafeBazaar.

Input: EventId (String): Event ID provided to you by CafeBazaar

var result = await gameHub.EventDoneNotify("1");
Debug.Log(result.ToString());

Output: Response code 200