@fengxi/ui-framework
Version:
Cocos Creator UI框架库 类似鸿蒙的UI框架
30 lines (29 loc) • 916 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlobalManager = void 0;
const cc_1 = require("cc");
const SingletonMixin_1 = require("../base/SingletonMixin");
class GlobalManager extends SingletonMixin_1.SingletonMixin {
constructor() {
super(...arguments);
this.windowWidth = 0;
this.windowHeight = 0;
}
static get Instance() {
return super.getInstance();
}
Init() {
this.initWindowSize();
cc_1.screen.on('window-resize', this.onWindowResize, this);
}
onWindowResize(width, height) {
console.log('window resize: ', width, height);
this.windowWidth = width;
this.windowHeight = height;
}
initWindowSize() {
this.windowWidth = cc_1.screen.windowSize.width;
this.windowHeight = cc_1.screen.windowSize.height;
}
}
exports.GlobalManager = GlobalManager;