Android Open Source - Layrd Android Launcher






From Project

Back to project page Layrd.

License

The source code is released under:

MIT License

If you think the Android project Layrd listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.Voltronics.game.android;
//from   w  w  w .  j  av  a  2 s .  c  o m
import android.content.Intent;
import android.os.Bundle;

import com.Voltronics.game.LayrdGame;
import com.Voltronics.game.LayrdGoogleGameInterface;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.games.Games;
import com.google.example.games.basegameutils.GameHelper;


public class AndroidLauncher extends AndroidApplication implements LayrdGoogleGameInterface{
  
  GameHelper mHelper;
  GoogleApiClient mClient;
  
  
  @Override
  protected void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    
      mHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
    initialize(new LayrdGame(this), config);
  
      // enable debug logs (if applicable)
      GameHelper.GameHelperListener listener = new GameHelper.GameHelperListener() {
          @Override
          public void onSignInSucceeded() 
          {
              // handle sign-in succeess
            //unlockAchievementGPGS("CgkI78movo8SEAIQAQ");

          }
          @Override
          public void onSignInFailed() {
              // handle sign-in failure (e.g. show Sign In button)
          }

      };
      mHelper.setup(listener);
  }
  
  @Override
  protected void onStart() {
      super.onStart();
     mHelper.onStart(this);
  }

  @Override
  protected void onStop() {
      super.onStop();
      mHelper.onStop();
  }

  @Override
  protected void onActivityResult(int request, int response, Intent data) {
      super.onActivityResult(request, response, data);
      mHelper.onActivityResult(request, response, data);
  }

  @Override
  public boolean getSignedInGPGS() {
    // TODO Auto-generated method stub
    return mHelper.isSignedIn();
  }

  @Override
  public void loginGPGS() {
    // TODO Auto-generated method stub
    try{
      runOnUiThread(new Runnable(){
        public void run(){
          mHelper.beginUserInitiatedSignIn();
        }
      });
      
    }catch (final Exception ex)
    {
      
    }
    
  }

  @Override
  public void submiteScoreGPGS(int score) {
    // TODO Auto-generated method stub
        Games.Leaderboards.submitScore(mHelper.getApiClient(), "CgkI5qzL-98HEAIQBQ", score);
    
  }

  @Override
  public void getLeaderboardGPGS() {
    // TODO Auto-generated method stub
    startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mHelper.getApiClient(), "CgkI5qzL-98HEAIQBQ"), 10);
    
  }

  @Override
  public void getAchievementsGPGS() {
    // TODO Auto-generated method stub
    
    startActivityForResult(Games.Achievements.getAchievementsIntent(mHelper.getApiClient()), 1);
    
  }

  @Override
  public void logOutGPGS() {
    // TODO Auto-generated method stub
    mHelper.signOut();
    
  }
  
  @Override
  public void unlockAchievementGPGS(String achievementId) {
    Games.Achievements.unlock(mHelper.getApiClient(), achievementId);
  }
}




Java Source Code List

com.Voltronics.game.GameObject.java
com.Voltronics.game.LayrdGame.java
com.Voltronics.game.LayrdGoogleGameInterface.java
com.Voltronics.game.LayrdGraphics.java
com.Voltronics.game.LayrdInput.java
com.Voltronics.game.LayrdLogic.java
com.Voltronics.game.LayrdPhysics.java
com.Voltronics.game.LayrdScreenGame.java
com.Voltronics.game.LayrdScreenMainMenu.java
com.Voltronics.game.LayrdSound.java
com.Voltronics.game.LayrdWorld.java
com.Voltronics.game.Player.java
com.Voltronics.game.TutorialScreen.java
com.Voltronics.game.android.AndroidLauncher.java
com.google.example.games.basegameutils.BaseGameActivity.java
com.google.example.games.basegameutils.GameHelperUtils.java
com.google.example.games.basegameutils.GameHelper.java