Compare commits
3 Commits
2d13427d7d
...
4263997124
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4263997124 | ||
|
|
38cc214bd4 | ||
|
|
8e1c81adb0 |
@@ -26,10 +26,13 @@
|
|||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 30
|
"__id__": 30
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 32
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 32
|
"__id__": 34
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -187,8 +190,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 300,
|
"width": 399.6,
|
||||||
"height": 140
|
"height": 159.6
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -322,7 +325,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": -35.2,
|
"y": -40.1,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -534,7 +537,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 84,
|
"width": 149.9,
|
||||||
"height": 54.4
|
"height": 54.4
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -570,14 +573,14 @@
|
|||||||
"b": 255,
|
"b": 255,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_string": "卡成升级",
|
"_string": "卡成升级........................",
|
||||||
"_horizontalAlign": 1,
|
"_horizontalAlign": 1,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 20,
|
"_actualFontSize": 21,
|
||||||
"_fontSize": 20,
|
"_fontSize": 20,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 23,
|
||||||
"_overflow": 0,
|
"_overflow": 2,
|
||||||
"_enableWrapText": true,
|
"_enableWrapText": true,
|
||||||
"_font": null,
|
"_font": null,
|
||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
@@ -643,8 +646,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 150,
|
"width": 199.8,
|
||||||
"height": 70
|
"height": 79.8
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -743,6 +746,24 @@
|
|||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "1ctkO0TStCjK1FILIEJzwK"
|
"fileId": "1ctkO0TStCjK1FILIEJzwK"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "366cayIQXtAzJLimznQOpMz",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 33
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "ffW/hlSrtP1I4iporD0DuU"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
"root": {
|
"root": {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1628,7 +1628,7 @@
|
|||||||
"watchPath": "data.data.gold",
|
"watchPath": "data.data.gold",
|
||||||
"labelType": "cc.Label",
|
"labelType": "cc.Label",
|
||||||
"watchPathArr": [
|
"watchPathArr": [
|
||||||
"data.gold"
|
"data.diamond"
|
||||||
],
|
],
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,13 @@ export default class HeroAnmComp extends Component {
|
|||||||
this._hasStop = true;
|
this._hasStop = true;
|
||||||
}
|
}
|
||||||
onAnimationFinished(type: Animation.EventType, state: AnimationState) {
|
onAnimationFinished(type: Animation.EventType, state: AnimationState) {
|
||||||
|
if (state.name === "max0" || state.name === "max1") {
|
||||||
|
// 大招播放结束,清除 HeroViewComp 的置顶标记,恢复 MoveSystem 统一排序
|
||||||
|
const viewComp = this.node.getComponent(HeroViewComp) || this.node.getComponentInParent(HeroViewComp);
|
||||||
|
if (viewComp) {
|
||||||
|
viewComp.isCastingMax = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (state.name != "idle" && state.name != "move") {
|
if (state.name != "idle" && state.name != "move") {
|
||||||
this.anmcon.play(this.default_anim)
|
this.anmcon.play(this.default_anim)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ export class HeroViewComp extends CCComp {
|
|||||||
lastBarUpdateTime: number = 0; // 最后一次血条/蓝条/护盾更新时间
|
lastBarUpdateTime: number = 0; // 最后一次血条/蓝条/护盾更新时间
|
||||||
// ==================== UI 节点引用 ====================
|
// ==================== UI 节点引用 ====================
|
||||||
private topBar: HeroTopBarComp = null!;
|
private topBar: HeroTopBarComp = null!;
|
||||||
|
/** 是否正在播放大招动画(用于渲染层级置顶,由 HeroAnmComp 播放结束时清除) */
|
||||||
|
public isCastingMax: boolean = false;
|
||||||
|
|
||||||
// ==================== 直接访问 HeroAttrsComp ====================
|
// ==================== 直接访问 HeroAttrsComp ====================
|
||||||
get model() {
|
get model() {
|
||||||
@@ -356,6 +358,8 @@ export class HeroViewComp extends CCComp {
|
|||||||
// 添加安全检查
|
// 添加安全检查
|
||||||
if (!this.model) return;
|
if (!this.model) return;
|
||||||
|
|
||||||
|
this.isCastingMax = false;
|
||||||
|
|
||||||
// 防止重复触发
|
// 防止重复触发
|
||||||
if (this.model.is_count_dead) return;
|
if (this.model.is_count_dead) return;
|
||||||
this.model.is_count_dead = true; // 防止重复触发,必须存在防止重复调用
|
this.model.is_count_dead = true; // 防止重复触发,必须存在防止重复调用
|
||||||
@@ -438,6 +442,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
if (act === "") return;
|
if (act === "") return;
|
||||||
switch (act) {
|
switch (act) {
|
||||||
case "max":
|
case "max":
|
||||||
|
this.isCastingMax = true;
|
||||||
this.as.max()
|
this.as.max()
|
||||||
break
|
break
|
||||||
case "atk":
|
case "atk":
|
||||||
@@ -487,6 +492,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
reset() {
|
reset() {
|
||||||
|
this.isCastingMax = false;
|
||||||
// 清理残留的定时器和缓动
|
// 清理残留的定时器和缓动
|
||||||
this.unscheduleAllCallbacks();
|
this.unscheduleAllCallbacks();
|
||||||
Tween.stopAllByTarget(this.node);
|
Tween.stopAllByTarget(this.node);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
|||||||
private readonly renderSortInterval = 0.05;
|
private readonly renderSortInterval = 0.05;
|
||||||
private lastRenderSortAt = 0;
|
private lastRenderSortAt = 0;
|
||||||
private heroViewMatcher: ecs.IMatcher | null = null;
|
private heroViewMatcher: ecs.IMatcher | null = null;
|
||||||
private readonly renderEntries: { node: Node; bossPriority: number; frontScore: number; spawnOrder: number; eid: number; laneScore: number }[] = [];
|
private readonly renderEntries: { node: Node; bossPriority: number; frontScore: number; spawnOrder: number; eid: number; laneScore: number; isCastingMax: boolean }[] = [];
|
||||||
private renderEntryCount = 0;
|
private renderEntryCount = 0;
|
||||||
|
|
||||||
// ======================== 英雄编队排队 ========================
|
// ======================== 英雄编队排队 ========================
|
||||||
@@ -407,7 +407,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
|||||||
const entryIndex = this.renderEntryCount;
|
const entryIndex = this.renderEntryCount;
|
||||||
let entry = this.renderEntries[entryIndex];
|
let entry = this.renderEntries[entryIndex];
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
entry = { node: actorView.node, bossPriority: 0, frontScore: 0, spawnOrder: 0, eid: 0, laneScore: 0 };
|
entry = { node: actorView.node, bossPriority: 0, frontScore: 0, spawnOrder: 0, eid: 0, laneScore: 0, isCastingMax: false };
|
||||||
this.renderEntries.push(entry);
|
this.renderEntries.push(entry);
|
||||||
}
|
}
|
||||||
entry.node = actorView.node;
|
entry.node = actorView.node;
|
||||||
@@ -415,11 +415,14 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
|||||||
entry.frontScore = frontScore;
|
entry.frontScore = frontScore;
|
||||||
entry.spawnOrder = spawnOrder;
|
entry.spawnOrder = spawnOrder;
|
||||||
entry.eid = e.eid;
|
entry.eid = e.eid;
|
||||||
|
entry.isCastingMax = actorView.isCastingMax;
|
||||||
this.renderEntryCount += 1;
|
this.renderEntryCount += 1;
|
||||||
});
|
});
|
||||||
this.renderEntries.length = this.renderEntryCount;
|
this.renderEntries.length = this.renderEntryCount;
|
||||||
|
|
||||||
this.renderEntries.sort((a, b) => {
|
this.renderEntries.sort((a, b) => {
|
||||||
|
// 正在播放大招的英雄排在最后,siblingIndex 越大渲染层级越靠上
|
||||||
|
if (a.isCastingMax !== b.isCastingMax) return a.isCastingMax ? 1 : -1;
|
||||||
// Y轴靠下的(laneScore 较大)应该在后面,从而渲染在上面
|
// Y轴靠下的(laneScore 较大)应该在后面,从而渲染在上面
|
||||||
if (Math.abs(a.laneScore - b.laneScore) > 10) return a.laneScore - b.laneScore;
|
if (Math.abs(a.laneScore - b.laneScore) > 10) return a.laneScore - b.laneScore;
|
||||||
if (a.frontScore !== b.frontScore) return a.frontScore - b.frontScore;
|
if (a.frontScore !== b.frontScore) return a.frontScore - b.frontScore;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { GameEvent } from "../common/config/GameEvent";
|
|||||||
import { HERO_UPGRADE_NEED_FRAGMENTS, CARD_LV_BG_COLORS } from "../common/config/GameSet";
|
import { HERO_UPGRADE_NEED_FRAGMENTS, CARD_LV_BG_COLORS } from "../common/config/GameSet";
|
||||||
import { CardLiteComp } from "./CardLiteComp";
|
import { CardLiteComp } from "./CardLiteComp";
|
||||||
import { ChipComp } from "./ChipComp";
|
import { ChipComp } from "./ChipComp";
|
||||||
|
import { SmallTipComp } from "./SmallTipComp";
|
||||||
import { SSkillBoxComp } from "./SSkillBoxComp";
|
import { SSkillBoxComp } from "./SSkillBoxComp";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
|
|
||||||
@@ -142,9 +143,12 @@ export class HerosListComp extends CCComp {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保 smalltip 气泡初始隐藏,避免遮挡按钮触摸
|
// 确保 smalltip 气泡初始隐藏,避免遮挡按钮触摸(组件缺失时兜底补挂)
|
||||||
const tipNode = this.upgrade_btn.getChildByName("smalltip")
|
const tipNode = this.upgrade_btn.getChildByName("smalltip")
|
||||||
if (tipNode) tipNode.active = false
|
if (tipNode) {
|
||||||
|
tipNode.getComponent(SmallTipComp) ?? tipNode.addComponent(SmallTipComp)
|
||||||
|
tipNode.active = false
|
||||||
|
}
|
||||||
|
|
||||||
let btn = this.upgrade_btn.getComponent(Button)
|
let btn = this.upgrade_btn.getComponent(Button)
|
||||||
if (!btn) btn = this.upgrade_btn.addComponent(Button)
|
if (!btn) btn = this.upgrade_btn.addComponent(Button)
|
||||||
@@ -276,33 +280,14 @@ export class HerosListComp extends CCComp {
|
|||||||
* @param text 提示文案
|
* @param text 提示文案
|
||||||
*/
|
*/
|
||||||
private showSmallTip(text: string) {
|
private showSmallTip(text: string) {
|
||||||
// smalltip 作为 upgrade_btn 的子节点挂在下面
|
// smalltip 作为 upgrade_btn 的子节点挂在下面,统一走 SmallTipComp 播动画
|
||||||
const tipNode = this.upgrade_btn?.getChildByName("smalltip")
|
const tipNode = this.upgrade_btn?.getChildByName("smalltip")
|
||||||
if (!tipNode || !tipNode.isValid) {
|
if (!tipNode || !tipNode.isValid) {
|
||||||
mLogger.log(this.debugMode, "HerosListComp", `未在 upgrade_btn 下找到 smalltip 节点,无法提示:${text}`)
|
mLogger.log(this.debugMode, "HerosListComp", `未在 upgrade_btn 下找到 smalltip 节点,无法提示:${text}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const tip = tipNode.getComponent(SmallTipComp) ?? tipNode.addComponent(SmallTipComp)
|
||||||
// 覆盖气泡文字
|
tip.show(text)
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======================== 卡片列表 ========================
|
// ======================== 卡片列表 ========================
|
||||||
|
|||||||
61
assets/script/game/map/SmallTipComp.ts
Normal file
61
assets/script/game/map/SmallTipComp.ts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* @file SmallTipComp.ts
|
||||||
|
* @description smalltip 气泡提示组件(UI 通用层)
|
||||||
|
*
|
||||||
|
* 职责:
|
||||||
|
* 封装 smalltip.prefab 气泡的弹出/消失动画与文案填充,供各页面复用。
|
||||||
|
* 调用方通过 getComponent(SmallTipComp) 获取实例后调 show(text) 即可,
|
||||||
|
* 无需关心节点显隐与 Tween 生命周期。
|
||||||
|
*
|
||||||
|
* 用法:
|
||||||
|
* 1. 编辑器侧将本组件挂在 smalltip 节点上(或运行时 addComponent 兜底)。
|
||||||
|
* 2. 默认隐藏节点(active = false),调用 show() 自动弹出并在停留后缩小隐藏。
|
||||||
|
*/
|
||||||
|
import { _decorator, Component, Label, Tween, Vec3, tween } from "cc";
|
||||||
|
|
||||||
|
const { ccclass } = _decorator;
|
||||||
|
|
||||||
|
/** 气泡停留时长(秒) */
|
||||||
|
const STAY_DURATION = 1;
|
||||||
|
|
||||||
|
/** SmallTipComp —— smalltip 气泡提示(弹出 → 停留 → 缩小隐藏) */
|
||||||
|
@ccclass('SmallTipComp')
|
||||||
|
export class SmallTipComp extends Component {
|
||||||
|
|
||||||
|
protected onLoad(): void {
|
||||||
|
// 初始隐藏,避免遮挡挂载点的触摸事件
|
||||||
|
this.node.active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹出气泡提示(重复调用时打断当前动画,从头播放)
|
||||||
|
* @param text 提示文案
|
||||||
|
* @param stay 停留时长(秒),默认 1 秒
|
||||||
|
*/
|
||||||
|
public show(text: string, stay: number = STAY_DURATION): void {
|
||||||
|
// 覆盖气泡文字
|
||||||
|
const label = this.getComponentInChildren(Label);
|
||||||
|
if (label) label.string = text;
|
||||||
|
|
||||||
|
this.node.active = true;
|
||||||
|
Tween.stopAllByTarget(this.node);
|
||||||
|
this.node.setScale(0, 0, 1);
|
||||||
|
|
||||||
|
tween(this.node)
|
||||||
|
// 弹出动画(微放大再回弹)
|
||||||
|
.to(0.15, { scale: new Vec3(1.1, 1.1, 1) }, { easing: 'quadOut' })
|
||||||
|
.to(0.05, { scale: new Vec3(1, 1, 1) })
|
||||||
|
// 停留
|
||||||
|
.delay(stay)
|
||||||
|
// 缩小消失
|
||||||
|
.to(0.15, { scale: new Vec3(0, 0, 1) }, { easing: 'quadIn' })
|
||||||
|
.call(() => {
|
||||||
|
if (this.node && this.node.isValid) this.node.active = false;
|
||||||
|
})
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDestroy(): void {
|
||||||
|
Tween.stopAllByTarget(this.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
assets/script/game/map/SmallTipComp.ts.meta
Normal file
9
assets/script/game/map/SmallTipComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.24",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "366cac88-417b-40cc-92e2-9b39d03a9333",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
} from "../common/config/TalentSet";
|
} from "../common/config/TalentSet";
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import { UIID } from "../common/config/GameUIConfig";
|
import { UIID } from "../common/config/GameUIConfig";
|
||||||
|
import { SmallTipComp } from "./SmallTipComp";
|
||||||
import { TalentItemComp } from "./TalentItemComp";
|
import { TalentItemComp } from "./TalentItemComp";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { oops } from "db://oops-framework/core/Oops";
|
import { oops } from "db://oops-framework/core/Oops";
|
||||||
@@ -45,6 +46,9 @@ const TAB_LOCKED_CHILD = "locked";
|
|||||||
/** 阶位页签未选中态子节点名(可选;非当前选中页签时显示) */
|
/** 阶位页签未选中态子节点名(可选;非当前选中页签时显示) */
|
||||||
const TAB_INACTIVE_CHILD = "noactive";
|
const TAB_INACTIVE_CHILD = "noactive";
|
||||||
|
|
||||||
|
/** 页签/卡片上的 smalltip 气泡节点名 */
|
||||||
|
const SMALL_TIP_CHILD = "smalltip";
|
||||||
|
|
||||||
/** TalentsComp —— 天赋加点页组件(阶位 Tab 单屏聚焦) */
|
/** TalentsComp —— 天赋加点页组件(阶位 Tab 单屏聚焦) */
|
||||||
@ccclass('TalentsComp')
|
@ccclass('TalentsComp')
|
||||||
@ecs.register('Talents', false)
|
@ecs.register('Talents', false)
|
||||||
@@ -92,13 +96,13 @@ export class TalentsComp extends CCComp {
|
|||||||
/** 是否已完成首次默认阶位选择 */
|
/** 是否已完成首次默认阶位选择 */
|
||||||
private inited: boolean = false;
|
private inited: boolean = false;
|
||||||
|
|
||||||
/** 阶位 → 页签节点/文案 映射(onLoad 时装配) */
|
/** 阶位 → 页签节点/文案/气泡 映射(onLoad 时装配) */
|
||||||
private tabNodes: Map<TalentTier, { node: Node | null; label: Label | null }> = new Map();
|
private tabNodes: Map<TalentTier, { node: Node | null; label: Label | null; tip: SmallTipComp | null }> = new Map();
|
||||||
|
|
||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
this.tabNodes.set(TalentTier.Basic, { node: this.tab_basic, label: this.lbl_tab_basic });
|
this.tabNodes.set(TalentTier.Basic, { node: this.tab_basic, label: this.lbl_tab_basic, tip: this.getSmallTip(this.tab_basic) });
|
||||||
this.tabNodes.set(TalentTier.Specialized, { node: this.tab_special, label: this.lbl_tab_special });
|
this.tabNodes.set(TalentTier.Specialized, { node: this.tab_special, label: this.lbl_tab_special, tip: this.getSmallTip(this.tab_special) });
|
||||||
this.tabNodes.set(TalentTier.Super, { node: this.tab_super, label: this.lbl_tab_super });
|
this.tabNodes.set(TalentTier.Super, { node: this.tab_super, label: this.lbl_tab_super, tip: this.getSmallTip(this.tab_super) });
|
||||||
|
|
||||||
for (const [tier, tab] of this.tabNodes) {
|
for (const [tier, tab] of this.tabNodes) {
|
||||||
tab.node?.on(NodeEventType.TOUCH_END, () => this.selectTier(tier), this);
|
tab.node?.on(NodeEventType.TOUCH_END, () => this.selectTier(tier), this);
|
||||||
@@ -123,16 +127,10 @@ export class TalentsComp extends CCComp {
|
|||||||
this.btn_reset?.targetOff(this);
|
this.btn_reset?.targetOff(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 切换阶位页签:锁定阶允许查看(卡片呈锁定态),并提示解锁条件 */
|
/** 切换阶位页签:锁定阶允许查看(卡片呈锁定态),不弹解锁提示 */
|
||||||
private selectTier(tier: TalentTier): void {
|
private selectTier(tier: TalentTier): void {
|
||||||
if (tier === this.curTier) return;
|
if (tier === this.curTier) return;
|
||||||
this.curTier = tier;
|
this.curTier = tier;
|
||||||
const levels = smc.getTalentLevels();
|
|
||||||
if (!isTalentTierUnlocked(levels, tier)) {
|
|
||||||
const prev = tier - 1;
|
|
||||||
const invested = getTalentTierInvestedPoints(levels, prev);
|
|
||||||
oops.gui.toast(`${TIER_TAB_TEXT[tier].lockName}投入 ${invested}/${TALENT_TIER_UNLOCK_THRESHOLD} 点解锁本阶`);
|
|
||||||
}
|
|
||||||
this.refreshUI();
|
this.refreshUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,26 +220,46 @@ export class TalentsComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 卡片点击统一入口:未解锁/已满级直接 toast;其余弹出 CommonPrompt 确认加点,成功后事件驱动刷新 */
|
/**
|
||||||
|
* 获取挂载点下的 smalltip 气泡组件(节点缺失或组件未挂时返回 null 并静默跳过提示)
|
||||||
|
* @param parent 气泡挂载的父节点
|
||||||
|
*/
|
||||||
|
private getSmallTip(parent: Node | null): SmallTipComp | null {
|
||||||
|
const tipNode = parent?.getChildByName(SMALL_TIP_CHILD);
|
||||||
|
return tipNode ? (tipNode.getComponent(SmallTipComp) ?? tipNode.addComponent(SmallTipComp)) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在指定节点下弹出 smalltip 气泡提示
|
||||||
|
* @param anchor 气泡挂载的父节点(优先页签,卡片点击时传卡片节点)
|
||||||
|
* @param text 提示文案
|
||||||
|
*/
|
||||||
|
private showSmallTip(anchor: Node | null, text: string): void {
|
||||||
|
const tip = this.getSmallTip(anchor);
|
||||||
|
tip?.show(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 卡片点击统一入口:未解锁/已满级/点数不足走 smalltip 气泡;其余弹出 CommonPrompt 确认加点,成功后事件驱动刷新 */
|
||||||
private onTalentTap(uuid: number): void {
|
private onTalentTap(uuid: number): void {
|
||||||
const cfg = TalentSet[uuid];
|
const cfg = TalentSet[uuid];
|
||||||
if (!cfg) return;
|
if (!cfg) return;
|
||||||
const levels = smc.getTalentLevels();
|
const levels = smc.getTalentLevels();
|
||||||
|
|
||||||
|
const tab = this.tabNodes.get(cfg.tier);
|
||||||
if (!isTalentTierUnlocked(levels, cfg.tier)) {
|
if (!isTalentTierUnlocked(levels, cfg.tier)) {
|
||||||
const invested = getTalentTierInvestedPoints(levels, (cfg.tier - 1) as TalentTier);
|
const invested = getTalentTierInvestedPoints(levels, (cfg.tier - 1) as TalentTier);
|
||||||
oops.gui.toast(`${TIER_TAB_TEXT[cfg.tier].lockName}投入 ${invested}/${TALENT_TIER_UNLOCK_THRESHOLD} 点解锁本阶`);
|
this.showSmallTip(tab?.node ?? null, `${TIER_TAB_TEXT[cfg.tier].lockName}投入 ${invested}/${TALENT_TIER_UNLOCK_THRESHOLD} 点解锁本阶`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const lv = smc.getTalentLv(uuid);
|
const lv = smc.getTalentLv(uuid);
|
||||||
if (lv >= cfg.max_lv) {
|
if (lv >= cfg.max_lv) {
|
||||||
oops.gui.toast("该天赋已满级");
|
this.showSmallTip(tab?.node ?? null, "该天赋已满级");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cost = getTalentUpgradeCost(lv);
|
const cost = getTalentUpgradeCost(lv);
|
||||||
if (cost <= 0) return;
|
if (cost <= 0) return;
|
||||||
if (smc.getTalentPoints() < cost) {
|
if (smc.getTalentPoints() < cost) {
|
||||||
oops.gui.toast("天赋点不足");
|
this.showSmallTip(tab?.node ?? null, "天赋点不足");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +273,7 @@ export class TalentsComp extends CCComp {
|
|||||||
maskClose: true,
|
maskClose: true,
|
||||||
okFunc: () => {
|
okFunc: () => {
|
||||||
if (!smc.upgradeTalent(uuid)) {
|
if (!smc.upgradeTalent(uuid)) {
|
||||||
oops.gui.toast("天赋点不足");
|
this.showSmallTip(this.tabNodes.get(cfg.tier)?.node ?? null, "天赋点不足");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user