Commit b66326cc authored by liujiangnan's avatar liujiangnan
parents b7cd1374 01c4c0d2
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -86,6 +86,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -86,6 +86,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
async initView() { async initView() {
const canvas = cc.find('Canvas');
const touchboard = cc.find('Canvas/touchboard'); const touchboard = cc.find('Canvas/touchboard');
const contant = cc.find('Canvas/touchboard/contant'); const contant = cc.find('Canvas/touchboard/contant');
const scale = touchboard.height / contant.height; const scale = touchboard.height / contant.height;
...@@ -94,6 +95,16 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -94,6 +95,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
contant.scale = scale; contant.scale = scale;
contant.x = contant.width / 2 - touchboard.width / 2; contant.x = contant.width / 2 - touchboard.width / 2;
if((canvas.width / canvas.height) >= 1) {
// 横屏
} else {
// 竖屏
const bg = cc.find('Canvas/touchboard/contant/bg');
bg.x = -1600;
bg.y = -150;
bg.scale = 0.3;
}
const bg = cc.find('Canvas/touchboard/contant/bg'); const bg = cc.find('Canvas/touchboard/contant/bg');
for (let i = 0; i < 36; i++) { for (let i = 0; i < 36; i++) {
const btn = seekChildByName(bg, `btn_${i}`); const btn = seekChildByName(bg, `btn_${i}`);
......
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