mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 01:06:00 +08:00
Add GetEventData expression.
This commit is contained in:
parent
57363110c3
commit
ed94892283
@ -554,6 +554,18 @@
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "get-event-data",
|
||||
"expressionName": "GetEventData",
|
||||
"highlight": false,
|
||||
"returnType": "any",
|
||||
"params": [
|
||||
{
|
||||
"id": "field",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
|
||||
import type { SDKInstanceClass } from "./instance.ts";
|
||||
import type { SDKInstanceClass as SpineC3Instance } from "./instance.ts";
|
||||
|
||||
const C3 = globalThis.C3;
|
||||
|
||||
C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
|
||||
{
|
||||
Double (this: SDKInstanceClass, num: number) {
|
||||
Double (this: SpineC3Instance, num: number) {
|
||||
return num * 2;
|
||||
},
|
||||
|
||||
SlotAttachment (this: SDKInstanceClass, slotName: string) {
|
||||
SlotAttachment (this: SpineC3Instance, slotName: string) {
|
||||
if (!this.skeleton) return "";
|
||||
const slot = this.skeleton.findSlot(slotName);
|
||||
if (!slot) return "";
|
||||
@ -17,32 +17,44 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
|
||||
return attachment ? attachment.name : "";
|
||||
},
|
||||
|
||||
BoneX (this: SDKInstanceClass, boneName: string) {
|
||||
BoneX (this: SpineC3Instance, boneName: string) {
|
||||
return this.getBoneX(boneName);
|
||||
},
|
||||
|
||||
BoneY (this: SDKInstanceClass, boneName: string) {
|
||||
BoneY (this: SpineC3Instance, boneName: string) {
|
||||
return this.getBoneY(boneName);
|
||||
},
|
||||
|
||||
BoneRotation (this: SDKInstanceClass, boneName: string) {
|
||||
BoneRotation (this: SpineC3Instance, boneName: string) {
|
||||
return this.getBoneRotation(boneName);
|
||||
},
|
||||
|
||||
BoneWorldX (this: SDKInstanceClass, boneName: string) {
|
||||
BoneWorldX (this: SpineC3Instance, boneName: string) {
|
||||
return this.getBoneWorldX(boneName);
|
||||
},
|
||||
|
||||
BoneWorldY (this: SDKInstanceClass, boneName: string) {
|
||||
BoneWorldY (this: SpineC3Instance, boneName: string) {
|
||||
return this.getBoneWorldY(boneName);
|
||||
},
|
||||
|
||||
CurrentSkin (this: SDKInstanceClass) {
|
||||
CurrentSkin (this: SpineC3Instance) {
|
||||
return this.getCurrentSkin();
|
||||
},
|
||||
|
||||
CurrentAnimation (this: SDKInstanceClass, trackIndex: number) {
|
||||
CurrentAnimation (this: SpineC3Instance, trackIndex: number) {
|
||||
return this.getCurrentAnimation(trackIndex);
|
||||
},
|
||||
GetEventData (this: SpineC3Instance, field: "float" | "int" | "string" | "balance" | "volume" | "audiopath" | "event" | "track" | "animation") {
|
||||
if (field === "float") return this.triggeredEventData?.floatValue;
|
||||
if (field === "int") return this.triggeredEventData?.intValue;
|
||||
if (field === "string") return this.triggeredEventData?.stringValue;
|
||||
if (field === "balance") return this.triggeredEventData?.balance;
|
||||
if (field === "volume") return this.triggeredEventData?.volume;
|
||||
if (field === "audiopath") return this.triggeredEventData?.data.audioPath;
|
||||
if (field === "event") return this.triggeredEventData?.data.name;
|
||||
if (field === "animation") return this.triggeredEventAnimation;
|
||||
if (field === "track") return this.triggeredEventTrack;
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -632,6 +632,16 @@
|
||||
"desc": "Index of the track"
|
||||
}
|
||||
}
|
||||
},
|
||||
"get-event-data": {
|
||||
"description": "Get data from the last triggered animation event. Typically used within an 'On animation event' trigger. Valid fields: \"float\", \"int\", \"string\", \"balance\", \"volume\", \"audiopath\", \"event\", \"track\", \"animation\".",
|
||||
"translated-name": "GetEventData",
|
||||
"params": {
|
||||
"field": {
|
||||
"name": "\"float\"|\"int\"|\"string\"|\"balance\"|\"volume\"|\"audiopath\"|\"event\"|\"track\"|\"animation\"",
|
||||
"desc": "The event data field to retrieve"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -632,6 +632,16 @@
|
||||
"desc": "轨道的索引"
|
||||
}
|
||||
}
|
||||
},
|
||||
"get-event-data": {
|
||||
"description": "获取最后触发的动画事件的数据。通常在"动画事件触发时"条件中使用。有效字段: \"float\", \"int\", \"string\", \"balance\", \"volume\", \"audiopath\", \"event\", \"track\", \"animation\"。",
|
||||
"translated-name": "GetEventData",
|
||||
"params": {
|
||||
"field": {
|
||||
"name": "\"float\"|\"int\"|\"string\"|\"balance\"|\"volume\"|\"audiopath\"|\"event\"|\"track\"|\"animation\"",
|
||||
"desc": "要检索的事件数据字段"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user