安卓调用代码
@Override
public void onRewarded() {
    System.out.println("AAAAA011111");

    ((Cocos2dxActivity) Cocos2dxActivity.getContext()).runOnGLThread(new Runnable() {
        @Override
        public void run() {
            try {
                Cocos2dxJavascriptJavaBridge.evalString("SDK.getVideoCb('0')");


            }catch (Exception e){
                e.printStackTrace();
            }
        }
    });

}

cocos对应的方法:

const { ccclass, property } = cc._decorator;

@ccclass

export default class SDK {

  private static getVideoCb(err: string) {

        console.log("6666666777766666666666666666"+err);

        if (err === "0") {

            this.videoCall && this.videoCall(err);

        }

        GameMgr.inst.updataTaskPoint();

        this.videoCall = null;

        console.log("getVideoCb", err)

        this.resumeMusic();

        this.canChaPing = true;

    }

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐