mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
Added types for editor instance error.
This commit is contained in:
parent
a6519f3017
commit
5cb027c4eb
@ -23,7 +23,7 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
||||
skins: string[] = [];
|
||||
animation?: string;
|
||||
|
||||
_inst!: SDK.IWorldInstance & { errors: Record<string, string> };
|
||||
_inst!: SDK.IWorldInstance & { errors: SpineC3EditorError };
|
||||
|
||||
private assetLoader: AssetLoader;
|
||||
private skeletonRenderer: SkeletonRendererCore;
|
||||
@ -45,7 +45,7 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
||||
private tempColors = new Float32Array(4096);
|
||||
|
||||
// errors
|
||||
private errors: Record<string, string> = {};
|
||||
private errors: SpineC3EditorError = {};
|
||||
|
||||
constructor (sdkType: SDK.ITypeBase, inst: SDK.IWorldInstance) {
|
||||
super(sdkType, inst);
|
||||
@ -415,13 +415,14 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
||||
skeleton.updateWorldTransform(spine.Physics.update);
|
||||
}
|
||||
|
||||
private setError (key: string, condition: boolean, message: string) {
|
||||
private setError (key: SpineC3EditorErrorType, condition: boolean, message: string) {
|
||||
if (condition) {
|
||||
this.errors[key] = message;
|
||||
return;
|
||||
}
|
||||
delete this.errors[key];
|
||||
}
|
||||
|
||||
private hasErrors () {
|
||||
const { errors, skins, animation, spineBounds } = this;
|
||||
|
||||
@ -480,6 +481,9 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
||||
}
|
||||
};
|
||||
|
||||
type SpineC3EditorErrorType = "boundsAnimationSkinType" | "nonExistingAnimation" | "boundsNoDimension";
|
||||
type SpineC3EditorError = Partial<Record<SpineC3EditorErrorType, string>>;
|
||||
|
||||
PLUGIN_CLASS.Instance = SpineC3PluginInstance;
|
||||
|
||||
export type { SpineC3PluginInstance as SDKEditorInstanceClass };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user