Giter Site home page Giter Site logo

mahdi71 / atomic-plugins-googleplaygames Goto Github PK

View Code? Open in Web Editor NEW

This project forked from luckykat/atomic-plugins-googleplaygames

0.0 2.0 1.0 476 KB

Cocoon Social Interface for the Google Play Games Extension.

Home Page: http://atomic-plugins.com/

License: Mozilla Public License 2.0

JavaScript 39.23% Java 60.77%

atomic-plugins-googleplaygames's Introduction

Atomic Plugins for Google Play Games

This repo contains Cocoon Social Interface for the Google Play Games Extension designed using the Atomic Plugins paradigm.

You can contribute and help to create more awesome plugins.

##About Atomic Plugins

Atomic Plugins provide an elegant and minimalist API and are designed with portability in mind from the beginning. Framework dependencies are avoided by design so the plugins can run on any platform and can be integrated with any app framework or game engine.

#Provided APIs

##JavaScript API:

###API Reference

See API Documentation

###Introduction

Cocoon.Social.GooglePlayGames class provides an easy to use social interface for Google Play Games.

###Setup your project

Releases are deployed to Cordova Plugin Registry. You only have to install the desired plugins using Cordova CLI, CocoonJS CLI or Ludei's Cocoon.io Cloud Server.

	cordova plugin add cocoon-plugin-social-android-googleplaygames --variable APP_ID=the_app_id;

An additional parameter is required:

  • APP_ID: The id provided by google play games.

The following JavaScript files are included automatically:

cocoon_social.js cocoon_googleplaygames.js

###Example

var social;

if (Cocoon.getPlatform() === 'android') {
	
	social = Cocoon.Social.GooglePlayGames.init();
	social = Cocoon.Social.GooglePlayGames.getSocialInterface();

	var loggedIn = social.isLoggedIn();

	function loginSocial() {
	  if (!social.isLoggedIn()) {
	      social.login(function(loggedIn, error) {
	           if (error) {
	              console.error("login error: " + error.message);
	           }
	           else if (loggedIn) {
	              console.log("login succeeded");
	           }
	           else {
	              console.log("login cancelled");
	           }
	      });
	  }
	}

	loginSocial();

    social.submitAchievement(achievementID, function(error){
    	if (error)
        	console.error("submitAchievement error: " + error.message);
	});

	social.showAchievements(function(error){
    	if (error)
        	console.error("showAchievements error: " + error.message);
	});

	social.submitScore( score, function(error){
		if (error)
    		console.error("submitScore error: " + error.message);
	});

	social.showLeaderboard(function(error){
		if (error)
 			console.error("showLeaderbord error: " + error.message);
	});

    social.logout();
}

#License

Mozilla Public License, version 2.0

Copyright (c) 2015 Ludei

See MPL 2.0 License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.