2 Commits

Author SHA1 Message Date
panw
24c32549c0 fix(ui): 调整卡牌预制体尺寸并修复开始按钮状态逻辑
- 修正卡牌预制体的局部位置、尺寸模式和内容大小,优化显示效果
- 隐藏预制体中不必要的节点以提升性能
- 重构开始按钮状态控制逻辑,改为根据游戏阶段动态更新按钮的可点击状态
- 移除直接隐藏按钮的代码,确保按钮在准备阶段且未暂停时可点击
2026-04-21 16:57:49 +08:00
panw
73ca2ffbf0 feat(界面): 为任务阶段切换添加缩放动画效果
在任务阶段切换时,为阶段节点添加缩放动画,提升视觉反馈和心流体验。动画在准备开始/结束和战斗开始/结束阶段触发,包含放大和回弹效果。
2026-04-21 15:39:15 +08:00
4 changed files with 716 additions and 502 deletions

View File

@@ -863,7 +863,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0.5,
"y": 0,
"z": 0
},
"_lrot": {
@@ -995,7 +995,7 @@
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
@@ -1042,8 +1042,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 164,
"height": 223
"width": 156,
"height": 210
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -3243,7 +3243,7 @@
"__id__": 181
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 189
@@ -8440,7 +8440,7 @@
"__id__": 390
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 396

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,3 @@
盾战获得护盾抵御3次攻击
攻击类型:
普通: 近战无
普通魔法:水球
@@ -27,3 +25,11 @@
战斗开始技能触发2次
战斗结束技能触发2次
被攻击技能触发2次
战士1普通攻击 被攻击3次获得3次格挡的护盾
战士2
战士3
战士4
战士5

View File

@@ -27,7 +27,7 @@
* - CardInitCoins —— 初始金币数
* - UIID.Victory —— 结算弹窗
*/
import { _decorator, Vec3,Animation, instantiate, Prefab, Node, NodeEventType, ProgressBar, Label, CCInteger } from "cc";
import { _decorator, Vec3,Animation, instantiate, Prefab, Node, NodeEventType, ProgressBar, Label, CCInteger, tween, v3, Tween } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
@@ -288,6 +288,17 @@ export class MissionComp extends CCComp {
},0.5)
}
/** 更新开始按钮的状态显示 */
private updateStartBtnState() {
if (!this.start_btn || !this.start_btn.isValid) return;
const nobg = this.start_btn.getChildByName("nobg");
if (nobg) {
// 只有在 Prepare 阶段且未暂停时,按钮才可点击,否则激活 nobg显示不可点击状态
const canClick = this.currentPhase === MissionPhase.Prepare && smc.mission.play && !smc.mission.pause;
nobg.active = !canClick;
}
}
/**
* 阶段切换核心方法(状态机)
* 处理状态流转时所需的事件触发和全局标志位修改。
@@ -306,6 +317,19 @@ export class MissionComp extends CCComp {
if (label) {
label.string = MissionComp.PhaseNameMap[targetPhase] || "未知";
}
// 阶段切换动感表现:针对阶段变化加入缩放与回弹动画,让流程充满心流体验
if (targetPhase === MissionPhase.PrepareStart ||
targetPhase === MissionPhase.PrepareEnd ||
targetPhase === MissionPhase.BattleStart ||
targetPhase === MissionPhase.BattleEnd) {
Tween.stopAllByTarget(phaseNode);
phaseNode.scale = v3(0.5, 0.5, 1);
tween(phaseNode)
.to(0.3, { scale: v3(1.5, 1.5, 1) }, { easing: "backOut" })
.to(0.2, { scale: v3(1, 1, 1) }, { easing: "sineInOut" })
.start();
}
}
}
@@ -317,7 +341,7 @@ export class MissionComp extends CCComp {
smc.mission.in_fight = false;
smc.vmdata.mission_data.in_fight = false;
smc.mission.stop_spawn_mon = true;
if (this.start_btn && this.start_btn.isValid) this.start_btn.active = false;
// 不隐藏开始按钮,点击事件在 onStartFightBtnClick 内部做了阶段拦截
break;
case MissionPhase.Prepare:
@@ -325,7 +349,7 @@ export class MissionComp extends CCComp {
break;
case MissionPhase.PrepareEnd:
if (this.start_btn && this.start_btn.isValid) this.start_btn.active = false;
// 不隐藏开始按钮
oops.message.dispatchEvent("PhasePrepareEnd");
break;
@@ -353,7 +377,7 @@ export class MissionComp extends CCComp {
smc.mission.in_fight = false;
smc.vmdata.mission_data.in_fight = false;
smc.mission.stop_spawn_mon = true;
if (this.start_btn && this.start_btn.isValid) this.start_btn.active = false;
// 不隐藏开始按钮
break;
case MissionPhase.None:
@@ -363,6 +387,9 @@ export class MissionComp extends CCComp {
if (this.start_btn && this.start_btn.isValid) this.start_btn.active = false;
break;
}
// 阶段切换后更新按钮状态
this.updateStartBtnState();
}
/** 自动流转到下一阶段(过渡状态结束时调用) */