feat(技能框): 添加技能释放动画并优化UI显示
添加技能触发时的缩放缓动动画,播放前停止已有缓动避免异常,增强操作视觉反馈。 调整技能剩余次数的显示格式,移除多余的“次”后缀。 更新技能框预制体,新增CD遮罩节点并调整图标布局与缩放参数,同时替换关联UI图片资源。
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
* - smc.mission —— 游戏运行状态
|
||||
*/
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { _decorator, Node, Prefab, Sprite, Label, Vec3, resources, SpriteAtlas } from "cc";
|
||||
import { _decorator, Node, Prefab, Sprite, Label, Vec3, resources, SpriteAtlas, tween, v3, Tween } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { CardPoolList } from "../common/config/CardSet";
|
||||
@@ -56,6 +56,9 @@ export class SkillBoxComp extends CCComp {
|
||||
@property(Label)
|
||||
private info_label: Label = null;
|
||||
|
||||
/** cd计时遮罩 */
|
||||
@property({ type: Node })
|
||||
private cd_mask: Node = null;
|
||||
// ======================== 技能配置 ========================
|
||||
|
||||
/** 技能 UUID */
|
||||
@@ -175,7 +178,7 @@ export class SkillBoxComp extends CCComp {
|
||||
if (this.info_label) {
|
||||
if (!this.is_instant) {
|
||||
const remain = Math.max(0, this.trigger_times - this.current_trigger_times);
|
||||
this.info_label.string = `${remain}次`;
|
||||
this.info_label.string = `${remain}`;
|
||||
} else {
|
||||
this.info_label.string = "";
|
||||
}
|
||||
@@ -304,6 +307,17 @@ export class SkillBoxComp extends CCComp {
|
||||
const parentPos = this.node.parent ? this.node.parent.position : new Vec3(0, 0, 0);
|
||||
targetPos.set(parentPos.x + localPos.x, parentPos.y + localPos.y, 0);
|
||||
|
||||
// 播放技能释放缓动动画:图标放大再缩回
|
||||
if (this.node && this.node.isValid) {
|
||||
// 停止之前的缓动,防止快速重复触发导致缩放异常
|
||||
Tween.stopAllByTarget(this.node);
|
||||
this.node.scale = v3(1, 1, 1);
|
||||
tween(this.node)
|
||||
.to(0.1, { scale: v3(1.3, 1.3, 1.3) })
|
||||
.to(0.15, { scale: v3(1, 1, 1) })
|
||||
.start();
|
||||
}
|
||||
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: this.s_uuid,
|
||||
isCardSkill: true, // 标记为卡牌技能(区别于英雄自身技能)
|
||||
|
||||
Reference in New Issue
Block a user