/** * 演示模式类 * @property {object} lib 库对象 * @property {object} stopDemo 面板元素对象 */ function Demo() { this.lib = library; this.stopDemo = null; } Demo.of = function () { const instance = new Demo(); instance.init(); return instance; }; // 初始化 Demo.prototype.init = function () { this.showStopDemo(); }; // 显示演示模式按钮 Demo.prototype.showStopDemo = function () { const lib = this.lib; const stopDemo = new lib.stopDemo(); stopDemo.x = 50; stopDemo.y = lib.properties.height - 100; this.stopDemo = stopDemo; // 关闭演示模式 this.stopDemo.addEventListener( 'click', function () { stage.removeChild(stopDemo); location.hash = ''; location.reload(); isDemo = false; }, false, ); stage.addChild(stopDemo); };