feat: 完善挑战结算页面

This commit is contained in:
richarjiang
2026-05-10 15:10:57 +08:00
parent 110038ceea
commit b68e32ddce
14 changed files with 4502 additions and 12 deletions

View File

@@ -503,6 +503,10 @@
"__uuid__": "1b94d42b-a4db-4c0a-8281-4275786810af",
"__expectedType__": "cc.Prefab"
},
"pagePKEndPrefab": {
"__uuid__": "4fc485cf-8c22-47f2-80d0-ae366a380cb6",
"__expectedType__": "cc.Prefab"
},
"toastPrefab": {
"__uuid__": "cff2809d-6daa-4749-a911-bb99e97b4b54",
"__expectedType__": "cc.Prefab"
@@ -698,4 +702,4 @@
"__type__": "cc.PostSettingsInfo",
"_toneMappingType": 0
}
]
]

View File

@@ -24,6 +24,9 @@ export class main extends Component {
@property({ type: Prefab, tooltip: '挑战数据页面预制体' })
pagePKDataPrefab: Prefab | null = null;
@property({ type: Prefab, tooltip: '挑战结算页面预制体' })
pagePKEndPrefab: Prefab | null = null;
@property({ type: Prefab, tooltip: 'Toast 预制体' })
toastPrefab: Prefab | null = null;
@@ -83,6 +86,14 @@ export class main extends Component {
});
}
if (this.pagePKEndPrefab) {
ViewManager.instance.register('PagePKEnd', {
prefab: this.pagePKEndPrefab,
cache: true,
zIndex: 3
});
}
// 初始化 Toast 管理器
if (this.toastPrefab) {
ToastManager.instance.init(this.toastPrefab, this.node);

View File

@@ -1679,6 +1679,11 @@ export class PageLevel extends BaseView {
// 不论是否有谐音梗,都停留固定时间再弹出通关弹窗,保证节奏一致
await this.delay(PageLevel.PASS_MODAL_DELAY_MS);
if (this._isFinalShareLevel()) {
this._showShareEndPage();
return;
}
// 显示通关弹窗
this._showPassModal();
}
@@ -2016,8 +2021,7 @@ export class PageLevel extends BaseView {
if (this._shareLevelIndex >= totalLevels) {
console.log('[PageLevel] 分享关卡全部完成');
this.stopCountdown();
ShareManager.instance.clearShareMode();
ViewManager.instance.replace('PageHome');
this._showShareEndPage();
return;
}
@@ -2042,4 +2046,19 @@ export class PageLevel extends BaseView {
await this._enterAndInitLevel();
console.log(`[PageLevel] 进入关卡 第${this._currentLevelNumber}`);
}
private _isFinalShareLevel(): boolean {
if (!this._isShareMode) {
return false;
}
const totalLevels = ShareManager.instance.getShareLevelCount();
return totalLevels > 0 && this._shareLevelIndex >= totalLevels - 1;
}
private _showShareEndPage(): void {
console.log('[PageLevel] 分享关卡全部完成,进入 PK 结算页');
this.stopCountdown();
ViewManager.instance.replace('PagePKEnd');
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "4fc485cf-8c22-47f2-80d0-ae366a380cb6",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "PagePKEnd"
}
}

View File

@@ -0,0 +1,55 @@
import { _decorator, Button, Node } from 'cc';
import { BaseView } from 'db://assets/scripts/core/BaseView';
import { ViewManager } from 'db://assets/scripts/core/ViewManager';
import { ShareManager } from 'db://assets/scripts/utils/ShareManager';
const { ccclass, property } = _decorator;
@ccclass('PagePKEnd')
export class PagePKEnd extends BaseView {
@property({ type: Node, tooltip: '返回首页按钮' })
settingButton: Node | null = null;
onViewLoad(): void {
this._resolveNodes();
this._bindEvents();
}
onViewShow(): void {
console.log('[PagePKEnd] onViewShow');
}
onViewDestroy(): void {
this._unbindEvents();
}
private _resolveNodes(): void {
if (!this.settingButton || !this.settingButton.isValid) {
this.settingButton = this.node.getChildByName('SettingButton');
}
if (!this.settingButton) {
console.warn('[PagePKEnd] 未找到 SettingButton 节点');
}
}
private _bindEvents(): void {
const button = this.settingButton?.getComponent(Button);
if (!button) {
console.warn('[PagePKEnd] SettingButton 缺少 Button 组件');
return;
}
this.settingButton?.on(Button.EventType.CLICK, this._onHomeClick, this);
}
private _unbindEvents(): void {
if (this.settingButton && this.settingButton.isValid) {
this.settingButton.off(Button.EventType.CLICK, this._onHomeClick, this);
}
}
private _onHomeClick(): void {
ShareManager.instance.clearShareMode();
ViewManager.instance.replace('PageHome');
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "d1c89ad0-ffa9-4d7b-9fac-e27d810495b4",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -29,22 +29,25 @@
},
{
"__id__": 106
},
{
"__id__": 154
}
],
"_active": true,
"_components": [
{
"__id__": 154
"__id__": 164
},
{
"__id__": 156
"__id__": 166
},
{
"__id__": 158
"__id__": 168
}
],
"_prefab": {
"__id__": 160
"__id__": 170
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -931,7 +934,7 @@
"__uuid__": "5b988a03-f6a3-498f-b68d-d3b5786b1879@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_type": 1,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
@@ -1215,7 +1218,7 @@
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
@@ -3687,6 +3690,240 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "SettingButton",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 155
},
{
"__id__": 157
},
{
"__id__": 159
},
{
"__id__": 161
}
],
"_prefab": {
"__id__": 163
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -408.431,
"y": 931.196,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 154
},
"_enabled": true,
"__prefab": {
"__id__": 156
},
"_contentSize": {
"__type__": "cc.Size",
"width": 115,
"height": 123
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "bauGrsRWBLN77Asy0qAUp1"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 154
},
"_enabled": true,
"__prefab": {
"__id__": 158
},
"clickEvents": [],
"_interactable": true,
"_transition": 0,
"_normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": null,
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
"_duration": 0.1,
"_zoomScale": 1.2,
"_target": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a4lbn1xrJDBrQ6quo7efQ4"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 154
},
"_enabled": true,
"__prefab": {
"__id__": 160
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "7a8edfce-b0ad-41b3-8dc9-ec1c1ee22153@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "178d/akXNFo4OBQH4W6IkK"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 154
},
"_enabled": true,
"__prefab": {
"__id__": 162
},
"_alignFlags": 9,
"_target": null,
"_left": 74.06900000000002,
"_right": 0,
"_top": 87.30399999999997,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6d0LQxInlLpbiQGO3LEpD4"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "d0Wnpx7CpNeqaNIu0J1DFB",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -3697,7 +3934,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 155
"__id__": 165
},
"_contentSize": {
"__type__": "cc.Size",
@@ -3725,7 +3962,7 @@
},
"_enabled": false,
"__prefab": {
"__id__": 157
"__id__": 167
},
"_alignFlags": 45,
"_target": null,
@@ -3761,7 +3998,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 159
"__id__": 169
},
"animationNodes": [
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "0e759b89-8160-47dc-a837-e60d21eb3b9a",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "0e759b89-8160-47dc-a837-e60d21eb3b9a@6c48a",
"displayName": "PrizeCup",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "0e759b89-8160-47dc-a837-e60d21eb3b9a",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "0e759b89-8160-47dc-a837-e60d21eb3b9a@f9941",
"displayName": "PrizeCup",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 284,
"height": 339,
"rawWidth": 284,
"rawHeight": 339,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-142,
-169.5,
0,
142,
-169.5,
0,
-142,
169.5,
0,
142,
169.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
339,
284,
339,
0,
0,
284,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-142,
-169.5,
0
],
"maxPos": [
142,
169.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "0e759b89-8160-47dc-a837-e60d21eb3b9a@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "0e759b89-8160-47dc-a837-e60d21eb3b9a@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "af76cc57-e0fe-459a-a928-e61050f2f163",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "af76cc57-e0fe-459a-a928-e61050f2f163@6c48a",
"displayName": "PicWin2",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "af76cc57-e0fe-459a-a928-e61050f2f163",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "af76cc57-e0fe-459a-a928-e61050f2f163@f9941",
"displayName": "PicWin2",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1356,
"height": 1219,
"rawWidth": 1356,
"rawHeight": 1219,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-678,
-609.5,
0,
678,
-609.5,
0,
-678,
609.5,
0,
678,
609.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1219,
1356,
1219,
0,
0,
1356,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-678,
-609.5,
0
],
"maxPos": [
678,
609.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "af76cc57-e0fe-459a-a928-e61050f2f163@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "af76cc57-e0fe-459a-a928-e61050f2f163@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "a639cd94-406f-4382-a3d9-69ea6b0fa203",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "a639cd94-406f-4382-a3d9-69ea6b0fa203@6c48a",
"displayName": "winBanner2",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "a639cd94-406f-4382-a3d9-69ea6b0fa203",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "a639cd94-406f-4382-a3d9-69ea6b0fa203@f9941",
"displayName": "winBanner2",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": 8,
"trimX": 99,
"trimY": 53,
"width": 764,
"height": 416,
"rawWidth": 963,
"rawHeight": 538,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-382,
-208,
0,
382,
-208,
0,
-382,
208,
0,
382,
208,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
99,
485,
863,
485,
99,
69,
863,
69
],
"nuv": [
0.102803738317757,
0.12825278810408922,
0.8961578400830738,
0.12825278810408922,
0.102803738317757,
0.9014869888475836,
0.8961578400830738,
0.9014869888475836
],
"minPos": [
-382,
-208,
0
],
"maxPos": [
382,
208,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "a639cd94-406f-4382-a3d9-69ea6b0fa203@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "a639cd94-406f-4382-a3d9-69ea6b0fa203@6c48a"
}
}