feat(关卡系统): 添加关卡解锁和免广告功能

- 在MissionComp和SCDSystem中添加stop_mon_action检查逻辑
- 修改SingletonModuleComp数据结构,添加noStop和unlockCoin字段
- 为MissionCardComp添加金币解锁和免广告功能
- 调整ubtns.plist的边框值
This commit is contained in:
walkpan
2026-01-06 19:47:11 +08:00
parent bb28492550
commit 0febe02ecc
6 changed files with 4322 additions and 986 deletions

View File

@@ -31,6 +31,10 @@ export class MissionCardComp extends CCComp {
@property(Node)
Lock: Node = null!
@property(Node)
unLock: Node = null!
@property(Node)
noStop: Node = null!
card1_data:any = null!
card2_data:any = null!
@@ -42,6 +46,8 @@ export class MissionCardComp extends CCComp {
// 是否处于锁定状态
private isLocked: boolean = true;
// 是否永久解锁(本局)
private isAdUnlocked: boolean = false;
onLoad() {
if (this.btnClose) {
@@ -78,7 +84,9 @@ export class MissionCardComp extends CCComp {
/** 游戏开始初始化 */
onMissionStart() {
this.isLocked = true;
this.isAdUnlocked = false;
if (this.Lock) this.Lock.active = false; // 初始不显示,等待 showCardType
if(this.unLock) this.unLock.active=false
this.eventQueue = [];
}
@@ -164,11 +172,23 @@ export class MissionCardComp extends CCComp {
this.Lock.active = this.isLocked;
}
// 显示 noStop 节点
if (this.noStop) {
this.noStop.active = true;
this.checkNoStop()
}
this.resetCardStates();
this.refCards();
this.playShowAnimation();
}
checkNoStop(){
this.noStop.getChildByName("no").active=!smc.data.noStop
}
switchNoStop(){
smc.data.noStop=!smc.data.noStop
this.checkNoStop()
}
private playShowAnimation() {
const cards = [this.card1, this.card2, this.card3, this.card4];
cards.forEach((card, index) => {
@@ -314,12 +334,49 @@ export class MissionCardComp extends CCComp {
// 模拟广告播放成功回调
this.isLocked = false;
this.isAdUnlocked = true;
if (this.Lock) {
this.Lock.active = false;
oops.gui.toast("解锁成功");
}
}
coinCloseLock(){
let cost = smc.vmdata.mission_data.unlockCoin;
if (smc.vmdata.gold >= cost) {
// 扣除金币
if (smc.updateGold(-cost)) {
this.isLocked = false;
if (this.Lock) {
this.Lock.active = false;
}
oops.gui.toast("解锁成功");
this.closeUnLock();
} else {
oops.gui.toast("交易失败");
}
} else {
oops.gui.toast("金币不足");
}
}
showUnLock(){
if (this.unLock) {
this.unLock.active = true;
this.unLock.setScale(Vec3.ZERO);
tween(this.unLock)
.to(0.2, { scale: new Vec3(1, 1, 1) }, { easing: 'backOut' })
.start();
}
}
closeUnLock(){
if (this.unLock && this.unLock.active) {
tween(this.unLock)
.to(0.2, { scale: Vec3.ZERO }, { easing: 'backIn' })
.call(() => {
this.unLock.active = false;
})
.start();
}
}
/** 放弃选择 */
onGiveUp() {
if (this.hasSelected) return;
@@ -361,6 +418,16 @@ export class MissionCardComp extends CCComp {
this.Lock.active = false;
}
// 关闭时隐藏 noStop 节点
if (this.noStop) {
this.noStop.active = false;
}
// 恢复锁定状态(如果没有永久解锁)
if (!this.isAdUnlocked) {
this.isLocked = true;
}
this.checkQueue();
}

View File

@@ -46,6 +46,7 @@ export class MissionComp extends CCComp {
if(!smc.mission.play) return
if(smc.mission.pause) return
if(smc.mission.in_fight){
if(smc.mission.stop_mon_action) return
smc.vmdata.mission_data.fight_time+=dt
smc.vmdata.mission_data.time-=dt
}