mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
Add SetIgnoreGlobalTimeScale action and respective expression.
This commit is contained in:
parent
5f3c7c0a4d
commit
61b2b0291d
@ -300,6 +300,17 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "set-ignore-global-time-scale",
|
||||
"scriptName": "SetIgnoreGlobalTimeScale",
|
||||
"highlight": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "ignore-global-time-scale",
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "set-animation-time",
|
||||
"scriptName": "SetAnimationTime",
|
||||
@ -835,6 +846,12 @@
|
||||
"highlight": false,
|
||||
"returnType": "number"
|
||||
},
|
||||
{
|
||||
"id": "ignore-global-time-scale",
|
||||
"expressionName": "IgnoreGlobalTimeScale",
|
||||
"highlight": false,
|
||||
"returnType": "number"
|
||||
},
|
||||
{
|
||||
"id": "current-animation-start",
|
||||
"expressionName": "CurrentAnimationStart",
|
||||
|
||||
@ -89,6 +89,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
|
||||
this.setAnimationSpeed(timeScale);
|
||||
},
|
||||
|
||||
SetIgnoreGlobalTimeScale (this: SDKInstanceClass, ignoreGlobalTimeScale: boolean) {
|
||||
this.ignoreGlobalTimeScale = ignoreGlobalTimeScale;
|
||||
},
|
||||
|
||||
SetAnimationTime (this: SDKInstanceClass, track: number, time: number, units: 0 | 1) {
|
||||
this.setAnimationTime(units, time, track);
|
||||
},
|
||||
|
||||
@ -116,6 +116,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
|
||||
return this.state?.timeScale ?? 1;
|
||||
},
|
||||
|
||||
IgnoreGlobalTimeScale (this: SpineC3Instance) {
|
||||
return this.ignoreGlobalTimeScale ? 1 : 0;
|
||||
},
|
||||
|
||||
CurrentAnimationStart (this: SpineC3Instance, trackIndex: number) {
|
||||
const track = this.state?.tracks[trackIndex];
|
||||
return track?.animationStart ?? 0;
|
||||
|
||||
@ -68,12 +68,14 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
skeletonLoading = false;
|
||||
skeleton?: Skeleton;
|
||||
state?: AnimationState;
|
||||
ignoreGlobalTimeScale = false;
|
||||
|
||||
public triggeredEventTrack = -1;
|
||||
public triggeredEventAnimation = "";
|
||||
public triggeredEventName = "";
|
||||
public triggeredEventData?: Event & { track: number, animation: string };
|
||||
|
||||
private time = new spine.TimeKeeper();
|
||||
private assetLoader: AssetLoader;
|
||||
private skeletonRenderer?: C3RendererRuntime;
|
||||
private matrix: C3Matrix;
|
||||
@ -148,6 +150,8 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
}
|
||||
|
||||
_tick (): void {
|
||||
this.time.update();
|
||||
|
||||
const { renderer } = this;
|
||||
|
||||
if (!renderer) return;
|
||||
@ -172,7 +176,7 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
|
||||
this.updateCollisionSprite();
|
||||
|
||||
if (this.isPlaying) this.update(this.dt);
|
||||
if (this.isPlaying) this.update(this.ignoreGlobalTimeScale ? this.time.delta : this.dt);
|
||||
}
|
||||
|
||||
private update (delta: number) {
|
||||
|
||||
@ -379,6 +379,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"set-ignore-global-time-scale": {
|
||||
"list-name": "Set ignore global time scale",
|
||||
"display-text": "Set ignore global time scale to {0}",
|
||||
"description": "Set whether this instance ignores the global time scale set in Construct 3",
|
||||
"params": {
|
||||
"ignore-global-time-scale": {
|
||||
"name": "Ignore global time scale",
|
||||
"desc": "True to ignore the global time scale, false to use it."
|
||||
}
|
||||
}
|
||||
},
|
||||
"set-animation-time": {
|
||||
"list-name": "Set animation time",
|
||||
"display-text": "Set track {0} animation time to {1} ({2})",
|
||||
@ -909,6 +920,10 @@
|
||||
"description": "Get the current animation time scale (speed multiplier).",
|
||||
"translated-name": "TimeScale"
|
||||
},
|
||||
"ignore-global-time-scale": {
|
||||
"description": "Get whether this instance ignores the global time scale (1 = ignoring, 0 = not ignoring).",
|
||||
"translated-name": "IgnoreGlobalTimeScale"
|
||||
},
|
||||
"current-animation-start": {
|
||||
"description": "Get the start time of the current animation on the specified track.",
|
||||
"translated-name": "CurrentAnimationStart",
|
||||
|
||||
@ -379,6 +379,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"set-ignore-global-time-scale": {
|
||||
"list-name": "设置忽略全局时间缩放",
|
||||
"display-text": "将忽略全局时间缩放设置为{0}",
|
||||
"description": "设置此实例是否忽略Construct 3中设置的全局时间缩放",
|
||||
"params": {
|
||||
"ignore-global-time-scale": {
|
||||
"name": "忽略全局时间缩放",
|
||||
"desc": "设置为true则忽略全局时间缩放,设置为false则使用全局时间缩放。"
|
||||
}
|
||||
}
|
||||
},
|
||||
"set-animation-time": {
|
||||
"list-name": "设置动画时间",
|
||||
"display-text": "将轨道{0}的动画时间设置为{1}({2})",
|
||||
@ -909,6 +920,10 @@
|
||||
"description": "获取当前动画时间缩放(速度倍数)。",
|
||||
"translated-name": "TimeScale"
|
||||
},
|
||||
"ignore-global-time-scale": {
|
||||
"description": "获取此实例是否忽略全局时间缩放(1 = 忽略,0 = 不忽略)。",
|
||||
"translated-name": "IgnoreGlobalTimeScale"
|
||||
},
|
||||
"current-animation-start": {
|
||||
"description": "获取指定轨道上当前动画的开始时间。",
|
||||
"translated-name": "CurrentAnimationStart",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user