Compare commits
2 Commits
575b9cf4d3
...
eec455cbd9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eec455cbd9 | ||
|
|
e6395ba018 |
@@ -74,6 +74,7 @@ export enum GameEvent {
|
|||||||
UpdateMissionGet = "UpdateMissionGet",
|
UpdateMissionGet = "UpdateMissionGet",
|
||||||
GlobalAttrChange = "GlobalAttrChange",
|
GlobalAttrChange = "GlobalAttrChange",
|
||||||
CoinAdd = "CoinAdd",
|
CoinAdd = "CoinAdd",
|
||||||
|
ShowSmallTip = "ShowSmallTip",
|
||||||
CardPoolUpgrade = "CardPoolUpgrade",
|
CardPoolUpgrade = "CardPoolUpgrade",
|
||||||
TriggerSkill = "TriggerSkill", // 瞬间触发施法事件
|
TriggerSkill = "TriggerSkill", // 瞬间触发施法事件
|
||||||
RemoveSkillBox = "RemoveSkillBox", // 技能盒销毁事件
|
RemoveSkillBox = "RemoveSkillBox", // 技能盒销毁事件
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ export class CardComp extends CCComp {
|
|||||||
// 使用统一经济管理入口消费金币
|
// 使用统一经济管理入口消费金币
|
||||||
const success = MissionEconomy.spendCoin(cardCost);
|
const success = MissionEconomy.spendCoin(cardCost);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
oops.gui.toast(`金币不足,召唤需要${cardCost}`);
|
oops.message.dispatchEvent(GameEvent.ShowSmallTip, "buy_coin");
|
||||||
this.playReboundAnim();
|
this.playReboundAnim();
|
||||||
mLogger.log(this.debugMode, "CardComp", "use card coin not enough", {
|
mLogger.log(this.debugMode, "CardComp", "use card coin not enough", {
|
||||||
uuid: this.cardData.uuid,
|
uuid: this.cardData.uuid,
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
oops.message.on(GameEvent.UseSkillCard, this.onUseSkillCard, this);
|
oops.message.on(GameEvent.UseSkillCard, this.onUseSkillCard, this);
|
||||||
oops.message.on(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
|
oops.message.on(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
|
||||||
oops.message.on(GameEvent.CardPoolUpgrade, this.onCardPoolUpgrade, this);
|
oops.message.on(GameEvent.CardPoolUpgrade, this.onCardPoolUpgrade, this);
|
||||||
|
oops.message.on(GameEvent.ShowSmallTip, this.onShowSmallTip, this);
|
||||||
|
|
||||||
/** 按钮触控事件:抽卡与卡池升级 */
|
/** 按钮触控事件:抽卡与卡池升级 */
|
||||||
this.cards_chou?.on(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
|
this.cards_chou?.on(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
|
||||||
@@ -358,12 +359,58 @@ export class MissionCardComp extends CCComp {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 提示卡池升级
|
// 提示卡池升级
|
||||||
oops.gui.toast(`卡池已升至${this.poolLv}级`);
|
this.showSmallTip("pool_upgrade");
|
||||||
|
|
||||||
// 更新UI
|
// 更新UI
|
||||||
this.updatePoolLvUI();
|
this.updatePoolLvUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onShowSmallTip(event: string, args: any) {
|
||||||
|
const type = args as string;
|
||||||
|
this.showSmallTip(type as any);
|
||||||
|
}
|
||||||
|
|
||||||
|
public showSmallTip(type: "refresh_coin" | "pool_upgrade" | "buy_coin" | "hero_full") {
|
||||||
|
let targetNode: Node | null = null;
|
||||||
|
switch (type) {
|
||||||
|
case "refresh_coin":
|
||||||
|
targetNode = this.cards_chou;
|
||||||
|
break;
|
||||||
|
case "pool_upgrade":
|
||||||
|
targetNode = this.pool_lv_node;
|
||||||
|
break;
|
||||||
|
case "buy_coin":
|
||||||
|
targetNode = this.coins_node;
|
||||||
|
break;
|
||||||
|
case "hero_full":
|
||||||
|
targetNode = this.hero_num_node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (targetNode && targetNode.isValid) {
|
||||||
|
const tipNode = targetNode.getChildByName("smalltip");
|
||||||
|
if (tipNode) {
|
||||||
|
tipNode.active = true;
|
||||||
|
Tween.stopAllByTarget(tipNode);
|
||||||
|
|
||||||
|
// 设置初始状态:缩放为 0
|
||||||
|
tipNode.setScale(new Vec3(0, 0, 1));
|
||||||
|
|
||||||
|
tween(tipNode)
|
||||||
|
// 1. 弹出动画(微放大再回弹)
|
||||||
|
.to(0.15, { scale: new Vec3(1.1, 1.1, 1) }, { easing: 'quadOut' })
|
||||||
|
.to(0.05, { scale: new Vec3(1, 1, 1) })
|
||||||
|
// 2. 停留 1 秒
|
||||||
|
.delay(1)
|
||||||
|
// 3. 缩小消失动画
|
||||||
|
.to(0.15, { scale: new Vec3(0, 0, 1) }, { easing: 'quadIn' })
|
||||||
|
.call(() => {
|
||||||
|
if (tipNode && tipNode.isValid) tipNode.active = false;
|
||||||
|
})
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private onPhasePrepareStart() {
|
private onPhasePrepareStart() {
|
||||||
this.updateHeroNumUI(true, true);
|
this.updateHeroNumUI(true, true);
|
||||||
}
|
}
|
||||||
@@ -469,6 +516,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
oops.message.off(GameEvent.UseSkillCard, this.onUseSkillCard, this);
|
oops.message.off(GameEvent.UseSkillCard, this.onUseSkillCard, this);
|
||||||
oops.message.off(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
|
oops.message.off(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
|
||||||
oops.message.off(GameEvent.CardPoolUpgrade, this.onCardPoolUpgrade, this);
|
oops.message.off(GameEvent.CardPoolUpgrade, this.onCardPoolUpgrade, this);
|
||||||
|
oops.message.off(GameEvent.ShowSmallTip, this.onShowSmallTip, this);
|
||||||
if (this.cards_chou && this.cards_chou.isValid) {
|
if (this.cards_chou && this.cards_chou.isValid) {
|
||||||
this.cards_chou.off(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
|
this.cards_chou.off(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
|
||||||
this.cards_chou.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
|
this.cards_chou.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
|
||||||
@@ -558,7 +606,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
payload.cancel = true;
|
payload.cancel = true;
|
||||||
payload.reason = "hero_limit";
|
payload.reason = "hero_limit";
|
||||||
oops.gui.toast(`英雄已满 (${current}/${heroMax})`);
|
this.showSmallTip("hero_full");
|
||||||
this.playHeroNumDeniedAnim();
|
this.playHeroNumDeniedAnim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -678,7 +726,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
const cost = MissionEconomy.getRefreshCost(this.refreshCost);
|
const cost = MissionEconomy.getRefreshCost(this.refreshCost);
|
||||||
const success = MissionEconomy.executeRefresh(this.refreshCost);
|
const success = MissionEconomy.executeRefresh(this.refreshCost);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
oops.gui.toast(`金币不足,刷新需要${cost}`);
|
this.showSmallTip("refresh_coin");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cards = this.buildSkillDrawCards();
|
const cards = this.buildSkillDrawCards();
|
||||||
@@ -735,7 +783,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
const cost = MissionEconomy.getRefreshCost(this.refreshCost);
|
const cost = MissionEconomy.getRefreshCost(this.refreshCost);
|
||||||
const success = MissionEconomy.executeRefresh(this.refreshCost);
|
const success = MissionEconomy.executeRefresh(this.refreshCost);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
oops.gui.toast(`金币不足,刷新需要${cost}`);
|
this.showSmallTip("refresh_coin");
|
||||||
this.updateCoinAndCostUI();
|
this.updateCoinAndCostUI();
|
||||||
mLogger.log(this.debugMode, "MissionCardComp", "draw coin not enough", {
|
mLogger.log(this.debugMode, "MissionCardComp", "draw coin not enough", {
|
||||||
currentCoin: MissionEconomy.getCoin(),
|
currentCoin: MissionEconomy.getCoin(),
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export class SCardComp extends CCComp {
|
|||||||
|
|
||||||
const success = MissionEconomy.spendCoin(cardCost);
|
const success = MissionEconomy.spendCoin(cardCost);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
oops.gui.toast(`金币不足,需要${cardCost}`);
|
oops.message.dispatchEvent(GameEvent.ShowSmallTip, "buy_coin");
|
||||||
this.playReboundAnim();
|
this.playReboundAnim();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user