Made OnAnimationEvent more generic allowing empty params to be used as any.

This commit is contained in:
Davide Tantillo 2025-11-05 11:57:56 +01:00
parent ff8024ed83
commit 8767b81e17
4 changed files with 17 additions and 15 deletions

View File

@ -16,16 +16,17 @@
{
"id": "event",
"type": "string",
"initial-value": "complete"
"initial-value": ""
},
{
"id": "track",
"type": "number",
"initial-value": 0
"initial-value": -1
},
{
"id": "animation",
"type": "string"
"type": "string",
"initial-value": ""
}
]
},

View File

@ -9,9 +9,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds =
return true;
},
OnAnimationEvent (this: SpineC3Instance, event: string, track: number, animation: string) {
return this.triggeredEventName === event
&& this.triggeredEventTrack === track
&& this.triggeredEventAnimation === animation;
const eventMatches = event === "" || this.triggeredEventName === event;
const trackMatches = track === -1 || this.triggeredEventTrack === track;
const animationMatches = animation === "" || this.triggeredEventAnimation === animation;
return eventMatches && trackMatches && animationMatches;
},
IsFlippedX (this: SpineC3Instance) {
return this.propFlipX;

View File

@ -82,20 +82,20 @@
},
"on-animation-event": {
"list-name": "On animation event",
"display-text": "On {0} event triggered by animation {2} on track {1} trigger",
"description": "Do something when animation event is triggered",
"display-text": "On {0} event triggered by animation {2} on track {1}",
"description": "Triggered when animation event occurs. Use empty string for event/animation or -1 for track to match any value.",
"params": {
"event": {
"name": "Event name",
"desc": "Event name"
"desc": "Event name (start, dispose, event, interrupt, end, complete). Empty string matches any event."
},
"animation": {
"name": "Animation",
"desc": "Animation"
"desc": "Animation name. Empty string matches any animation."
},
"track": {
"name": "Track number",
"desc": "Track number"
"desc": "Track index. Use -1 to match any track."
}
}
},

View File

@ -83,19 +83,19 @@
"on-animation-event": {
"list-name": "动画事件触发时",
"display-text": "当轨道{1}上的动画{2}触发{0}事件时",
"description": "当动画事件触发时执行操作",
"description": "当动画事件发生时触发。使用空字符串匹配任意事件/动画,或使用-1匹配任意轨道。",
"params": {
"event": {
"name": "事件名称",
"desc": "事件名称"
"desc": "事件名称start、dispose、event、interrupt、end、complete。空字符串匹配任意事件。"
},
"animation": {
"name": "动画",
"desc": "动画"
"desc": "动画名称。空字符串匹配任意动画。"
},
"track": {
"name": "轨道编号",
"desc": "轨道编号"
"desc": "轨道索引。使用-1匹配任意轨道。"
}
}
},