我写了下面一段代码,在浏览器上是正常的,但是打包到安卓上,就报错:
ERROR: Uncaught TypeError: Cannot set property ‘GameManager’ of undefined, location: src/project.js:0:0
[ERROR] (D:/CocosCreator_2.0.10/resources/cocos2d-x/cocos/scripting/js-bindings/jswrapper/v8/Object.cpp, 534): Invoking function (0xc7558d30) failed!
请问应该如何解决?
var step = 0;
var that = this;
G.ShowCall["GameManager"] = function(){
console.log("step:"+step);
++step;
that.yinliang.string = "银两:"+G.Info.yinliang;
that.wuli.string = "武力值:"+G.Info.wulizhi;
that.dizi.string = "弟子:" + G.Info.dizi;
}