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