我做一个卡牌类小游戏,要求登录界面为竖屏,登录后游戏界面为横屏,使用ts脚本好像怎么都不起作用!
在cocos creator工程中是使用的场景为横屏布局;登录场景在creator中也只有被迫使用横屏布局(因为好像ide不支持不同场景使用不同的横竖屏设置),于是我在登录界面使用了如下代码:
let screenSize = View.instance.getDesignResolutionSize();
console.log(‘屏幕设计尺寸’,screenSize.height, screenSize.width);
let height = screenSize.height;
screenSize.height = screenSize.width;
screenSize.width = height;
screen.windowSize = screenSize;
View.instance.setOrientation(macro.ORIENTATION_PORTRAIT);
但好像没什么卵用,有高手指点一二吗?

用view.setDesignResolutionSize 方法试试