[]微信飞机大战报错

调用堆栈:"Cannot set property 'text' of undefined"
 调试控制台输出:Error processing "evaluate": TypeError: Cannot read property 'api' of undefined
    at ChromeConnection.get api [as api] (d:\Program\LayaAirIDE_1.7.0\resources\app\extensions\laya-debug\node_modules\vscode-chrome-debug-core\out\src\chrome\chromeConnection.js:56:28)
    at ChromeDebugAdapter.get chrome [as chrome] (d:\Program\LayaAirIDE_1.7.0\resources\app\extensions\laya-debug\node_modules\vscode-chrome-debug-core\out\src\chrome\chromeDebugAdapter.js:40:38)
    at ChromeDebugAdapter.globalEvaluate (d:\Program\LayaAirIDE_1.7.0\resources\app\extensions\laya-debug\node_modules\vscode-chrome-debug-core\out\src\chrome\chromeDebugAdapter.js:1022:20)
    at ChromeDebugAdapter.evaluate (d:\Program\LayaAirIDE_1.7.0\resources\app\extensions\laya-debug\node_modules\vscode-chrome-debug-core\out\src\chrome\chromeDebugAdapter.js:944:32)
    at dispatchRequest (d:\Program\LayaAirIDE_1.7.0\resources\app\extensions\laya-debug\node_modules\vscode-chrome-debug-core\out\src\chrome\chromeDebugSession.js:122:68)
    at ProtocolServer._handleData (d:\Program\LayaAirIDE_1.7.0\resources\app\extensions\laya-debug\node_modules\vscode-chrome-debug-core\node_modules\vscode-debugadapter\lib\protocol.js:104:38)
    at Socket.<anonymous> (d:\Program\LayaAirIDE_1.7.0\resources\app\extensions\laya-debug\node_modules\vscode-chrome-debug-core\node_modules\vscode-debugadapter\lib\protocol.js:24:60)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:[...]
 
GameInfo.js代码:
var GameInfo = (function(_super){
    function GameInfo(){
        GameInfo.super(this);
        this.pauseBtn.on(Laya.Event.CLICK, this, this.onPauseBtnClick);
        this.reset();
    }
    Laya.class(GameInfo, "GameInfo", _super);
    var _proto = GameInfo.prototype;
    _proto.reset = function(){
        this.infoLabel.text = "";
        this.hp(5);
        this.level(0);
        this.score(0);
    }
    _proto.onPauseBtnClick = function(e){
        e.stopPropagation();
        this.infoLabel.text = "游戏已暂停,点击任意地方恢复游戏";
        pause();
        Laya.stage.once(Laya.Event.CLICK, this, this.onStageClick);
    }
    _proto.onStageClick = function(){
        this.infoLabel.text = "";
        resume();
    }
    _proto.hp = function(value){
        this.hpLabel.text = "HP:" + value;
    }
    _proto.level = function(value){
        this.levelLabel.text = "Level:" + value;
    }
    _proto.score = function(value){
        this.scoreLabel.text = "Score:" + value;
    }
    return GameInfo;
})(ui.GameInfoUI);
 
已邀请:

Monica - 知识达人

赞同来自:

上传个Demo吧,我们看下

要回复问题请先

商务合作
商务合作