feat(hero list): add hero upgrade animation effect
新增英雄升级成功时的播放动画特效,包括: 1. 新增动画节点绑定属性与初始化隐藏逻辑 2. 添加升级动画播放与播放完成自动隐藏的方法 3. 新增升级动画资源文件与配置元数据
This commit is contained in:
112
assets/resources/gui/anim/upanm.anim
Normal file
112
assets/resources/gui/anim/upanm.anim
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"__type__": "cc.AnimationClip",
|
||||||
|
"_name": "upanm",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {
|
||||||
|
"embeddedPlayerGroups": []
|
||||||
|
},
|
||||||
|
"_native": "",
|
||||||
|
"sample": 20,
|
||||||
|
"speed": 1,
|
||||||
|
"wrapMode": 1,
|
||||||
|
"enableTrsBlending": false,
|
||||||
|
"_duration": 0.45,
|
||||||
|
"_hash": 500763545,
|
||||||
|
"_tracks": [
|
||||||
|
{
|
||||||
|
"__id__": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_exoticAnimation": null,
|
||||||
|
"_events": [],
|
||||||
|
"_embeddedPlayers": [],
|
||||||
|
"_additiveSettings": {
|
||||||
|
"__id__": 6
|
||||||
|
},
|
||||||
|
"_auxiliaryCurveEntries": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.animation.ObjectTrack",
|
||||||
|
"_binding": {
|
||||||
|
"__type__": "cc.animation.TrackBinding",
|
||||||
|
"path": {
|
||||||
|
"__id__": 2
|
||||||
|
},
|
||||||
|
"proxy": null
|
||||||
|
},
|
||||||
|
"_channel": {
|
||||||
|
"__id__": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.animation.TrackPath",
|
||||||
|
"_paths": [
|
||||||
|
{
|
||||||
|
"__id__": 3
|
||||||
|
},
|
||||||
|
"spriteFrame"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.animation.ComponentPath",
|
||||||
|
"component": "cc.Sprite"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.animation.Channel",
|
||||||
|
"_curve": {
|
||||||
|
"__id__": 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.ObjectCurve",
|
||||||
|
"_times": [
|
||||||
|
0,
|
||||||
|
0.05,
|
||||||
|
0.1,
|
||||||
|
0.15,
|
||||||
|
0.2,
|
||||||
|
0.25,
|
||||||
|
0.3,
|
||||||
|
0.35,
|
||||||
|
0.4
|
||||||
|
],
|
||||||
|
"_values": [
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
"__uuid__": "3d46f945-3f07-477e-a95a-b49557d552c6@57c99",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "3d46f945-3f07-477e-a95a-b49557d552c6@d4a49",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "3d46f945-3f07-477e-a95a-b49557d552c6@57598",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "3d46f945-3f07-477e-a95a-b49557d552c6@ee898",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "3d46f945-3f07-477e-a95a-b49557d552c6@2ce81",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "3d46f945-3f07-477e-a95a-b49557d552c6@214a5",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "3d46f945-3f07-477e-a95a-b49557d552c6@0ef72",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.AnimationClipAdditiveSettings",
|
||||||
|
"enabled": false,
|
||||||
|
"refClip": null
|
||||||
|
}
|
||||||
|
]
|
||||||
13
assets/resources/gui/anim/upanm.anim.meta
Normal file
13
assets/resources/gui/anim/upanm.anim.meta
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"ver": "2.0.3",
|
||||||
|
"importer": "animation-clip",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "b194c17a-d811-4d73-ab53-7d567487ce80",
|
||||||
|
"files": [
|
||||||
|
".cconb"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"name": "upanm"
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -87,6 +87,10 @@ export class HerosListComp extends CCComp {
|
|||||||
@property(Node)
|
@property(Node)
|
||||||
chip_node = null!
|
chip_node = null!
|
||||||
|
|
||||||
|
/** 升级特效动画节点(内含升级效果 Animation,点击升级时从头播放) */
|
||||||
|
@property(Node)
|
||||||
|
upgrade_anim_node = null!
|
||||||
|
|
||||||
// ======================== 运行时状态 ========================
|
// ======================== 运行时状态 ========================
|
||||||
|
|
||||||
huuid: number = 0
|
huuid: number = 0
|
||||||
@@ -97,6 +101,8 @@ export class HerosListComp extends CCComp {
|
|||||||
start() {
|
start() {
|
||||||
this.bindUpgradeBtn()
|
this.bindUpgradeBtn()
|
||||||
this.initCardList()
|
this.initCardList()
|
||||||
|
// 升级特效动画初始隐藏,点击升级时才显示播放
|
||||||
|
if (this.upgrade_anim_node) this.upgrade_anim_node.active = false
|
||||||
if (HeroList.length > 0) {
|
if (HeroList.length > 0) {
|
||||||
this.onCardSelect(HeroList[0])
|
this.onCardSelect(HeroList[0])
|
||||||
}
|
}
|
||||||
@@ -171,6 +177,7 @@ export class HerosListComp extends CCComp {
|
|||||||
const success = smc.upgradeHero(uuid)
|
const success = smc.upgradeHero(uuid)
|
||||||
if (success) {
|
if (success) {
|
||||||
mLogger.log(this.debugMode, "HerosListComp", `英雄 ${uuid} 升级成功`)
|
mLogger.log(this.debugMode, "HerosListComp", `英雄 ${uuid} 升级成功`)
|
||||||
|
this.playUpgradeAnim()
|
||||||
this.updateHeroDetail(uuid)
|
this.updateHeroDetail(uuid)
|
||||||
} else {
|
} else {
|
||||||
const growth = smc.getHeroGrowth(uuid)
|
const growth = smc.getHeroGrowth(uuid)
|
||||||
@@ -204,6 +211,44 @@ export class HerosListComp extends CCComp {
|
|||||||
.start()
|
.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 播放升级特效动画
|
||||||
|
* 每次升级成功均从头播放;动画未播完时再次升级,立即重新开始
|
||||||
|
*/
|
||||||
|
private playUpgradeAnim() {
|
||||||
|
if (!this.upgrade_anim_node) {
|
||||||
|
mLogger.log(this.debugMode, "HerosListComp", "playUpgradeAnim: upgrade_anim_node 未绑定")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const anim = this.upgrade_anim_node.getComponent(Animation)
|
||||||
|
const clip = anim?.clips?.[0]
|
||||||
|
if (!anim || !clip) {
|
||||||
|
mLogger.log(this.debugMode, "HerosListComp", "playUpgradeAnim: 缺少 Animation 组件或动画剪辑")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.upgrade_anim_node.active = true
|
||||||
|
// 停止当前播放(如有),保证从头开始
|
||||||
|
anim.stop()
|
||||||
|
|
||||||
|
const animState = anim.getState(clip.name)
|
||||||
|
if (animState) {
|
||||||
|
// 防止重复注册,播放结束后自动隐藏特效节点
|
||||||
|
animState.off('finished', this.onUpgradeAnimFinished, this)
|
||||||
|
animState.once('finished', this.onUpgradeAnimFinished, this)
|
||||||
|
}
|
||||||
|
anim.play(clip.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 升级特效动画播放结束回调:隐藏特效节点
|
||||||
|
*/
|
||||||
|
private onUpgradeAnimFinished() {
|
||||||
|
if (this.upgrade_anim_node && this.upgrade_anim_node.isValid) {
|
||||||
|
this.upgrade_anim_node.active = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在升级按钮附近弹出 smalltip 气泡提示
|
* 在升级按钮附近弹出 smalltip 气泡提示
|
||||||
* @param text 提示文案
|
* @param text 提示文案
|
||||||
|
|||||||
Reference in New Issue
Block a user