2 Commits

Author SHA1 Message Date
pan
2234b9021d feat(MissionCard): 添加英雄卡池关闭按钮功能
新增closeHeros节点绑定与点击回调,实现卡池收起逻辑,同步更新卡池显示状态与英雄信息面板。
优化进入准备阶段的交互表现,确保卡池初始状态与手动操作一致。
2026-07-21 16:12:38 +08:00
pan
d279ef19d8 fix(card prefab): 修复卡牌预制体的节点和属性配置
新增了金币不足提示的预制体实例,调整了部分节点的位置和尺寸参数,修正了prefab关联ID,添加了缺失的no_cion_node节点引用
2026-07-21 15:07:42 +08:00
3 changed files with 6572 additions and 5001 deletions

View File

@@ -56,19 +56,22 @@
},
{
"__id__": 327
},
{
"__id__": 345
}
],
"_active": true,
"_components": [
{
"__id__": 345
"__id__": 358
},
{
"__id__": 347
"__id__": 360
}
],
"_prefab": {
"__id__": 349
"__id__": 362
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -5704,7 +5707,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 21.628,
"y": -150.598,
"z": 0
},
"_lrot": {
@@ -5798,7 +5801,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 320,
"height": 160
"height": 140
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -6079,7 +6082,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 170,
"height": 80
"height": 70
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -6111,7 +6114,7 @@
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 21.628,
"_verticalCenter": -150.598,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
@@ -6540,6 +6543,173 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_prefab": {
"__id__": 346
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 345
},
"asset": {
"__uuid__": "86a3c4cd-71c7-4502-b713-65f0ace7912a",
"__expectedType__": "cc.Prefab"
},
"fileId": "d3jYvT7whFS5scQFZeO5AK",
"instance": {
"__id__": 347
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "b9hVFK1DdEqaNXdQBium+4",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 348
},
{
"__id__": 350
},
{
"__id__": 351
},
{
"__id__": 352
},
{
"__id__": 353
},
{
"__id__": 354
},
{
"__id__": 356
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 349
},
"propertyPath": [
"_name"
],
"value": "smalltip"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"d3jYvT7whFS5scQFZeO5AK"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 349
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": -5.684341886080802e-14,
"y": 92.34199999999998,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 349
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 349
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 349
},
"propertyPath": [
"_active"
],
"value": false
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 355
},
"propertyPath": [
"_string"
],
"value": "金币不足"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"52GlHcXJZDJqYfTH62X5lp"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 357
},
"propertyPath": [
"_contentSize"
],
"value": {
"__type__": "cc.Size",
"width": 84,
"height": 54.4
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"11pqUo9t9IWYWj/LjK3fNo"
]
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -6550,7 +6720,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 346
"__id__": 359
},
"_contentSize": {
"__type__": "cc.Size",
@@ -6578,7 +6748,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 348
"__id__": 361
},
"Lock": null,
"unLock": null,
@@ -6615,6 +6785,9 @@
"hp_node": {
"__id__": 223
},
"no_cion_node": {
"__id__": 345
},
"_id": ""
},
{
@@ -6633,6 +6806,9 @@
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": [
{
"__id__": 345
},
{
"__id__": 183
},

File diff suppressed because it is too large Load Diff

View File

@@ -102,6 +102,9 @@ export class MissionCardComp extends CCComp {
/** 英雄卡牌池cards_node显示隐藏 */
@property(Node)
showHeros: Node = null!
/** 关闭英雄卡池按钮(仅负责收起 cards_node */
@property(Node)
closeHeros: Node = null!
/** 卡池升级按钮节点(已废弃,保留节点引用防止 editor 报错) */
@property(Node)
cards_up: Node = null!
@@ -188,6 +191,9 @@ export class MissionCardComp extends CCComp {
if (this.showHeros && this.showHeros.isValid) {
this.showHeros.off(NodeEventType.TOUCH_END, this.onShowHerosClick, this);
}
if (this.closeHeros && this.closeHeros.isValid) {
this.closeHeros.off(NodeEventType.TOUCH_END, this.onCloseHerosClick, this);
}
this.unbindEvents();
}
@@ -289,6 +295,8 @@ export class MissionCardComp extends CCComp {
/** 英雄卡池显示/隐藏切换按钮 */
this.showHeros?.on(NodeEventType.TOUCH_END, this.onShowHerosClick, this);
/** 关闭英雄卡池按钮 */
this.closeHeros?.on(NodeEventType.TOUCH_END, this.onCloseHerosClick, this);
/** 技能卡刷新按钮 */
this.skill_refresh?.on(NodeEventType.TOUCH_START, this.onSkillDrawTouchStart, this);
@@ -460,6 +468,9 @@ export class MissionCardComp extends CCComp {
if (this.showHeros && this.showHeros.isValid) {
this.showHeros.off(NodeEventType.TOUCH_END, this.onShowHerosClick, this);
}
if (this.closeHeros && this.closeHeros.isValid) {
this.closeHeros.off(NodeEventType.TOUCH_END, this.onCloseHerosClick, this);
}
if (this.skill_refresh && this.skill_refresh.isValid) {
this.skill_refresh.off(NodeEventType.TOUCH_START, this.onSkillDrawTouchStart, this);
this.skill_refresh.off(NodeEventType.TOUCH_END, this.onSkillDrawTouchEnd, this);
@@ -593,6 +604,24 @@ export class MissionCardComp extends CCComp {
}
}
/**
* 关闭英雄卡池按钮回调:
* - 仅负责收起 cards_node不切换展开态。
* - 同步关闭 showHeros 下的 "active" 子节点,保持与 toggle 状态一致。
* - 同步关闭已打开的英雄信息面板HInfo避免卡池收起后信息面板孤立悬浮。
*/
private onCloseHerosClick() {
if (!this.cards_node || !this.cards_node.isValid) return;
oops.audio.playEffect("music/button");
this.cards_node.active = false;
const activeChild = this.showHeros?.getChildByName("active");
if (activeChild) {
activeChild.active = false;
}
// 关闭英雄卡池时同步关闭已打开的英雄信息面板
oops.gui.remove(UIID.HInfo);
}
// ======================== 技能抽卡按钮回调 ========================
private onSkillDrawTouchStart() {
this.playButtonPressAnim(this.skill_refresh);
@@ -693,19 +722,33 @@ export class MissionCardComp extends CCComp {
this.cardsHideScale = new Vec3(0, 0, this.cardsBaseScale.z);
}
/** 进入准备阶段:展开卡牌面板(立即恢复缩放,无动画) */
/**
* 进入准备阶段:
* - 先将卡牌面板置为收起态,激活 showHeros 按钮可见。
* - 再触发一次 onShowHerosClick等同玩家点击 showHeros 按钮),
* 让卡池以"按钮点击"的方式展开,保持与玩家手动点击一致的交互表现。
*/
private enterPreparePhase() {
if (!this.cards_node || !this.cards_node.isValid) return;
this.initCardsPanelPos();
this.cards_node.active = true;
// 先收起面板,确保后续 onShowHerosClick 能正确切换为展开
Tween.stopAllByTarget(this.cards_node);
this.cards_node.setScale(this.cardsShowScale);
this.cards_node.active = false;
// 显式激活「显示英雄卡池」按钮本身,让玩家可见可点
if (this.showHeros && this.showHeros.isValid) {
this.showHeros.active = true;
const showActive = this.showHeros.getChildByName("active");
if (showActive) showActive.active = false;
}
if (this.cards_chou && this.cards_chou.isValid) {
const nobg = this.cards_chou.getChildByName("nobg");
if (nobg) {
nobg.active = !this.canDrawCards();
}
}
// 触发一次 showHeros 按钮点击效果,自动展开卡池
this.onShowHerosClick();
}
private enterBattlePhase() {