首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Chartboost和andengine显示游戏中添加的内容

使用Chartboost和andengine显示游戏中添加的内容
EN

Stack Overflow用户
提问于 2013-12-13 07:15:30
回答 2查看 418关注 0票数 0

谁能告诉我如何配置图表助推添加平台和引擎游戏,以显示添加在游戏中。我已经下载了chartboost sdk,并且我试图在ChartBoost中配置onCreateEngineOption,例如-

代码语言:javascript
复制
public EngineOptions onCreateEngineOptions()
    {
        camera = new BoundCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
        EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), this.camera);
        engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true);//turn on the music and sound option
        engineOptions.getRenderOptions().getConfigChooserOptions().setRequestedMultiSampling(true);
        engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);//tell the engine to always keep the screen unloced while game is running
        engineOptions.getRenderOptions().setDithering(true);//enable the Dithering for the whole game by default
        return engineOptions;

        // Configure Chartboost
        this.cb = Chartboost.sharedChartboost();
        String appId = "YOUR_APP_ID";
        String appSignature = "YOUR_APP_SIGNATURE";
        this.cb.onCreate(this, appId, appSignature, null);
    }

我的游戏要崩溃了..。谢谢!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-04-01 07:01:40

我自己想出了如何将Chartboost集成到一个Andengine游戏中

步骤1)在OnCreateEngineOption中初始化Chartboost

代码语言:javascript
复制
//ChrtBoost Code
    cb = Chartboost.sharedChartboost();
    String appId = "****************";
    String appSignature = "****************************";
    cb.onCreate(this,appId,appSignature, null);
    cb.onStart(this);
    cb.setImpressionsUseActivities(true);   
    //end of chartBoost Code

步骤2)开始会话在onCreateResource方法中

代码语言:javascript
复制
this.runOnUiThread(new Runnable() {
        public void run() {

            cb.startSession();
            cb.showInterstitial(); 

              }
    });

步骤3缓存添加的初始使用onCreateScene方法

代码语言:javascript
复制
//cache the adds initially
    this.cb.cacheInterstitial();

步骤4显示在场景调用中添加以下方法

代码语言:javascript
复制
cb.showInterstitial();
票数 1
EN

Stack Overflow用户

发布于 2013-12-13 20:18:56

Chartboost希望将其添加到标准android活动中的视图中,而不是作为a引擎的一部分。您应该使用SimpleLayoutGameActivity作为您的游戏活动,以便为您的广告服务提供XML布局。

看看XMLLayoutExample (https://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/XMLLayoutExample.java)

或者看看我不久前使用和andengine GLES1所做的这个旧的实现。需求也将是相似的。这使用AdMob而不是Chartboost,但是您的应用程序崩溃的原因是一样的:您需要使用自定义的XMLlayout来使您的广告服务工作。

https://github.com/zfoley/AndengineAdmobLayoutExample

希望这能让你走上正轨!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20561060

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档