Last active
July 10, 2021 11:06
-
-
Save akarsh1995/248448a73a76ef05f4176224f3746150 to your computer and use it in GitHub Desktop.
mxjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.gameManager = { | |
| onGameInit: function () { | |
| return { | |
| userId: "1", | |
| gameId: "2", | |
| roomId: "3", | |
| highestScore: 90, | |
| lastLevel: 0, // user's current level | |
| gameMode: "score", // "score" or "win" | |
| isFirstOpen: true, // true or false | |
| roomType: "free_room" // "free_room" or "priced_room" | |
| } | |
| }, | |
| onGameStart: function() { console.log("onGameStart is called")}, | |
| getGameSettings: function() { console.log("getGameSettings is called")}, | |
| onTrack: function() {}, | |
| onError: function() {}, | |
| onCheckRewardedVideoAds: function() { console.log("onCheckRewardedVideoAds is called")}, | |
| onShowRewardedVideoAds: function() { console.log("onShowRewardedVideoAds is called")}, | |
| onGameOver: function() {} | |
| } | |
| // read from local storage | |
| try { | |
| if (typeof gameManager !== 'undefined') { | |
| const gameConfigString = gameManager.onGameInit() | |
| const config = JSON.parse(gameConfigString) | |
| console.log(config) | |
| } | |
| } catch (e) { | |
| console.log("Error Parsing Config") | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment