调整棋盘UI

This commit is contained in:
2025-05-30 08:54:57 +08:00
parent bb25aba93a
commit 74758b2322
4 changed files with 780 additions and 1048 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -41,9 +41,6 @@
"obj_candys": {
"_$ref": "fmnkhvuy"
},
"obj_candy_labels": {
"_$ref": "6soivbgd"
},
"btn_undo": {
"_$ref": "5tjil58p"
},
@@ -42784,6 +42781,7 @@
"y": 264,
"width": 912,
"height": 444,
"drawCallOptimize": true,
"bottom": 144,
"centerX": 0,
"space": 24,
@@ -42838,421 +42836,7 @@
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
},
{
"_$id": "rwvcmpyc",
"_$type": "Box",
"name": "Box(2)",
"x": 312,
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "sgj96rj6",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
},
{
"_$id": "d4qobser",
"_$type": "Box",
"name": "Box(3)",
"x": 624,
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "gxoxm33e",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
}
]
},
{
"_$id": "3fo750og",
"_$type": "HBox",
"name": "HBox(2)",
"y": 156,
"width": 912,
"height": 132,
"_mouseState": 2,
"space": 24,
"align": "middle",
"_$child": [
{
"_$id": "gtuu0ec7",
"_$type": "Box",
"name": "Box(1)",
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "1d6m45ub",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
},
{
"_$id": "t509xycm",
"_$type": "Box",
"name": "Box(2)",
"x": 312,
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "66kkhwcj",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
},
{
"_$id": "0mei4952",
"_$type": "Box",
"name": "Box(3)",
"x": 624,
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "gb1d3g50",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
}
]
},
{
"_$id": "y497kggz",
"_$type": "HBox",
"name": "HBox(3)",
"y": 312,
"width": 912,
"height": 132,
"_mouseState": 2,
"space": 24,
"align": "middle",
"_$child": [
{
"_$id": "u4m3mokt",
"_$type": "Box",
"name": "Box(1)",
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "5escrnms",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
},
{
"_$id": "nznwumb7",
"_$type": "Box",
"name": "Box(2)",
"x": 312,
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "8w7ie5xw",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
},
{
"_$id": "0pazsfrh",
"_$type": "Box",
"name": "Box(3)",
"x": 624,
"width": 288,
"height": 132,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "jkauafxp",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
]
}
]
}
]
}
]
},
{
"_$id": "6soivbgd",
"_$type": "VBox",
"name": "candy_labels",
"y": 264,
"width": 912,
"height": 444,
"mouseThrough": true,
"bottom": 144,
"centerX": 0,
"space": 24,
"align": "center",
"_$child": [
{
"_$id": "saf0gcgu",
"_$type": "HBox",
"name": "HBox(1)",
"width": 912,
"height": 132,
"_mouseState": 2,
"mouseThrough": true,
"space": 24,
"align": "middle",
"_$child": [
{
"_$id": "tpxsewms",
"_$type": "Box",
"name": "Box(1)",
"width": 288,
"height": 132,
"mouseThrough": true,
"_$child": [
{
"_$id": "tw2rwa95",
@@ -43292,18 +42876,53 @@
"padding": "0,0,0,0"
}
]
}
]
},
{
"_$id": "z8me9qib",
"_$id": "k2agre19",
"_$type": "Box",
"name": "Box(2)",
"x": 312,
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "6iaixkux",
"_$id": "8i53ai7d",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "hnrnzxq1",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43322,7 +42941,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "12b5spe4",
"_$id": "ymbuqf0i",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43340,18 +42959,53 @@
"padding": "0,0,0,0"
}
]
}
]
},
{
"_$id": "qnzmnwc6",
"_$id": "ov8zyk4w",
"_$type": "Box",
"name": "Box(3)",
"x": 624,
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "ftyqhc42",
"_$id": "xv972cn5",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "eyvsp4uv",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43370,7 +43024,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "gqlmk0qs",
"_$id": "rxfb0r24",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43390,29 +43044,63 @@
]
}
]
}
]
},
{
"_$id": "flmh6tz2",
"_$id": "44dtxtj5",
"_$type": "HBox",
"name": "HBox(2)",
"y": 156,
"width": 912,
"height": 132,
"_mouseState": 2,
"mouseThrough": true,
"space": 24,
"align": "middle",
"_$child": [
{
"_$id": "yzcybv89",
"_$id": "xn8mm8rz",
"_$type": "Box",
"name": "Box(1)",
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "sefab7ni",
"_$id": "jdki4qby",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "rrvvs3wb",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43431,7 +43119,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "crbj68aw",
"_$id": "615gu9t2",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43449,18 +43137,53 @@
"padding": "0,0,0,0"
}
]
}
]
},
{
"_$id": "ux6dx9gk",
"_$id": "mdhtax6b",
"_$type": "Box",
"name": "Box(2)",
"x": 312,
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "hoinchqg",
"_$id": "nwgk3ujp",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "q56jt7m5",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43479,7 +43202,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "kkyxyhp3",
"_$id": "shf2pceh",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43497,18 +43220,53 @@
"padding": "0,0,0,0"
}
]
}
]
},
{
"_$id": "sxno53go",
"_$id": "rthxrc6h",
"_$type": "Box",
"name": "Box(3)",
"x": 624,
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "9dcbv83k",
"_$id": "y3ykmte6",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "xowjtmt7",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43527,7 +43285,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "1goy9u0m",
"_$id": "dlvz14ar",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43547,29 +43305,63 @@
]
}
]
}
]
},
{
"_$id": "a7qgh7ir",
"_$id": "7gmoro9s",
"_$type": "HBox",
"name": "HBox(3)",
"y": 312,
"width": 912,
"height": 132,
"_mouseState": 2,
"mouseThrough": true,
"space": 24,
"align": "middle",
"_$child": [
{
"_$id": "keqwg6g2",
"_$id": "2a4115t4",
"_$type": "Box",
"name": "Box(1)",
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "0nov0jfk",
"_$id": "y6k6sq0m",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "ekly8wek",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43588,7 +43380,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "ze22iq15",
"_$id": "klx1sche",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43606,18 +43398,53 @@
"padding": "0,0,0,0"
}
]
}
]
},
{
"_$id": "b7129v1q",
"_$id": "z6uwk8yn",
"_$type": "Box",
"name": "Box(2)",
"x": 312,
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "jb9blzao",
"_$id": "a0cg4cxg",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "sobq6uqu",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43636,7 +43463,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "38qqqlrk",
"_$id": "w9lf1y1z",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43654,18 +43481,53 @@
"padding": "0,0,0,0"
}
]
}
]
},
{
"_$id": "s3rj9u39",
"_$id": "75hsgmcz",
"_$type": "Box",
"name": "Box(3)",
"x": 624,
"width": 288,
"height": 132,
"mouseThrough": true,
"_$comp": [
{
"_$type": "067a5d3a-4d7c-48d7-bb01-db2682fd6c01",
"scriptPath": "../src/views/Candy.ts"
}
],
"_$child": [
{
"_$id": "9kg8dr88",
"_$id": "5s99v90f",
"_$type": "Sprite",
"name": "Sprite",
"x": 144,
"y": 66,
"width": 288,
"height": 132,
"anchorX": 0.5,
"anchorY": 0.5,
"mouseThrough": true,
"_gcmds": [
{
"_$type": "DrawRoundRectCmd",
"x": 0,
"y": 0,
"width": 1,
"height": 1,
"lt": 24,
"rt": 24,
"lb": 24,
"rb": 24,
"percent": true,
"lineWidth": 1,
"fillColor": "#FFFFFF"
}
],
"_$child": [
{
"_$id": "jjy61oc9",
"_$type": "Label",
"name": "label",
"y": 12,
@@ -43684,7 +43546,7 @@
"strokeColor": "rgba(0, 0, 0, 1)"
},
{
"_$id": "6o8ygx4y",
"_$id": "eswp8g2f",
"_$type": "Label",
"name": "label_left",
"y": 84,
@@ -43706,6 +43568,8 @@
]
}
]
}
]
},
{
"_$id": "qegjy7c7",

View File

@@ -11,11 +11,11 @@ export class Candy extends Laya.Script {
private show: number
private left: number
public onInit(label_obj: Laya.Box, handler: any, func: any): void {
public onInit(handler: any, func: any): void {
this.owner.on(Laya.Event.CLICK, handler, func)
this.show_sprite = this.owner.getChildByName("Sprite") as Laya.Sprite
this.label_show = label_obj.getChildByName("label") as Laya.Label
this.label_left = label_obj.getChildByName("label_left") as Laya.Label
this.label_show = this.show_sprite.getChildByName("label") as Laya.Label
this.label_left = this.show_sprite.getChildByName("label_left") as Laya.Label
}
public setNoteStatus(note_open: boolean) {

View File

@@ -47,9 +47,6 @@ export class Stage extends Laya.Script {
@property(Laya.Box)
public obj_candys: Laya.Box
@property(Laya.Box)
public obj_candy_labels: Laya.Box
private candys: Array<Candy> = []
@property(Laya.Button)
@@ -125,12 +122,10 @@ export class Stage extends Laya.Script {
}
for (let i = 0; i < this.obj_candys.numChildren; i++) {
const hbox = this.obj_candys.getChildAt(i)
const l_hbox = this.obj_candy_labels.getChildAt(i)
for (let j = 0; j < hbox.numChildren; j++) {
const candy = hbox.getChildAt(j).getComponent(Candy)
this.candys.push(candy)
const box = l_hbox.getChildAt(j) as Laya.Box
candy.onInit(box, this, this.onClickCandy)
candy.onInit(this, this.onClickCandy)
}
}