npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

construct-play-games

v1.1.4

Published

Cordova plugin for google play games in the construct game runtime

Downloads

12

Readme

Google Play Games for cordova

This plugin uses the latest API methods as of the 12/02/2018.

This is intended to be used with the Construct 3 runtime, but should work with any cordova project.

All methods can be found as part of cordova.plugins.ConstructPlayGames.

Installation

	cordova plugin add construct-play-games --variable APP_ID=[ game identifier ]

Login related methods

setCallback(Function callback)

Register a callback method for updates to the login state

	const play = cordova.plugins.ConstructPlayGames;
	
	play.setCallback((err, isLoggedIn) => {
		if (!err)
			console.log(isLoggedIn ? "Logged in" : "Logged out");
	});

silentSignIn()

Login without prompting the user ( they must have previously signed in ).

	play.silentSignIn();

signin()

Attempt a normal login, this will display a dialog ( briefly ) even if the user has already logged in.

	play.signin();

signout()

Logout of the current account.

	play.signout();

Native dialog methods

showLeaderboards(optional Function callback)

Show the native leaderboard dialog with all leaderboards

	play.showLeaderboards()
	// OR
	play.showLeaderboards(err => {
		if(!err)
			console.log("Did show leaderboards");
	});

showLeaderboard(Object parameters, optional Function callback)

Show the native leaderboard dialog with a specific leaderboard

	const params = {
		leaderboardId: "my_leaderboard_id"
	};
	
	play.showLeaderboard(params)
	// OR
	play.showLeaderboards(params, err => {
		if(!err)
			console.log("Did show leaderboards");
	});

showAchievements(optional Function callback)

Show the native achievement dialog with all achievements

	play.showAchievements()
	// OR
	play.showAchievements(err => {
		if(!err)
			console.log("Did show achievements");
	});

Leaderboard manipulation

getHiScores(Object parameters, Function callback)

Get the high scores for the selected leaderboard as a JS object. Use the optional reload option to bypass the local cache.

	const params = {
		leaderboardId: "my_leaderboard_id",
		reload: true
	};

	play.getHiScores(params, (err, obj) => {
		if(!err)
			console.log("high scores", obj);
			
		/*
		 *	obj = {
		 *		"items": [
		 *			{
		 *				"player": {
		 *					"displayName": String,
		 *					"iconURI": String
		 *				},
		 *				"scoreValue": Int,
		 *				"formattedScore": String,
		 *				"scoreTag": String,
		 *				"scoreRank": Int,
		 *				"formattedScoreRank": String
		 *			}
		 *		],
		 *		"playerScore": null
		 *	}
		 */
	});

submitScore(Object parameters, optional Function callback)

Submit a highscore to the selected leaderboard.

	const params = {
		leaderboardId: "my_leaderboard_id",
		score: 42
	};
	
	play.submitScore(params);
	// OR
	play.submitScore(params, err => {
		if(!err)
			console.log("successfully submitted score");
	});

Achievement manipulation

getAchievements(optional Object parameters, Function callback)

Get the achievements for the app as a JS object. Use the optional reload option to bypass the local cache.

	const params = {
		reload: true
	};
	
	play.getAchievements(params, (err, obj) => {
		if(!err)
			console.log("achievements", obj);
			
		/*
		 *	obj = {
		 *		"items": [
		 *			{
		 *				"id": String,
		 *				"state": "Int"
		 *				"name": String,
		 *				"description": String,
		 *				"type": Int,
		 *				"currentSteps": Int,
		 *				"totalSteps": Int,
		 *				"revealedUrl": String,
		 *				"unlockedUrl": String
		 *			}
		 *		]
		 *	}
		 */
	});

incrementAchievement(Object parameters, optional Function callback)

Increment the selected achievement by the given number of steps.

	const params = {
		achievementId: "my_achievement_id",
		numSteps: 42
	};
	
	play.incrementAchievement(params);
	// OR
	play.incrementAchievement(params, err => {
		if(!err)
			console.log("successfully incremented achievement");
	});

setStepsAchievement(Object parameters, optional Function callback)

Set the current step value of the selected achievement.

	const params = {
		achievementId: "my_achievement_id",
		numSteps: 42
	};
	
	play.setStepsAchievement(params);
	// OR
	play.setStepsAchievement(params, err => {
		if(!err)
			console.log("successfully set achievement steps");
	});

revealAchievement(Object parameters, optional Function callback)

Reveal the selected achievement.

	const params = {
		achievementId: "my_achievement_id"
	};
	
	play.revealAchievement(params);
	// OR
	play.revealAchievement(params, err => {
		if(!err)
			console.log("successfully revealed achievement");
	});

unlockAchievement(Object parameters, optional Function callback)

Unlock the selected achievement.

	const params = {
		achievementId: "my_achievement_id"
	};
	
	play.unlockAchievement(params);
	// OR
	play.unlockAchievement(params, err => {
		if(!err)
			console.log("successfully unlocked achievement");
	});