feat: 优化 write 页面的列表展示

This commit is contained in:
richarjiang
2026-06-01 11:36:44 +08:00
parent 8d2fbbbcf0
commit b9f3dce173
3 changed files with 69 additions and 42 deletions

View File

@@ -40,35 +40,21 @@ Git 历史采用 Conventional Commits且摘要多为中文例如 `feat:
<claude-mem-context>
# Memory Context
# [mp-xieyingeng] recent context, 2026-05-14 4:59pm GMT+8
# [mp-xieyingeng] recent context, 2026-06-01 11:17am GMT+8
Legend: 🎯session 🔴bugfix 🟣feature 🔄refactor ✅change 🔵discovery ⚖decision 🚨security_alert 🔐security_note
Format: ID TIME TYPE TITLE
Fetch details: get_observations([IDs]) | Search: mem-search skill
Stats: 50 obs (12,200t read) | 1,692,994t work | 99% savings
Stats: 50 obs (15,406t read) | 2,405,914t work | 99% savings
### Apr 26, 2026
S1309 移除 PageLevel.ts 进入关卡时弹出体力扣减 toast (Apr 26 at 5:16 PM)
### Apr 27, 2026
1346 9:21a 🔴 移除进入游戏后的体力扣减 toast 提示
1347 " 🔴 移除进入游戏后的体力扣减 toast 提示
1348 " 🟣 首页添加体力值显示功能
S1308 移除进入游戏关卡时弹出体力扣减的 toast 提示 (Apr 27 at 9:21 AM)
S1310 移除进入游戏体力扣减 toast 并在首页添加体力显示 (Apr 27 at 9:22 AM)
S1311 移除体力扣减 toast 并完善首页体验 (Apr 27 at 9:23 AM)
1349 9:25a ✅ PageHome.ts 添加 ToastManager 导入
1350 " ✅ PK按钮点击改为提示"功能开发中"
S1313 Implement object-fit: cover image scaling in Cocos Creator to prevent downloaded images from being distorted (Apr 27 at 9:26 AM)
1351 9:32a 🟣 Stamina animation system for level entry
1352 " 🔵 Cocos Creator game project structure discovered
1354 " 🟣 StarGame 按钮点击动画需求
1356 " 🔵 体力系统架构发现
1353 9:33a 🔵 StaminaManager API confirmed for stamina operations
1355 9:37a 🔵 项目结构和现有代码发现
1357 9:38a 🔵 EnterLevelData 结构分析
1359 9:39a 🟣 Stamina animation system implemented for game entry flow
1358 9:41a ⚖️ 体力值飞行动画实现计划制定完成
1362 9:45a 🟣 Image Cover Mode Scaling in Cocos Creator
S1312 Fix image distortion in PageLevel.ts by implementing object-fit: cover behavior for downloaded images (Apr 27 at 9:45 AM)
1360 " ✅ Cocos Creator animation imports added to PageHome.ts
@@ -112,6 +98,22 @@ S1317 Implement CSS cover-mode image scaling for PageLevel.ts mainImage nodes (A
1550 4:45p 🟣 CommonModal dual-button feature completed and validated
1551 4:46p 🔄 CommonModal API refactoring: remove buttonHint, clean button logic
1552 4:47p 🔄 CommonModal dual-button refactor complete with cleaner API
### May 14, 2026
1630 4:59p 🟣 PagePKDetail.prefab 新增参与人数标签节点
1631 " 🟣 PagePKDetail 新增参与人数标签
### Jun 1, 2026
1771 11:07a 🔵 List Height Adaptation Issue on Different Resolution Phones in PageWriteLevels
1772 " 🔵 PageWriteLevels ScrollView Height Calculation Architecture Fully Mapped
1773 " 🔵 LevelList ScrollView Widget Has Only Top Alignment — View Node Has No Widget
1774 " 🔵 Root Cause Confirmed: VIEW_HEIGHT=1300 Floor Causes List Overflow on Short Phones
1775 11:13a 🔵 PageWriteLevels Prefab Structure Confirmed Clean
1777 " 🔄 _resizeScrollViewport Delegates Layout to Cocos Widget System
1776 11:14a 🔵 PageWriteLevels Prefab Contains 233 JSON Array Entries
1778 11:15a 🟣 PageWriteLevels ScrollView View Node Gets cc.Widget for Auto-Layout
1779 " 🔵 PageWriteLevels Layout Node Tree Verified After Widget Changes
1780 11:16a 🔵 TypeScript Check Requires Cocos Creator to Generate temp/declarations First
1781 " 🔵 New Widget Bottom Inset Produces Shorter Viewport on Small Screens vs Old Minimum
1782 " 🔵 PageWriteLevels Prefab __id__ Reference Integrity Confirmed Valid
Access 1693k tokens of past work via get_observations([IDs]) or mem-search skill.
Access 2406k tokens of past work via get_observations([IDs]) or mem-search skill.
</claude-mem-context>

View File

@@ -4066,6 +4066,9 @@
},
{
"__id__": 172
},
{
"__id__": 233
}
],
"_prefab": {
@@ -4523,12 +4526,12 @@
"__prefab": {
"__id__": 192
},
"_alignFlags": 1,
"_alignFlags": 5,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 255.272,
"_bottom": 0,
"_bottom": 752.53,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
@@ -5486,5 +5489,41 @@
"fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": null,
"targetOverrides": null
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 167
},
"_enabled": true,
"__prefab": {
"__id__": 234
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 940,
"_originalHeight": 1300,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "efGg9r8a5Gdr8RY5lZpQMz"
}
]

View File

@@ -148,39 +148,25 @@ export class PageWriteLevels extends BaseView {
}
private _resizeScrollViewport(): void {
if (!this.scrollView || !this._viewTransform || !this.shareTitleEditBox) {
if (!this.scrollView || !this._viewTransform) {
return;
}
const rootTransform = this.node.getComponent(UITransform);
const scrollTransform = this.scrollView.getComponent(UITransform);
const scrollWidget = this.scrollView.getComponent('cc.Widget') as any;
const shareTitleTransform = this.shareTitleEditBox.getComponent(UITransform);
const shareTitleWidget = this.shareTitleEditBox.getComponent('cc.Widget') as any;
const bottomMaskNode = this.scrollView.getChildByName('ScrolViewMask');
const viewWidget = this._viewTransform.node.getComponent('cc.Widget') as any;
if (!rootTransform || !scrollTransform || !shareTitleTransform || !scrollWidget || !shareTitleWidget) {
if (!scrollTransform) {
return;
}
const topInset = Number(scrollWidget.top ?? 0);
const shareBottomInset = Number(shareTitleWidget.bottom ?? 0);
const shareTitleHeight = shareTitleTransform.height * Math.abs(this.shareTitleEditBox.scale.y);
const nextHeight = Math.max(
LAYOUT_CONFIG.VIEW_HEIGHT,
rootTransform.height - topInset - shareBottomInset - shareTitleHeight - LAYOUT_CONFIG.LIST_BOTTOM_GAP_TO_TITLE,
scrollWidget?.updateAlignment?.();
viewWidget?.updateAlignment?.();
this._viewTransform.setContentSize(
scrollTransform.contentSize.width,
scrollTransform.contentSize.height,
);
scrollTransform.setContentSize(scrollTransform.width, nextHeight);
this._viewTransform.setContentSize(this._viewTransform.width, nextHeight);
if (bottomMaskNode) {
bottomMaskNode.setPosition(
bottomMaskNode.position.x,
-(nextHeight / 2) + 30,
bottomMaskNode.position.z,
);
}
}
private async _initLevelList(): Promise<void> {