refactor(map): 重构小气泡提示逻辑,统一组件管理

1. 新增SmallTipComp组件封装气泡提示动画逻辑
2. 移除TalentsComp中切换阶位的解锁提示弹窗
3. 重构HerosListComp的小提示逻辑,复用通用组件
4. 修改顶部UI的资源监听路径为钻石数据
This commit is contained in:
pan
2026-09-01 16:26:41 +08:00
parent 2d13427d7d
commit 8e1c81adb0
5 changed files with 735 additions and 302 deletions

View File

@@ -28,6 +28,7 @@ import { GameEvent } from "../common/config/GameEvent";
import { HERO_UPGRADE_NEED_FRAGMENTS, CARD_LV_BG_COLORS } from "../common/config/GameSet";
import { CardLiteComp } from "./CardLiteComp";
import { ChipComp } from "./ChipComp";
import { SmallTipComp } from "./SmallTipComp";
import { SSkillBoxComp } from "./SSkillBoxComp";
import { smc } from "../common/SingletonModuleComp";
@@ -142,9 +143,12 @@ export class HerosListComp extends CCComp {
return
}
// 确保 smalltip 气泡初始隐藏,避免遮挡按钮触摸
// 确保 smalltip 气泡初始隐藏,避免遮挡按钮触摸(组件缺失时兜底补挂)
const tipNode = this.upgrade_btn.getChildByName("smalltip")
if (tipNode) tipNode.active = false
if (tipNode) {
const tip = tipNode.getComponent(SmallTipComp) ?? tipNode.addComponent(SmallTipComp)
tipNode.active = false
}
let btn = this.upgrade_btn.getComponent(Button)
if (!btn) btn = this.upgrade_btn.addComponent(Button)
@@ -276,33 +280,14 @@ export class HerosListComp extends CCComp {
* @param text 提示文案
*/
private showSmallTip(text: string) {
// smalltip 作为 upgrade_btn 的子节点挂在下面
// smalltip 作为 upgrade_btn 的子节点挂在下面,统一走 SmallTipComp 播动画
const tipNode = this.upgrade_btn?.getChildByName("smalltip")
if (!tipNode || !tipNode.isValid) {
mLogger.log(this.debugMode, "HerosListComp", `未在 upgrade_btn 下找到 smalltip 节点,无法提示:${text}`)
return
}
// 覆盖气泡文字
const label = tipNode.getComponentInChildren(Label)
if (label) label.string = text
tipNode.active = true
Tween.stopAllByTarget(tipNode)
tipNode.setScale(0, 0, 1)
tween(tipNode)
// 弹出动画(微放大再回弹)
.to(0.15, { scale: new Vec3(1.1, 1.1, 1) }, { easing: 'quadOut' })
.to(0.05, { scale: new Vec3(1, 1, 1) })
// 停留 1 秒
.delay(1)
// 缩小消失
.to(0.15, { scale: new Vec3(0, 0, 1) }, { easing: 'quadIn' })
.call(() => {
if (tipNode && tipNode.isValid) tipNode.active = false
})
.start()
const tip = tipNode.getComponent(SmallTipComp) ?? tipNode.addComponent(SmallTipComp)
tip.show(text)
}
// ======================== 卡片列表 ========================