竖屏UI适配

This commit is contained in:
2025-06-04 10:05:42 +08:00
parent b18fefa905
commit 4c7d4b15ce
3 changed files with 84 additions and 52 deletions

View File

@@ -50,17 +50,16 @@ export class UIManager extends Laya.Script {
private UIRoot: Laya.Panel
public getUIRoot(): Laya.Node {
if (!this.UIRoot) {
this.UIRoot = this.owner.getChildByName("UIRoot") as Laya.Panel
if (config.H_SCREEN) {
if (config.H_SCREEN) {
if (!this.UIRoot) {
this.UIRoot = this.owner.getChildByName("UIRoot") as Laya.Panel
this.UIRoot.width = config.DESIGN_HEIGHT
this.UIRoot.height = config.DESIGN_WIDTH
} else {
this.UIRoot.width = config.DESIGN_WIDTH
this.UIRoot.height = config.DESIGN_HEIGHT
}
return this.UIRoot
} else {
return this.owner
}
return this.UIRoot
}
private topbar: TopBar