竖屏UI适配
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
{
|
||||
"_$type": "3f68d98d-3867-41a7-b277-a24d279a22fa",
|
||||
"scriptPath": "../src/views/dc/DailyChallenge.ts",
|
||||
"sprite_bottom": {
|
||||
"_$ref": "pnlhl1x0"
|
||||
},
|
||||
"btn_back": {
|
||||
"_$ref": "yvza2lgb"
|
||||
},
|
||||
@@ -87,8 +90,9 @@
|
||||
"width": 1080,
|
||||
"height": 1080,
|
||||
"_mouseState": 2,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"centerX": 0,
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "hdia0flx",
|
||||
@@ -96,22 +100,49 @@
|
||||
"name": "bg",
|
||||
"width": 1080,
|
||||
"height": 1080,
|
||||
"centerX": 0,
|
||||
"centerY": 0,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"skin": "res://4182ef3f-6065-44dd-83c2-70490f02e9cb",
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "et3t0uy6",
|
||||
"_$type": "Image",
|
||||
"name": "trophy_light",
|
||||
"x": 375,
|
||||
"width": 705,
|
||||
"height": 960,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"skin": "res://2a5d1872-8a36-4ac1-ad80-f375499754a6",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "e7a1ntdg",
|
||||
"_$type": "Image",
|
||||
"name": "trophy",
|
||||
"x": 531,
|
||||
"y": 110,
|
||||
"width": 468,
|
||||
"height": 468,
|
||||
"top": 110,
|
||||
"centerX": 225,
|
||||
"skin": "res://09690a9b-3d5a-4da1-b457-1a3275cf5c14",
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "cojpn11e",
|
||||
"_$type": "Box",
|
||||
"name": "back",
|
||||
"x": 38,
|
||||
"y": 78,
|
||||
"y": 72,
|
||||
"width": 400,
|
||||
"height": 64,
|
||||
"_mouseState": 2,
|
||||
"top": 72,
|
||||
"centerX": -302,
|
||||
"centerY": -430,
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "yvza2lgb",
|
||||
@@ -150,10 +181,12 @@
|
||||
"_$id": "ft6m7zwa",
|
||||
"_$type": "Image",
|
||||
"name": "btn_trophy",
|
||||
"x": 948,
|
||||
"x": 935,
|
||||
"y": 72,
|
||||
"width": 75,
|
||||
"height": 75,
|
||||
"top": 72,
|
||||
"centerX": 432,
|
||||
"skin": "res://4458c7de-47ff-496e-a28f-be808c0823b3",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff",
|
||||
@@ -188,39 +221,17 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "et3t0uy6",
|
||||
"_$type": "Image",
|
||||
"name": "trophy_light",
|
||||
"x": 375,
|
||||
"width": 705,
|
||||
"height": 960,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"skin": "res://2a5d1872-8a36-4ac1-ad80-f375499754a6",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "e7a1ntdg",
|
||||
"_$type": "Image",
|
||||
"name": "trophy",
|
||||
"x": 542,
|
||||
"y": 108,
|
||||
"width": 468,
|
||||
"height": 468,
|
||||
"skin": "res://09690a9b-3d5a-4da1-b457-1a3275cf5c14",
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "pohsc0lz",
|
||||
"_$type": "Label",
|
||||
"name": "label_year",
|
||||
"x": 133,
|
||||
"x": 120,
|
||||
"y": 224,
|
||||
"width": 200,
|
||||
"width": 400,
|
||||
"height": 72,
|
||||
"alpha": 0.6,
|
||||
"top": 224,
|
||||
"centerX": -220,
|
||||
"text": "2024",
|
||||
"font": "res://7322bbf9-175b-4a25-a0d7-72d369894de2",
|
||||
"fontSize": 48,
|
||||
@@ -232,10 +243,12 @@
|
||||
"_$id": "syblrak9",
|
||||
"_$type": "Label",
|
||||
"name": "label_month",
|
||||
"x": 133,
|
||||
"y": 300,
|
||||
"x": 120,
|
||||
"y": 297,
|
||||
"width": 400,
|
||||
"height": 72,
|
||||
"top": 297,
|
||||
"centerX": -220,
|
||||
"text": "Jul",
|
||||
"font": "res://7322bbf9-175b-4a25-a0d7-72d369894de2",
|
||||
"fontSize": 72,
|
||||
@@ -248,10 +261,12 @@
|
||||
"_$id": "w9sm094p",
|
||||
"_$type": "Box",
|
||||
"name": "Box",
|
||||
"x": 133,
|
||||
"y": 400,
|
||||
"width": 213,
|
||||
"x": 120,
|
||||
"y": 388,
|
||||
"width": 400,
|
||||
"height": 72,
|
||||
"top": 388,
|
||||
"centerX": -220,
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "3jc1lyi4",
|
||||
@@ -309,11 +324,13 @@
|
||||
"_$id": "ydwm2tu6",
|
||||
"_$type": "Box",
|
||||
"name": "btn_left",
|
||||
"x": 50,
|
||||
"y": 300,
|
||||
"x": 34,
|
||||
"y": 325,
|
||||
"width": 48,
|
||||
"height": 96,
|
||||
"_mouseState": 2,
|
||||
"top": 325,
|
||||
"centerX": -482,
|
||||
"_$comp": [
|
||||
{
|
||||
"_$type": "a541bdfc-e8e1-4795-b68e-7138c5190f17",
|
||||
@@ -339,11 +356,13 @@
|
||||
"_$id": "e2xuqxps",
|
||||
"_$type": "Box",
|
||||
"name": "btn_right",
|
||||
"x": 1002,
|
||||
"y": 300,
|
||||
"x": 987,
|
||||
"y": 325,
|
||||
"width": 48,
|
||||
"height": 96,
|
||||
"_mouseState": 2,
|
||||
"top": 325,
|
||||
"centerX": 471,
|
||||
"_$comp": [
|
||||
{
|
||||
"_$type": "a541bdfc-e8e1-4795-b68e-7138c5190f17",
|
||||
@@ -371,11 +390,13 @@
|
||||
"_$id": "rq2jiwrh",
|
||||
"_$type": "Box",
|
||||
"name": "bottom",
|
||||
"y": 575,
|
||||
"y": 578,
|
||||
"width": 1080,
|
||||
"height": 1345,
|
||||
"height": 1342,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 578,
|
||||
"bottom": 0,
|
||||
"centerX": 0,
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "pnlhl1x0",
|
||||
@@ -7113,7 +7134,7 @@
|
||||
"_$type": "Box",
|
||||
"name": "bottom",
|
||||
"x": 72,
|
||||
"y": 985,
|
||||
"y": 982,
|
||||
"width": 936,
|
||||
"height": 300,
|
||||
"bottom": 60,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,6 +12,10 @@ const { regClass, property } = Laya
|
||||
export class DailyChallenge extends Laya.Script {
|
||||
declare owner: Laya.Box
|
||||
|
||||
|
||||
@property(Laya.Sprite)
|
||||
public sprite_bottom: Laya.Sprite
|
||||
|
||||
@property(Laya.Button)
|
||||
public btn_back: Laya.Button
|
||||
|
||||
@@ -85,6 +89,12 @@ export class DailyChallenge extends Laya.Script {
|
||||
onAwake(): void {
|
||||
DailyChallenge._instance = this
|
||||
|
||||
if (!config.H_SCREEN) {
|
||||
const parent = this.sprite_bottom.parent as Laya.Box
|
||||
this.sprite_bottom.graphics.clear()
|
||||
this.sprite_bottom.graphics.drawRoundRect(0, 0, parent.width, parent.height, 72, 72, 0, 0, "#ffffff")
|
||||
}
|
||||
|
||||
if (this.btn_back) {
|
||||
this.btn_back.on(Laya.Event.CLICK, this, () => {
|
||||
UIManager.getInstance().loadHomeUI()
|
||||
@@ -296,5 +306,7 @@ export class DailyChallenge extends Laya.Script {
|
||||
UIManager.getInstance().loadTrophyClaimUI(find)
|
||||
user.set_trophyNew(find, false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user