Giter VIP home page Giter VIP logo

games_services's Introduction

A Flutter plugin to support game center and google play games services.

Screenshot

iOS

Android

Usage

Sign in:

To sign in the user. You need to call the sign in before
making any action (like sending a score or unlocking an achievement).
GamesServices.signIn();

Show achievements:

To show the achievements screen.
GamesServices.showAchievements();

Show leaderboards:

To show the leaderboards screen.
GamesServices.showLeaderboards(iOSLeaderboardID: 'ios_leaderboard_id');
Note: You need to pass the leaderboard id for iOS, for android it's not required.

Submit score:

To submit a Score to specific leader board.
-The Score class takes three parameters:
-androidLeaderboardID: the leader board id that you want to send the score for in case of android.
-iOSLeaderboardID the leader board id that you want to send the score for in case of iOS.
-value the score.

GamesServices.submitScore(score: Score(androidLeaderboardID: 'android_leaderboard_id',
                                       iOSLeaderboardID: 'ios_leaderboard_id',
                                       value: 5));

note: You need to pass the leaderboard id for iOS in case of iOS and the leaderboard id for android in case of android.

Unlock achievement:

To unlock an Achievement.
The Achievement takes three parameters:
-androidID the achievement id for android.
-iOSID the achievement id for iOS.
-percentComplete the completion percent of the achievement, this parameter is optional in case of iOS.

GamesServices.unlock(achievement: Achievement(androidID: 'android_id',
                                              iOSID: 'ios_id',
                                              percentComplete: 100)); 

Note: You need to pass the achievement id for iOS in case of iOS and the achievement id for android in case of android. the percentComplete is required in case of iOS but not android.

Installing

Simply add the following line to your pubspec.yaml file:

dependencies:
  games_services: any       # <-- Add this line

games_services's People

Contributors

abedalkareem avatar josegranja avatar

Watchers

 avatar  avatar

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.