Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
  JavaGaming.org - Pastebin



Author: imbrendino (posted 2014-05-03 16:33:13, viewed 44 times)

1  
package com.me.jumper;  import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.RelativeLayout;  import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.me.jumper.gameservices.ActionResolver; import com.chartboost.sdk.*; import com.chartboost.sdk.Chartboost.CBAgeGateConfirmation; import com.chartboost.sdk.Model.CBError.CBClickError; import com.chartboost.sdk.Model.CBError.CBImpressionError; import com.jirbo.adcolony.*; import com.google.android.gms.ads.*; import com.google.android.gms.games.Games; import com.google.example.games.basegameutils.GameHelper; import com.google.example.games.basegameutils.GameHelper.GameHelperListener;    public class MainActivity extends AndroidApplication implements GameHelperListener, ActionResolver{     private GameHelper mHelper;        private Jumper jumper;    private Chartboost cb;    private AdColonyVideoAd ad;    private AdView adView;            public MainActivity(){           }        @Override     public void onCreate(Bundle savedInstanceState) {                     mHelper= new GameHelper(this, GameHelper.CLIENT_ALL);       mHelper.enableDebugLog(true);         super.onCreate(savedInstanceState);                        // Create the layout         RelativeLayout layout = new RelativeLayout(this);          // Do the stuff that initialize() would do for you         requestWindowFeature(Window.FEATURE_NO_TITLE);         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,                          WindowManager.LayoutParams.FLAG_FULLSCREEN);         getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);                   // Create the libgdx View         AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();         cfg.useGL20 = true;         jumper = new Jumper(this);         RelativeLayout.LayoutParams gameViewParams =                 new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,                          RelativeLayout.LayoutParams.WRAP_CONTENT);         gameViewParams.topMargin = AdSize.BANNER.getHeight();         System.out.println("ciaoooooooooo1");         mHelper.setup(this);         System.out.println("ciaoooooooooo2");         View gameView = initializeForView(jumper, cfg);          // Create and setup the AdMob view         adView = new AdView(this);         adView.setAdUnitId(“xxxxxxxxxxxxxxxxxxxxxxxxx”);         adView.setAdSize(AdSize.BANNER); // Put in your secret key here         adView.loadAd(new AdRequest.Builder().build());          // Add the libgdx view         layout.addView(gameView,gameViewParams);          // Add the AdMob view         RelativeLayout.LayoutParams adParams =                  new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,                                  RelativeLayout.LayoutParams.WRAP_CONTENT);         adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);         adParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);                   layout.addView(adView, adParams);                                                                         // Configure Chartboost                   this.cb = Chartboost.sharedChartboost();         String appId = “xxxxxxxxxxx”;         String appSignature = “xxxxxxxxxxx”;         CBPreferences.getInstance().setImpressionsUseActivities(true);         this.cb.onCreate(this, appId, appSignature, this.chartBoostDelegate);                  AdColony.configure(this, "version:3.0,store:google", “xxxxxxxxxxxxx”, “xxxxxxxxxx”);         ad = new AdColonyVideoAd();                                                   // Hook it all up         setContentView(layout);                       }        @Override    public void onStart(){       super.onStart();        mHelper.onStart(this);       this.cb.onStart(this);         // Notify the beginning of a user session. Must not be dependent on user actions or any prior network requests.        this.cb.startSession();                // Show an interstitial        this.cb.showInterstitial();                                                                                          }     @Override    public void onStop(){       super.onStop();       mHelper.onStop();                  }            @Override    public void onActivityResult(int request, int response, Intent data) {       super.onActivityResult(request, response, data);        mHelper.onActivityResult(request, response, data);    }     @Override    public boolean getSignedInGPGS() {       return mHelper.isSignedIn();    }     @Override    public void loginGPGS() {       try {          runOnUiThread(new Runnable(){             public void run() {                mHelper.beginUserInitiatedSignIn();             }          });       } catch (final Exception ex) {       }    }     @Override    public void submitScoreGPGS(int score) {       Games.Leaderboards.submitScore(mHelper.getApiClient(),”xxxxxxxxxxxx”, score);    }        @Override    public void unlockAchievementGPGS(String achievementId) {       Games.Achievements.unlock(mHelper.getApiClient(), achievementId);    }        @Override    public void getLeaderboardGPGS() {       startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mHelper.getApiClient(), “xxxxxxxxxxxxxxxxxx”), 100);    }     @Override    public void getAchievementsGPGS() {       startActivityForResult(Games.Achievements.getAchievementsIntent(mHelper.getApiClient()), 101);    }        @Override    public void onSignInFailed() {       System.out.println("e ke cazzzz");    }     @Override    public void onSignInSucceeded() {       System.out.println("e ke cazzzz due volte");    }            @Override    protected void onDestroy() {        super.onDestroy();        adView.destroy();        this.cb.onDestroy(this);           }     @Override    public void onBackPressed() {         // If an interstitial is on screen, close it. Otherwise continue as normal.        if (this.cb.onBackPressed())            return;        else            super.onBackPressed();    }            private ChartboostDelegate chartBoostDelegate = new ChartboostDelegate() {        @Override       public void didCacheInterstitial(String arg0) {          // TODO Auto-generated method stub                 }        @Override       public void didCacheMoreApps() {          // TODO Auto-generated method stub                 }        @Override       public void didClickInterstitial(String arg0) {          // TODO Auto-generated method stub                 }        @Override       public void didClickMoreApps() {          // TODO Auto-generated method stub                 }        @Override       public void didCloseInterstitial(String arg0) {          // TODO Auto-generated method stub                 }        @Override       public void didCloseMoreApps() {          // TODO Auto-generated method stub                 }        @Override       public void didDismissInterstitial(String arg0) {          // TODO Auto-generated method stub                 }        @Override       public void didDismissMoreApps() {          // TODO Auto-generated method stub                 }        @Override       public void didFailToLoadInterstitial(String arg0,             CBImpressionError arg1) {          // TODO Auto-generated method stub                 }        @Override       public void didFailToLoadMoreApps(CBImpressionError arg0) {          // TODO Auto-generated method stub                 }        @Override       public void didFailToRecordClick(String arg0, CBClickError arg1) {          // TODO Auto-generated method stub                 }        @Override       public void didShowInterstitial(String arg0) {          // TODO Auto-generated method stub                 }        @Override       public void didShowMoreApps() {          // TODO Auto-generated method stub                 }        @Override       public boolean shouldDisplayInterstitial(String arg0) {          if(!jumper.mostra)             return false;          else{             ad.show();             return true;          }                 }        @Override       public boolean shouldDisplayLoadingViewForMoreApps() {          // TODO Auto-generated method stub          return true;       }        @Override       public boolean shouldDisplayMoreApps() {          // TODO Auto-generated method stub          return true;       }        @Override       public boolean shouldPauseClickForConfirmation(             CBAgeGateConfirmation arg0) {          // TODO Auto-generated method stub          return true;       }        @Override       public boolean shouldRequestInterstitial(String arg0) {          // TODO Auto-generated method stub          return true;       }        @Override       public boolean shouldRequestInterstitialsInFirstSession() {          // TODO Auto-generated method stub          return true;       }        @Override       public boolean shouldRequestMoreApps() {          // TODO Auto-generated method stub          return true;       }           };            }





Dump your java code here :



Special syntax:
  • To highlight a line (yellow background), prefix it with '@@'
  • To indicate that a line should be removed (red background), prefix it with '-'
  • To indicate that a line should be added (green background), prefix it with '+'
  • To post multiple snippets, seperate them by '~~~~'
  EOF
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (39 views)
2014-07-18 06:55:21

Zero Volt (36 views)
2014-07-17 23:47:54

danieldean (29 views)
2014-07-17 23:41:23

MustardPeter (32 views)
2014-07-16 23:30:00

Cero (47 views)
2014-07-16 00:42:17

Riven (48 views)
2014-07-14 18:02:53

OpenGLShaders (38 views)
2014-07-14 16:23:47

Riven (37 views)
2014-07-14 11:51:35

quew8 (33 views)
2014-07-13 13:57:52

SHC (70 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!