refactor(mission): 调整刷新石消耗逻辑并统一配置

1. 新增刷新石单次消耗常量配置到GameSet
2. 重构刷新消耗计算逻辑,统一从配置读取消耗值
3. 更新UI显示逻辑,正确展示单次刷新所需刷新石数量
4. 修复刷新石扣除逻辑,按实际配置值扣除而非固定1
This commit is contained in:
panFD
2026-07-31 20:22:43 +08:00
parent 7124b88201
commit 34b0443ccb
3 changed files with 27 additions and 15 deletions

View File

@@ -1699,10 +1699,11 @@ export class MissionCardComp extends CCComp {
private updateDrawCostUI() {
const stones = MissionEconomy.getRefreshStone();
this.updateOneRefreshBtnUI(this.cards_chou, stones);
this.updateOneRefreshBtnUI(this.equip_refresh, stones);
this.updateOneRefreshBtnUI(this.shop_refresh, stones);
this.updateOneRefreshBtnUI(this.skill_refresh, stones);
const stoneCost = MissionEconomy.getRefreshStoneCost();
this.updateOneRefreshBtnUI(this.cards_chou, stones, stoneCost);
this.updateOneRefreshBtnUI(this.equip_refresh, stones, stoneCost);
this.updateOneRefreshBtnUI(this.shop_refresh, stones, stoneCost);
this.updateOneRefreshBtnUI(this.skill_refresh, stones, stoneCost);
}
/**
@@ -1717,11 +1718,13 @@ export class MissionCardComp extends CCComp {
*
* @param btnNode 刷新按钮节点
* @param stones 当前刷新石数量(外部统一读取,避免 4 次重复访问)
* @param stoneCost 单次刷新消耗的刷新石数量
*/
private updateOneRefreshBtnUI(btnNode: Node | null, stones: number) {
private updateOneRefreshBtnUI(btnNode: Node | null, stones: number, stoneCost: number) {
if (!btnNode || !btnNode.isValid) return;
const useStone = stones > 0;
// 刷新石足够一次消耗时走刷新石通道,否则走金币通道
const useStone = stones >= stoneCost;
// 置灰遮罩:有刷新石必定可刷新,否则按金币判断
const nobg = btnNode.getChildByName("nobg");
@@ -1745,14 +1748,14 @@ export class MissionCardComp extends CCComp {
}
}
// 刷新石费用节点(显示当前持有数量)
// 刷新石费用节点(显示单次刷新消耗数量)
const stoneNode = container.getChildByName("stone");
if (stoneNode) {
stoneNode.active = useStone;
if (useStone) {
const numLabel = stoneNode.getChildByName("num")?.getComponent(Label);
if (numLabel) {
numLabel.string = `${stones}`;
numLabel.string = `${stoneCost}`;
}
}
}