-
Notifications
You must be signed in to change notification settings - Fork 6
The prototype of Rocket.Chat "Game Center"
The Rocket.Chat will render a "Game Center" button on the tab bar of the top-right corner when the admin enables at least one game. If there is no Rocket.Chat game installed, this button will be hidden. It's the entry point to play Rocket.Chat games, as shown in the below:
In order to add game support for our current Apps.Engine framework. We can add a new key "category" in the app.json file. In this way, we can distinguish games from the installed Rocket.Chat apps much more easily and could put them in the Game Center.
app.json forward compatibility considerations: In terms of the previous version Rocket.Chat apps don't have category
key declared in the app.json
. With the following code, we avoid forward incompatibility issue:
const activatedGames = data.apps.filter((app) =>
app.status === 'manually_enabled'
&& app.category // if "category" key is undefined, we regard it as a non-game
&& app.category === 'game'
);
In this way, we can keep forward compatibility for the old version Rocket.Chat apps.
The "Game Center" renders all the activated games to a game list. The users could choose some interesting games to play here.