mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Add play, stop, isPlaying.
This commit is contained in:
parent
8767b81e17
commit
57c2fa1cfd
@ -39,6 +39,11 @@
|
||||
"id": "is-skeleton-loaded",
|
||||
"scriptName": "IsSkeletonLoaded",
|
||||
"isTrigger": false
|
||||
},
|
||||
{
|
||||
"id": "is-playing",
|
||||
"scriptName": "IsPlaying",
|
||||
"isTrigger": false
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
@ -105,6 +110,16 @@
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "play",
|
||||
"scriptName": "Play",
|
||||
"highlight": false
|
||||
},
|
||||
{
|
||||
"id": "stop",
|
||||
"scriptName": "Stop",
|
||||
"highlight": false
|
||||
}
|
||||
],
|
||||
"expressions": [
|
||||
|
||||
@ -23,6 +23,14 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
|
||||
|
||||
AddAnimation (this: SDKInstanceClass, track: number, animation: string, loop = false, delay = 0) {
|
||||
this.addAnimation(track, animation, loop, delay);
|
||||
},
|
||||
|
||||
Play (this: SDKInstanceClass) {
|
||||
this.play();
|
||||
},
|
||||
|
||||
Stop (this: SDKInstanceClass) {
|
||||
this.stop();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@ -20,4 +20,7 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds =
|
||||
IsSkeletonLoaded (this: SpineC3Instance) {
|
||||
return this.skeletonLoaded;
|
||||
},
|
||||
IsPlaying (this: SpineC3Instance) {
|
||||
return this.isPlaying;
|
||||
},
|
||||
};
|
||||
|
||||
@ -17,6 +17,7 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
propScaleX = 1;
|
||||
propScaleY = 1;
|
||||
propFlipX = false;
|
||||
isPlaying = true;
|
||||
|
||||
textureAtlas?: TextureAtlas;
|
||||
renderer?: IRenderer;
|
||||
@ -71,6 +72,8 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isPlaying) return;
|
||||
|
||||
this.update(this.dt);
|
||||
this.runtime.sdk.updateRender();
|
||||
}
|
||||
@ -164,6 +167,14 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
}
|
||||
}
|
||||
|
||||
public play () {
|
||||
this.isPlaying = true;
|
||||
}
|
||||
|
||||
public stop () {
|
||||
this.isPlaying = false;
|
||||
}
|
||||
|
||||
private _setSkin () {
|
||||
const { skeleton } = this;
|
||||
if (!skeleton) return;
|
||||
|
||||
@ -108,6 +108,11 @@
|
||||
"list-name": "Is skeleton loaded",
|
||||
"display-text": "Is skeleton loaded",
|
||||
"description": "Check if the skeleton has finished loading"
|
||||
},
|
||||
"is-playing": {
|
||||
"list-name": "Is playing",
|
||||
"display-text": "Is playing",
|
||||
"description": "Check if the animation is currently playing"
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
@ -179,6 +184,16 @@
|
||||
"desc": "delay"
|
||||
}
|
||||
}
|
||||
},
|
||||
"play": {
|
||||
"list-name": "Play",
|
||||
"display-text": "Play animation",
|
||||
"description": "Resume or play the animation"
|
||||
},
|
||||
"stop": {
|
||||
"list-name": "Stop",
|
||||
"display-text": "Stop animation",
|
||||
"description": "Pause or stop the animation"
|
||||
}
|
||||
},
|
||||
"expressions": {
|
||||
|
||||
@ -108,6 +108,11 @@
|
||||
"list-name": "骨架是否已加载",
|
||||
"display-text": "骨架是否已加载",
|
||||
"description": "检查骨架是否已完成加载"
|
||||
},
|
||||
"is-playing": {
|
||||
"list-name": "是否正在播放",
|
||||
"display-text": "是否正在播放",
|
||||
"description": "检查动画是否正在播放"
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
@ -181,6 +186,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"play": {
|
||||
"list-name": "播放",
|
||||
"display-text": "播放动画",
|
||||
"description": "恢复或播放动画"
|
||||
},
|
||||
"stop": {
|
||||
"list-name": "停止",
|
||||
"display-text": "停止动画",
|
||||
"description": "暂停或停止动画"
|
||||
},
|
||||
"expressions": {
|
||||
"double": {
|
||||
"description": "将数字翻倍。",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user