feat(map): 优化战斗流程与卡牌系统交互
1. 第一波准备阶段首个英雄召唤后自动开战,移除手动点击开始按钮 2. 重构卡牌交互逻辑,移除上划召唤改为点击召唤 3. 新增英雄卡池显隐切换功能 4. 调整卡牌预制体尺寸与布局 5. 移除特定波次技能卡弹窗逻辑 6. 简化引导流程,不再弹出Guide4
This commit is contained in:
@@ -47,7 +47,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, SKILL_CARD_WAVES } from "../common/config/GameSet";
|
||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
|
||||
@@ -98,6 +98,10 @@ export class MissionCardComp extends CCComp {
|
||||
/** 抽卡(刷新)按钮节点 */
|
||||
@property(Node)
|
||||
cards_chou: Node = null!
|
||||
|
||||
/** 英雄卡牌池cards_node显示隐藏 */
|
||||
@property(Node)
|
||||
showHeros: Node = null!
|
||||
/** 卡池升级按钮节点(已废弃,保留节点引用防止 editor 报错) */
|
||||
@property(Node)
|
||||
cards_up: Node = null!
|
||||
@@ -147,7 +151,7 @@ export class MissionCardComp extends CCComp {
|
||||
/** 卡牌面板收起态缩放(scale=0 隐藏) */
|
||||
private cardsHideScale: Vec3 = new Vec3(0, 0, 1);
|
||||
/** 卡牌原始定位点 */
|
||||
private cardsPos = [-260, -75, 108, 260]
|
||||
private cardsPos = [-240, 0, 240]
|
||||
|
||||
// ======================== 生命周期 ========================
|
||||
|
||||
@@ -176,6 +180,9 @@ export class MissionCardComp extends CCComp {
|
||||
this.cards_chou.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
|
||||
this.cards_chou.off(NodeEventType.TOUCH_CANCEL, this.onDrawTouchCancel, this);
|
||||
}
|
||||
if (this.showHeros && this.showHeros.isValid) {
|
||||
this.showHeros.off(NodeEventType.TOUCH_END, this.onShowHerosClick, this);
|
||||
}
|
||||
this.unbindEvents();
|
||||
}
|
||||
|
||||
@@ -218,11 +225,6 @@ export class MissionCardComp extends CCComp {
|
||||
const cards = this.buildDrawCards();
|
||||
this.dispatchCardsToSlots(cards);
|
||||
|
||||
const wave = this.getCurrentWave();
|
||||
if (SKILL_CARD_WAVES.includes(wave)) {
|
||||
this.showSkillCardPopup();
|
||||
}
|
||||
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "mission start");
|
||||
}
|
||||
|
||||
@@ -281,6 +283,9 @@ export class MissionCardComp extends CCComp {
|
||||
this.cards_chou?.on(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
|
||||
this.cards_chou?.on(NodeEventType.TOUCH_CANCEL, this.onDrawTouchCancel, this);
|
||||
|
||||
/** 英雄卡池显示/隐藏切换按钮 */
|
||||
this.showHeros?.on(NodeEventType.TOUCH_END, this.onShowHerosClick, this);
|
||||
|
||||
/** 技能卡刷新按钮 */
|
||||
this.skill_refresh?.on(NodeEventType.TOUCH_START, this.onSkillDrawTouchStart, this);
|
||||
this.skill_refresh?.on(NodeEventType.TOUCH_END, this.onSkillDrawTouchEnd, this);
|
||||
@@ -369,11 +374,6 @@ export class MissionCardComp extends CCComp {
|
||||
this.layoutCardSlots();
|
||||
const cards = this.buildDrawCards();
|
||||
this.dispatchCardsToSlots(cards);
|
||||
|
||||
const wave = this.getCurrentWave();
|
||||
if (SKILL_CARD_WAVES.includes(wave)) {
|
||||
this.showSkillCardPopup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,6 +462,9 @@ export class MissionCardComp extends CCComp {
|
||||
this.cards_chou.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
|
||||
this.cards_chou.off(NodeEventType.TOUCH_CANCEL, this.onDrawTouchCancel, this);
|
||||
}
|
||||
if (this.showHeros && this.showHeros.isValid) {
|
||||
this.showHeros.off(NodeEventType.TOUCH_END, this.onShowHerosClick, 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);
|
||||
@@ -490,15 +493,12 @@ export class MissionCardComp extends CCComp {
|
||||
const after = this.getAliveHeroCount();
|
||||
this.updateHeroNumUI(true, after > before);
|
||||
|
||||
// 第一次召唤英雄后,关闭guide3,打开guide4
|
||||
// 第一次召唤英雄后,关闭guide3
|
||||
// 注:首个英雄召唤后战斗自动开始(见 MissionComp),不再需要 Guide4 引导点击开始按钮
|
||||
if (!smc.finish_guides.includes(3)) {
|
||||
smc.finish_guides.push(3);
|
||||
oops.gui.remove(UIID.Guide3);
|
||||
}
|
||||
|
||||
if (!smc.finish_guides.includes(4)) {
|
||||
oops.gui.open(UIID.Guide4);
|
||||
}
|
||||
}
|
||||
|
||||
/** 英雄死亡事件回调:刷新面板列表并更新英雄数量 UI */
|
||||
@@ -582,6 +582,22 @@ export class MissionCardComp extends CCComp {
|
||||
this.playButtonResetAnim(this.cards_chou);
|
||||
}
|
||||
|
||||
/**
|
||||
* 英雄卡池显隐切换按钮回调:
|
||||
* - 切换 cards_node 的 active 状态。
|
||||
* - 显示时激活 showHeros 下的 "active" 子节点,隐藏时关闭该子节点。
|
||||
*/
|
||||
private onShowHerosClick() {
|
||||
if (!this.cards_node || !this.cards_node.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
const visible = !this.cards_node.active;
|
||||
this.cards_node.active = visible;
|
||||
const activeChild = this.showHeros?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
activeChild.active = visible;
|
||||
}
|
||||
}
|
||||
|
||||
// ======================== 技能抽卡按钮回调 ========================
|
||||
private onSkillDrawTouchStart() {
|
||||
this.playButtonPressAnim(this.skill_refresh);
|
||||
|
||||
Reference in New Issue
Block a user