I've integrated Google Play Game Services in my game. I've put a login button and leaderboard & achievement buttons. I've coded it so that only when CocoonJS -> On Login Succeeded then leaderboard and achievement buttons are enabled. The problem is that suppose a player logs into Google Play Game Services, now leaderboard and achievement buttons are enabled. Now he quits the game and re-opens it. He is already logged into the game (Welcome XYZ appears at the time of ludei splashscreen), but inside the game, the leaderboard and achievement buttons are disabled because It could not detect that player is already logged in. So, the player has to click the LOGIN button. Then, the other buttons are unlocked.
I tried to do this:
On start of layout: CocoonJS -> On Login Succeeded: Set global variable "loggedIn" to 1. If loggedIn is 1 then enable leaderboard and achievement buttons.
But it is not working. Any help?
I will post some screenshots of what you gotta do. It's not much. Just keep in mind that if you ever install an updated version of C2 or cocoonjs plugin, you will have to add the lines again or you could have issues. And make sure to back up the original edittime.js and runtime.js files before you tinker.
Develop games in your browser. Powerful, performant & highly capable.
Step 1: Navigate to the cocoonjs plugin folder (should be at --> C:\Program Files\Construct 2\exporters\html5\plugins\cocoonjsads)
Step 2: Make backup copies of both edittime.js and runtime.js.
Step 3: Open edittime.js and runtime.js (I use dreamweaver, but you can also use notepad).
Step 4: Follow the pictures below (the lines of code are in bold below the pics for an easy copy/paste).
AddCondition(31, 0, "Is Signed In", "Social", "Is Signed In", "True if the user is currently logged into the Google Play.", "isSignedIn");
this.isSignedIn = false;
Cnds.prototype.isSignedIn = function ()
I hope this makes sense. You may have to make another copy of the 2 files onto your desktop and edit the files from there (in my case I cannot make edits directly from the cocoonjsads folder).
Hey ! I saw that you have a working Google play leaderboard exported using cocoonjs right ? I am facing problem with Leaderboard, it doesn't show up on my Apk. It only makes login, i can't submit or retrieve highscore. Any help will be appreciated. Ciao !
I Got my problem Fixed ! it was something in the developer console