mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-16 12:01:41 +08:00
Add expression current-animation.
This commit is contained in:
parent
6af077c0a6
commit
ff2ee5397b
@ -385,6 +385,18 @@
|
|||||||
"expressionName": "CurrentSkin",
|
"expressionName": "CurrentSkin",
|
||||||
"highlight": false,
|
"highlight": false,
|
||||||
"returnType": "string"
|
"returnType": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "current-animation",
|
||||||
|
"expressionName": "CurrentAnimation",
|
||||||
|
"highlight": false,
|
||||||
|
"returnType": "string",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"id": "track-index",
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
|
|||||||
|
|
||||||
CurrentSkin (this: SDKInstanceClass) {
|
CurrentSkin (this: SDKInstanceClass) {
|
||||||
return this.getCurrentSkin();
|
return this.getCurrentSkin();
|
||||||
|
},
|
||||||
|
|
||||||
|
CurrentAnimation (this: SDKInstanceClass, trackIndex: number) {
|
||||||
|
return this.getCurrentAnimation(trackIndex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -435,6 +435,18 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
|||||||
return skin.name;
|
return skin.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getCurrentAnimation (trackIndex: number): string {
|
||||||
|
if (!this.skeleton) return "";
|
||||||
|
|
||||||
|
const { state } = this;
|
||||||
|
if (!state) return "";
|
||||||
|
|
||||||
|
const track = state.tracks[trackIndex];
|
||||||
|
if (!track || !track.animation) return "";
|
||||||
|
|
||||||
|
return track.animation.name;
|
||||||
|
}
|
||||||
|
|
||||||
private _setSkin () {
|
private _setSkin () {
|
||||||
const { skeleton } = this;
|
const { skeleton } = this;
|
||||||
if (!skeleton) return;
|
if (!skeleton) return;
|
||||||
|
|||||||
@ -460,6 +460,16 @@
|
|||||||
"current-skin": {
|
"current-skin": {
|
||||||
"description": "Get the current skin name. Returns comma-separated names if multiple skins are active.",
|
"description": "Get the current skin name. Returns comma-separated names if multiple skins are active.",
|
||||||
"translated-name": "CurrentSkin"
|
"translated-name": "CurrentSkin"
|
||||||
|
},
|
||||||
|
"current-animation": {
|
||||||
|
"description": "Get the name of the currently playing animation on a specific track.",
|
||||||
|
"translated-name": "CurrentAnimation",
|
||||||
|
"params": {
|
||||||
|
"track-index": {
|
||||||
|
"name": "Track index",
|
||||||
|
"desc": "Index of the track"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -460,6 +460,16 @@
|
|||||||
"current-skin": {
|
"current-skin": {
|
||||||
"description": "获取当前皮肤名称。如果有多个皮肤处于活动状态,返回逗号分隔的名称。",
|
"description": "获取当前皮肤名称。如果有多个皮肤处于活动状态,返回逗号分隔的名称。",
|
||||||
"translated-name": "CurrentSkin"
|
"translated-name": "CurrentSkin"
|
||||||
|
},
|
||||||
|
"current-animation": {
|
||||||
|
"description": "获取特定轨道上当前播放的动画名称。",
|
||||||
|
"translated-name": "CurrentAnimation",
|
||||||
|
"params": {
|
||||||
|
"track-index": {
|
||||||
|
"name": "轨道索引",
|
||||||
|
"desc": "轨道的索引"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user