fix(missionCard): 修复卡牌升级提示逻辑并优化显示
1. 新增全局配置常量CARD_POOL_UPGRADE_WAVES,优先使用任务运行时配置 2. 重构升级波次计算逻辑,新增多种状态的提示文本:本回合升级、即将升级 3. 修复prefab布局,更新升级提示UI的样式和引用 4. 补充边界情况处理,避免配置耗尽后显示异常
This commit is contained in:
@@ -8805,7 +8805,7 @@
|
||||
"__id__": 402
|
||||
},
|
||||
{
|
||||
"__id__": 416
|
||||
"__id__": 408
|
||||
},
|
||||
{
|
||||
"__id__": 422
|
||||
@@ -8861,6 +8861,165 @@
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "next",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 401
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 403
|
||||
},
|
||||
{
|
||||
"__id__": 405
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 407
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -9.033,
|
||||
"y": 43.928,
|
||||
"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__": 402
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 404
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 120.6796875,
|
||||
"height": 54.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "99eDEyYgBNc5FLq74Icoi/"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 402
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 406
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "5 回合后升级",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_enableOutline": true,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 29,
|
||||
"g": 29,
|
||||
"b": 29,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 2,
|
||||
"_enableShadow": false,
|
||||
"_shadowColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_shadowOffset": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 2,
|
||||
"y": 2
|
||||
},
|
||||
"_shadowBlur": 2,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "abHy0d+91LS62B4ZGVmXft"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "2byySOy1xFnbem/25EQ4wg",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_objFlags": 0,
|
||||
@@ -8868,14 +9027,14 @@
|
||||
"__id__": 401
|
||||
},
|
||||
"_prefab": {
|
||||
"__id__": 403
|
||||
"__id__": 409
|
||||
},
|
||||
"__editorExtras__": {}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 402
|
||||
"__id__": 408
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "86a3c4cd-71c7-4502-b713-65f0ace7912a",
|
||||
@@ -8883,7 +9042,7 @@
|
||||
},
|
||||
"fileId": "d3jYvT7whFS5scQFZeO5AK",
|
||||
"instance": {
|
||||
"__id__": 404
|
||||
"__id__": 410
|
||||
},
|
||||
"targetOverrides": null
|
||||
},
|
||||
@@ -8897,25 +9056,25 @@
|
||||
"mountedComponents": [],
|
||||
"propertyOverrides": [
|
||||
{
|
||||
"__id__": 405
|
||||
"__id__": 411
|
||||
},
|
||||
{
|
||||
"__id__": 407
|
||||
},
|
||||
{
|
||||
"__id__": 408
|
||||
},
|
||||
{
|
||||
"__id__": 409
|
||||
},
|
||||
{
|
||||
"__id__": 410
|
||||
},
|
||||
{
|
||||
"__id__": 412
|
||||
"__id__": 413
|
||||
},
|
||||
{
|
||||
"__id__": 414
|
||||
},
|
||||
{
|
||||
"__id__": 415
|
||||
},
|
||||
{
|
||||
"__id__": 416
|
||||
},
|
||||
{
|
||||
"__id__": 418
|
||||
},
|
||||
{
|
||||
"__id__": 420
|
||||
}
|
||||
],
|
||||
"removedComponents": []
|
||||
@@ -8923,7 +9082,7 @@
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 406
|
||||
"__id__": 412
|
||||
},
|
||||
"propertyPath": [
|
||||
"_name"
|
||||
@@ -8939,7 +9098,7 @@
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 406
|
||||
"__id__": 412
|
||||
},
|
||||
"propertyPath": [
|
||||
"_lpos"
|
||||
@@ -8954,7 +9113,7 @@
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 406
|
||||
"__id__": 412
|
||||
},
|
||||
"propertyPath": [
|
||||
"_lrot"
|
||||
@@ -8970,7 +9129,7 @@
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 406
|
||||
"__id__": 412
|
||||
},
|
||||
"propertyPath": [
|
||||
"_euler"
|
||||
@@ -8985,7 +9144,7 @@
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 411
|
||||
"__id__": 417
|
||||
},
|
||||
"propertyPath": [
|
||||
"_string"
|
||||
@@ -9001,7 +9160,7 @@
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 413
|
||||
"__id__": 419
|
||||
},
|
||||
"propertyPath": [
|
||||
"_contentSize"
|
||||
@@ -9021,7 +9180,7 @@
|
||||
{
|
||||
"__type__": "CCPropertyOverrideInfo",
|
||||
"targetInfo": {
|
||||
"__id__": 415
|
||||
"__id__": 421
|
||||
},
|
||||
"propertyPath": [
|
||||
"_contentSize"
|
||||
@@ -9050,14 +9209,14 @@
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 417
|
||||
"__id__": 423
|
||||
},
|
||||
{
|
||||
"__id__": 419
|
||||
"__id__": 425
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 421
|
||||
"__id__": 427
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -9094,11 +9253,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 416
|
||||
"__id__": 422
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 418
|
||||
"__id__": 424
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -9122,11 +9281,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 416
|
||||
"__id__": 422
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 420
|
||||
"__id__": 426
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
@@ -9186,14 +9345,14 @@
|
||||
"_active": false,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 423
|
||||
"__id__": 429
|
||||
},
|
||||
{
|
||||
"__id__": 425
|
||||
"__id__": 431
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 427
|
||||
"__id__": 433
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -9230,11 +9389,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 422
|
||||
"__id__": 428
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 424
|
||||
"__id__": 430
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -9258,11 +9417,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 422
|
||||
"__id__": 428
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 426
|
||||
"__id__": 432
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
@@ -9345,14 +9504,14 @@
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 429
|
||||
"__id__": 435
|
||||
},
|
||||
{
|
||||
"__id__": 431
|
||||
"__id__": 437
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 433
|
||||
"__id__": 439
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -9389,11 +9548,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 428
|
||||
"__id__": 434
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 430
|
||||
"__id__": 436
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
@@ -9417,11 +9576,11 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 428
|
||||
"__id__": 434
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 432
|
||||
"__id__": 438
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
@@ -9492,165 +9651,6 @@
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "next",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 401
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 435
|
||||
},
|
||||
{
|
||||
"__id__": 437
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 439
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -9.033,
|
||||
"y": 43.928,
|
||||
"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__": 434
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 436
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 120.6796875,
|
||||
"height": 54.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "99eDEyYgBNc5FLq74Icoi/"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 434
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 438
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 61,
|
||||
"g": 61,
|
||||
"b": 61,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "5 回合后升级",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_enableOutline": true,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 2,
|
||||
"_enableShadow": false,
|
||||
"_shadowColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_shadowOffset": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 2,
|
||||
"y": 2
|
||||
},
|
||||
"_shadowBlur": 2,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "abHy0d+91LS62B4ZGVmXft"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "2byySOy1xFnbem/25EQ4wg",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
@@ -30640,7 +30640,7 @@
|
||||
"__id__": 448
|
||||
},
|
||||
{
|
||||
"__id__": 402
|
||||
"__id__": 408
|
||||
},
|
||||
{
|
||||
"__id__": 297
|
||||
|
||||
@@ -45,7 +45,7 @@ import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroInfo, HType } from "../common/config/heroSet";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { FacSet, FightSet, CARD_POOL_UPGRADE_WAVES } from "../common/config/GameSet";
|
||||
import { MoveComp } from "../hero/MoveComp";
|
||||
import { MissionHeroComp } from "./MissionHeroComp";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
@@ -1050,26 +1050,35 @@ export class MissionCardComp extends CCComp {
|
||||
if (this.poolLv >= CARD_POOL_MAX_LEVEL) {
|
||||
nextLabel.string = `已满级`;
|
||||
} else {
|
||||
let upgradeWaves: number[] = [5, 10];
|
||||
// 优先取 MissionComp 运行时配置,缺失时回退到全局常量
|
||||
let upgradeWaves: number[] = CARD_POOL_UPGRADE_WAVES;
|
||||
ecs.query(ecs.allOf(MissionComp)).forEach((entity) => {
|
||||
const mission = entity.get(MissionComp);
|
||||
if (mission && mission.cardPoolUpgradeWaves) {
|
||||
if (mission && mission.cardPoolUpgradeWaves && mission.cardPoolUpgradeWaves.length > 0) {
|
||||
upgradeWaves = mission.cardPoolUpgradeWaves;
|
||||
}
|
||||
});
|
||||
|
||||
// 已完成的升级次数 = 当前等级 - 初始等级
|
||||
// 例:poolLv=2(INIT=1)→ 已升 1 次 → 下一升级对应 upgradeWaves[1]
|
||||
const upgradedCount = Math.max(0, Math.floor(this.poolLv) - CARD_POOL_INIT_LEVEL);
|
||||
const currentWave = this.getCurrentWave();
|
||||
let nextWave = -1;
|
||||
for (let i = 0; i < upgradeWaves.length; i++) {
|
||||
if (upgradeWaves[i] > currentWave) {
|
||||
nextWave = upgradeWaves[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nextWave !== -1) {
|
||||
|
||||
if (upgradedCount >= upgradeWaves.length) {
|
||||
// 配置已耗尽但等级未到上限(配置缺陷)
|
||||
nextLabel.string = `已满级`;
|
||||
} else {
|
||||
const nextWave = upgradeWaves[upgradedCount];
|
||||
if (nextWave > currentWave) {
|
||||
const remain = nextWave - currentWave;
|
||||
nextLabel.string = `${remain} 回合后升级`;
|
||||
} else if (nextWave === currentWave) {
|
||||
// 当前波次正好是升级波次(事件可能即将触发或刚刚触发)
|
||||
nextLabel.string = `本回合升级`;
|
||||
} else {
|
||||
nextLabel.string = `已满级`;
|
||||
// nextWave < currentWave:异常状态,升级事件未按时触发
|
||||
nextLabel.string = `即将升级`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user