cocos 安卓相互调用
安卓调用代码@Override@Overridetry {});cocos对应的方法:@ccclass。
·
安卓调用代码
@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;
}
更多推荐
已为社区贡献1条内容
所有评论(0)