宝石镶嵌效果

master
humingxing 12 hours ago
parent ce587eb599
commit 16b50a23be
  1. 2
      assets/bundles/gemstone/prefab/PanelGemstone.prefab
  2. 43
      assets/script/ui/PanelGemstone/UIPanelGemstone.ts

@ -1659,7 +1659,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 15,
"z": 0
},
"_lrot": {

@ -11,6 +11,7 @@ import { GemGrid } from '../../com/GemGrid';
import { FrameFlowHost } from '../../game/FrameFlowHost';
import { GBundle, UIID } from '../../game/ConfigRes';
import { GEM_SLOT_COUNT, IGemBagEntry } from '../../game/GameDataEnums';
import { BattleSpinePlayback } from '../../battle/presentation/BattleSpinePlayback';
import { Auto_PanelGemstone } from './Auto_PanelGemstone';
const { ccclass } = _decorator;
@ -26,6 +27,8 @@ const BAG_PER_FRAME = 6;
const DEFAULT_FILTER = 1;
/** 默认展示五行:金 */
const DEFAULT_ELEMENT = 1;
/** 镶嵌成功特效动画 */
const SOCKET_EFF_ANIM = '场景变换';
/**
* 宝石页:左右切五行镶嵌 + 页签仓库 + 拖拽镶嵌/卸下 + 一键合成。
@ -74,7 +77,11 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
onLoad(): void {
super.onLoad();
this._itemTpl = this.ui_list?.getChildByName('itemTemplate') ?? null;
if (this._itemTpl) this._itemTpl.active = false;
if (this._itemTpl) {
this._itemTpl.active = false;
const tplEff = this._itemTpl.getChildByName('eff');
if (tplEff?.isValid) tplEff.active = false;
}
this._bagTpl = this.ui_content?.getChildByName('bagItemTemplate') ?? null;
if (this._bagTpl) this._bagTpl.active = false;
this._skSkin = find('ui_center/top/sk_skin', this.node)?.getComponent(sp.Skeleton) ?? null;
@ -230,10 +237,43 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
node.active = true;
node.name = `slot_${s}`;
(node as any)._slot = s;
const eff = node.getChildByName('eff');
if (eff?.isValid) eff.active = false;
this._slotItems.push(node);
}
}
/**
* 镶嵌成功:播 slot 上 eff(默认隐藏,播完再藏)。
* @param slotNode 目标镶嵌格
*/
private _playSocketEff(slotNode: Node): void {
const eff = slotNode.getChildByName('eff');
if (!eff?.isValid) {
console.warn(LOG, 'eff 缺失');
return;
}
const sk = eff.getComponent(sp.Skeleton);
if (!sk?.isValid) {
console.warn(LOG, 'eff Skeleton 缺失');
return;
}
if (sk.skeletonData) ensureSpineSkeletonDataRuntime(sk.skeletonData);
BattleSpinePlayback.clearPendingComplete(sk);
eff.active = true;
const ok = BattleSpinePlayback.play(sk, SOCKET_EFF_ANIM, {
loop: false,
ignoreBattleTimeScale: true,
onComplete: () => {
if (eff.isValid) eff.active = false;
},
});
if (!ok) {
console.warn(LOG, 'eff 动画播放失败', SOCKET_EFF_ANIM);
eff.active = false;
}
}
/** 刷新当前五行 4 槽 */
private _refreshSlots(): void {
this._ensureSlotItems();
@ -514,6 +554,7 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
const patch = [gemId];
if (before > 0 && before !== gemId) patch.push(before);
this._patchBagGems(patch);
this._playSocketEff(toSlot);
return;
}

Loading…
Cancel
Save