feat(关卡): 添加关卡锁定和解锁功能

- 在GameEvent枚举中添加新的战斗相关事件
- 实现MissionCardComp的初始化方法处理MissionStart事件
- 添加watchAdCloseLock方法处理广告解锁逻辑
- 修复prefab中Lock节点的引用问题
This commit is contained in:
panw
2026-01-05 11:15:04 +08:00
parent e96d64a454
commit 167297820e
3 changed files with 221 additions and 204 deletions

View File

@@ -29,6 +29,12 @@ export enum GameEvent {
MissionWin = "MissionWin",
MissionStart = "MissionStart",
FightReady = "FightReady",
FightStart = "FightStart",
FightPause = "FightPause",
FightResume = "FightResume",
FightEnd = "FightEnd",
MissionEnd = "MissionEnd",
MissionComplete = "MissionComplete",//战斗结算完成
HeroSkillSelect = "HeroSkillSelect",
HeroSkillSelectEnd = "HeroSkillSelectEnd",
HeroSelect = "HeroSelect",
@@ -36,12 +42,6 @@ export enum GameEvent {
CanUpdateLv = "CanUpdateLv",
UseEnhancement = "UseEnhancement",
MasterCalled = "MasterCalled",
FightStart = "FightStart",
FightPause = "FightPause",
FightResume = "FightResume",
FightEnd = "FightEnd",
MissionEnd = "MissionEnd",
MissionComplete = "MissionComplete",//战斗结算完成
CastHeroSkill = "CastHeroSkill",
EquipAdd = "EquipAdd",
EquipSelect = "EquipSelect",

View File

@@ -49,6 +49,8 @@ export class MissionCardComp extends CCComp {
onLoad() {
oops.message.on(GameEvent.TalentSelect, this.onTalentSelect, this);
oops.message.on(GameEvent.ShopOpen, this.onShopOpen, this);
oops.message.on(GameEvent.MissionStart, this.init, this);
}
onDestroy() {
@@ -56,11 +58,12 @@ export class MissionCardComp extends CCComp {
oops.message.off(GameEvent.ShopOpen, this.onShopOpen, this);
this.ent.destroy();
}
init(){
this.Lock.active=true
}
start() {
// 初始隐藏或显示逻辑
this.node.active = false;
this.Lock.active = true;
this.resetCardStates();
}
@@ -291,6 +294,18 @@ export class MissionCardComp extends CCComp {
}
}
/** 看广告关闭 Lock */
watchAdCloseLock() {
// TODO: 此处接入 IAA 广告 SDK
console.log("播放激励视频广告...");
// 模拟广告播放成功回调
if (this.Lock) {
this.Lock.active = false;
oops.gui.toast("解锁成功");
}
}
/**
* 关闭界面
*/