Commit 238bebea authored by 李维's avatar 李维

fix: test

parent 435d8f4b
...@@ -35,16 +35,35 @@ export default class GameCenter extends cc.Component { ...@@ -35,16 +35,35 @@ export default class GameCenter extends cc.Component {
onLoad() { onLoad() {
// 初始化组件引用 // 初始化组件引用
this.initComponents(); this.initComponents();
// 获取屏幕宽度
} }
start() { start() {
this.getGameList(); this.getGameList();
// const backBtn = cc.find("Canvas/back_btn"); let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
// this._frameSize = frameSize;
const designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
const cocosScale = Math.min(sx, sy);
sx = frameSize.width / designSize.width;
sy = frameSize.height / designSize.height;
// this._mapScaleMin = Math.min(sx, sy) * cocosScale;
// this._mapScaleMax = Math.max(sx, sy) * cocosScale;
// backBtn.x = -canvas.width/2 + 50 + backBtn.width/2; cc.director['_scene'].width = frameSize.width;
// backBtn.y = canvas.height/2 - 50 - backBtn.height/2; cc.director['_scene'].height = frameSize.height;
// console.log( backBtn.x, backBtn.y)
} }
private initComponents() { private initComponents() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment