Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_jxw_demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
middleLayer_for_jxw_demo
Commits
1caef1db
Commit
1caef1db
authored
Aug 22, 2025
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 调整布局
parent
ab07cf77
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
game-card.ts
...ts/middleLayer_for_jxw_demo/pages/gamecenter/game-card.ts
+4
-2
gamecenter.fire
...middleLayer_for_jxw_demo/pages/gamecenter/gamecenter.fire
+2
-2
gamecenter.ts
...s/middleLayer_for_jxw_demo/pages/gamecenter/gamecenter.ts
+6
-6
game-card.prefab
...er_for_jxw_demo/pages/gamecenter/prefabs/game-card.prefab
+3
-3
No files found.
assets/middleLayer_for_jxw_demo/pages/gamecenter/game-card.ts
View file @
1caef1db
...
@@ -6,6 +6,7 @@ interface GameCardData {
...
@@ -6,6 +6,7 @@ interface GameCardData {
template_name
:
string
;
template_name
:
string
;
template_description
:
string
;
template_description
:
string
;
cover
:
string
;
cover
:
string
;
cw_cover
:
string
;
data
:
string
;
data
:
string
;
seq
:
number
;
seq
:
number
;
}
}
...
@@ -42,8 +43,9 @@ export default class GameCard extends cc.Component {
...
@@ -42,8 +43,9 @@ export default class GameCard extends cc.Component {
}
}
// 加载并设置缩略图
// 加载并设置缩略图
if
(
this
.
thumbnailSprite
&&
this
.
gameData
.
cover
)
{
if
(
this
.
thumbnailSprite
&&
(
this
.
gameData
.
cover
||
this
.
gameData
.
cw_cover
))
{
cc
.
loader
.
load
(
this
.
gameData
.
cover
,
(
err
,
texture
)
=>
{
const
cv
=
this
.
gameData
.
cw_cover
?
this
.
gameData
.
cw_cover
:
this
.
gameData
.
cover
;
cc
.
loader
.
load
(
cv
,
(
err
,
texture
)
=>
{
if
(
!
err
&&
texture
)
{
if
(
!
err
&&
texture
)
{
const
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
);
const
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
);
this
.
thumbnailSprite
.
spriteFrame
=
spriteFrame
;
this
.
thumbnailSprite
.
spriteFrame
=
spriteFrame
;
...
...
assets/middleLayer_for_jxw_demo/pages/gamecenter/gamecenter.fire
View file @
1caef1db
...
@@ -872,7 +872,7 @@
...
@@ -872,7 +872,7 @@
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 3
0
00,
"width": 3
7
00,
"height": 600
"height": 600
},
},
"_anchorPoint": {
"_anchorPoint": {
...
@@ -1107,7 +1107,7 @@
...
@@ -1107,7 +1107,7 @@
"_enabled": true,
"_enabled": true,
"_layoutSize": {
"_layoutSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 3
0
00,
"width": 3
7
00,
"height": 600
"height": 600
},
},
"_resize": 1,
"_resize": 1,
...
...
assets/middleLayer_for_jxw_demo/pages/gamecenter/gamecenter.ts
View file @
1caef1db
...
@@ -346,19 +346,19 @@ export default class GameCenter extends cc.Component {
...
@@ -346,19 +346,19 @@ export default class GameCenter extends cc.Component {
});
});
// 设置内容节点大小 - 以(0,0)为中心
// 设置内容节点大小 - 以(0,0)为中心
const
cardWidth
=
4
00
;
// 卡片宽度
const
cardWidth
=
5
00
;
// 卡片宽度
const
cardHeight
=
300
;
// 卡片高度
const
cardHeight
=
259
;
// 卡片高度
const
spacing
=
30
;
// 卡片间距
const
spacing
=
30
;
// 卡片间距
const
totalCards
=
Math
.
ceil
(
this
.
gameDataList
.
length
/
2
);
const
totalCards
=
Math
.
ceil
(
this
.
gameDataList
.
length
/
2
);
console
.
log
(
'
卡片尺寸信息:
'
,
{
cardWidth
,
cardHeight
,
spacing
,
totalCards
});
console
.
log
(
'
卡片尺寸信息:
'
,
{
cardWidth
,
cardHeight
,
spacing
,
totalCards
});
if
(
totalCards
>
0
)
{
if
(
totalCards
>
0
)
{
const
totalWidth
=
totalCards
*
cardWidth
+
(
totalCards
-
1
)
*
spacing
;
// const totalWidth = totalCards * cardWidth + totalCards
* spacing;
content
.
width
=
totalWidth
;
//
content.width = totalWidth;
content
.
height
=
cardHeight
;
//
content.height = cardHeight;
console
.
log
(
'
设置content节点大小:
'
,
{
width
:
content
.
width
,
height
:
content
.
height
});
console
.
log
(
'
设置content节点大小:
'
,
{
width
:
content
.
width
,
heig
s
ht
:
content
.
height
});
console
.
log
(
'
设置content节点锚点:
'
,
{
anchorX
:
content
.
anchorX
,
anchorY
:
content
.
anchorY
});
console
.
log
(
'
设置content节点锚点:
'
,
{
anchorX
:
content
.
anchorX
,
anchorY
:
content
.
anchorY
});
}
else
{
}
else
{
console
.
warn
(
'
没有游戏数据,无法设置内容节点大小
'
);
console
.
warn
(
'
没有游戏数据,无法设置内容节点大小
'
);
...
...
assets/middleLayer_for_jxw_demo/pages/gamecenter/prefabs/game-card.prefab
View file @
1caef1db
...
@@ -338,7 +338,7 @@
...
@@ -338,7 +338,7 @@
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-1.089,
-1.089,
-10
6
.039,
-10
1
.039,
0,
0,
0,
0,
0,
0,
...
@@ -379,8 +379,8 @@
...
@@ -379,8 +379,8 @@
"_dstBlendFactor": 771,
"_dstBlendFactor": 771,
"_string": "",
"_string": "",
"_N$string": "",
"_N$string": "",
"_fontSize": 2
6
,
"_fontSize": 2
2
,
"_lineHeight":
3
2,
"_lineHeight":
2
2,
"_enableWrapText": true,
"_enableWrapText": true,
"_N$file": null,
"_N$file": null,
"_isSystemFontUsed": true,
"_isSystemFontUsed": true,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment