mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-16 03:51:37 +08:00
Code restructure. Add many actions and conditions.
This commit is contained in:
parent
ff2ee5397b
commit
9d7172602f
@ -44,6 +44,25 @@
|
||||
"id": "is-playing",
|
||||
"scriptName": "IsPlaying",
|
||||
"isTrigger": false
|
||||
},
|
||||
{
|
||||
"id": "is-inside-slot",
|
||||
"scriptName": "IsInsideSlot",
|
||||
"isTrigger": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "x",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "y",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "slot-name",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
@ -317,6 +336,103 @@
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "update-bone-pose",
|
||||
"scriptName": "UpdateBonePose",
|
||||
"highlight": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "x",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "y",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "bone-name",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "attach-instance-to-bone",
|
||||
"scriptName": "AttachInstanceToBone",
|
||||
"highlight": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "uid",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "bone-name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "offset-x",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "offset-y",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "offset-angle",
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "detach-instance-from-bone",
|
||||
"scriptName": "DetachInstanceFromBone",
|
||||
"highlight": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "bone-name",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "add-handle",
|
||||
"scriptName": "AddHandle",
|
||||
"highlight": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "type",
|
||||
"type": "combo",
|
||||
"items": ["bone", "slot"]
|
||||
},
|
||||
{
|
||||
"id": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "radius",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "debug",
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "remove-handle",
|
||||
"scriptName": "RemoveHandle",
|
||||
"highlight": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "type",
|
||||
"type": "combo",
|
||||
"items": ["bone", "slot"]
|
||||
},
|
||||
{
|
||||
"id": "name",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"expressions": [
|
||||
@ -380,6 +496,30 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "bone-world-x",
|
||||
"expressionName": "BoneWorldX",
|
||||
"highlight": false,
|
||||
"returnType": "number",
|
||||
"params": [
|
||||
{
|
||||
"id": "bone-name",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "bone-world-y",
|
||||
"expressionName": "BoneWorldY",
|
||||
"highlight": false,
|
||||
"returnType": "number",
|
||||
"params": [
|
||||
{
|
||||
"id": "bone-name",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "current-skin",
|
||||
"expressionName": "CurrentSkin",
|
||||
|
||||
@ -6,7 +6,7 @@ const C3 = globalThis.C3;
|
||||
C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
|
||||
{
|
||||
Alert (this: SDKInstanceClass) {
|
||||
alert(`Test property = ${this._getTestProperty()}`);
|
||||
alert(`Test`);
|
||||
},
|
||||
|
||||
SetSkin (this: SDKInstanceClass, skinList: string) {
|
||||
@ -87,6 +87,26 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
|
||||
|
||||
ResetSlotColors (this: SDKInstanceClass, slotName: string) {
|
||||
this.resetSlotColors(slotName);
|
||||
},
|
||||
|
||||
UpdateBonePose (this: SDKInstanceClass, x: number, y: number, boneName: string) {
|
||||
this.updateBonePose(x, y, boneName);
|
||||
},
|
||||
|
||||
AttachInstanceToBone (this: SDKInstanceClass, uid: number, boneName: string, offsetX: number, offsetY: number, offsetAngle: number) {
|
||||
this.attachInstanceToBone(uid, boneName, offsetX, offsetY, offsetAngle);
|
||||
},
|
||||
|
||||
DetachInstanceFromBone (this: SDKInstanceClass, boneName: string) {
|
||||
this.detachInstanceFromBone(boneName);
|
||||
},
|
||||
|
||||
AddHandle (this: SDKInstanceClass, type: 0 | 1, name: string, radius: number, debug: boolean) {
|
||||
this.addDragHandle(type, name, radius, debug);
|
||||
},
|
||||
|
||||
RemoveHandle (this: SDKInstanceClass, type: 0 | 1, name: string) {
|
||||
this.removeDragHandle(type, name);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@ -15,7 +15,7 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds =
|
||||
return eventMatches && trackMatches && animationMatches;
|
||||
},
|
||||
IsFlippedX (this: SpineC3Instance) {
|
||||
return this.propFlipX;
|
||||
return this.isFlippedX;
|
||||
},
|
||||
IsSkeletonLoaded (this: SpineC3Instance) {
|
||||
return this.skeletonLoaded;
|
||||
@ -23,4 +23,7 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds =
|
||||
IsPlaying (this: SpineC3Instance) {
|
||||
return this.isPlaying;
|
||||
},
|
||||
IsInsideSlot (this: SpineC3Instance, x: number, y: number, slotName: string) {
|
||||
return this.isInsideSlot(x, y, slotName);
|
||||
},
|
||||
};
|
||||
|
||||
@ -29,6 +29,14 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
|
||||
return this.getBoneRotation(boneName);
|
||||
},
|
||||
|
||||
BoneWorldX (this: SDKInstanceClass, boneName: string) {
|
||||
return this.getBoneWorldX(boneName);
|
||||
},
|
||||
|
||||
BoneWorldY (this: SDKInstanceClass, boneName: string) {
|
||||
return this.getBoneWorldY(boneName);
|
||||
},
|
||||
|
||||
CurrentSkin (this: SDKInstanceClass) {
|
||||
return this.getCurrentSkin();
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -58,6 +58,10 @@
|
||||
"name": "Scale Y",
|
||||
"desc": "Scale Y"
|
||||
},
|
||||
"spine-debug-skeleton": {
|
||||
"name": "Debug skeleton",
|
||||
"desc": "Draw debug visualization of the skeleton bones"
|
||||
},
|
||||
"spine-bounds-offset-x": {
|
||||
"name": "Offset X",
|
||||
"desc": "Offset X"
|
||||
@ -113,6 +117,25 @@
|
||||
"list-name": "Is playing",
|
||||
"display-text": "Is playing",
|
||||
"description": "Check if the animation is currently playing"
|
||||
},
|
||||
"is-inside-slot": {
|
||||
"list-name": "Is point inside slot",
|
||||
"display-text": "Is point ({0}, {1}) inside slot {2}",
|
||||
"description": "Check if a point in world coordinates is inside a slot's attachment polygon",
|
||||
"params": {
|
||||
"x": {
|
||||
"name": "X",
|
||||
"desc": "X world coordinate"
|
||||
},
|
||||
"y": {
|
||||
"name": "Y",
|
||||
"desc": "Y world coordinate"
|
||||
},
|
||||
"slot-name": {
|
||||
"name": "Slot name",
|
||||
"desc": "Name of the slot to check"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
@ -404,6 +427,109 @@
|
||||
"desc": "Name of the slot to reset. Leave empty to reset all slots."
|
||||
}
|
||||
}
|
||||
},
|
||||
"update-bone-pose": {
|
||||
"list-name": "Update bone pose",
|
||||
"display-text": "Set bone {2} position to ({0}, {1})",
|
||||
"description": "Update the pose position of a bone to specific world coordinates.",
|
||||
"params": {
|
||||
"x": {
|
||||
"name": "X",
|
||||
"desc": "X world coordinate"
|
||||
},
|
||||
"y": {
|
||||
"name": "Y",
|
||||
"desc": "Y world coordinate"
|
||||
},
|
||||
"bone-name": {
|
||||
"name": "Bone name",
|
||||
"desc": "Name of the bone to update"
|
||||
}
|
||||
}
|
||||
},
|
||||
"attach-instance-to-bone": {
|
||||
"list-name": "Attach instance to bone",
|
||||
"display-text": "Attach instance UID {0} to bone {1} with offset ({2}, {3}, {4}°)",
|
||||
"description": "Make an object instance follow a skeleton bone's position and rotation. The instance will automatically update its position and angle to match the bone every frame. Offsets are applied in the bone's local space (rotated with the bone).",
|
||||
"params": {
|
||||
"uid": {
|
||||
"name": "UID",
|
||||
"desc": "The UID of the object instance to attach (use expression like Sprite.UID)"
|
||||
},
|
||||
"bone-name": {
|
||||
"name": "Bone name",
|
||||
"desc": "Name of the bone to follow"
|
||||
},
|
||||
"offset-x": {
|
||||
"name": "Offset X",
|
||||
"desc": "X offset from bone position (in bone's local space)"
|
||||
},
|
||||
"offset-y": {
|
||||
"name": "Offset Y",
|
||||
"desc": "Y offset from bone position (in bone's local space)"
|
||||
},
|
||||
"offset-angle": {
|
||||
"name": "Offset angle",
|
||||
"desc": "Angle offset in degrees from bone rotation"
|
||||
}
|
||||
}
|
||||
},
|
||||
"detach-instance-from-bone": {
|
||||
"list-name": "Detach instance from bone",
|
||||
"display-text": "Detach instance from bone {0}",
|
||||
"description": "Stop an object instance from following a bone. The instance will remain at its current position.",
|
||||
"params": {
|
||||
"bone-name": {
|
||||
"name": "Bone name",
|
||||
"desc": "Name of the bone to detach from"
|
||||
}
|
||||
}
|
||||
},
|
||||
"add-handle": {
|
||||
"list-name": "Add handle",
|
||||
"display-text": "Add interactive handle for {0} {1} with radius {2} (debug: {3})",
|
||||
"description": "Add an interactive handle to a bone or slot that can be dragged with the mouse. The radius determines the clickable area.",
|
||||
"params": {
|
||||
"type": {
|
||||
"name": "Type",
|
||||
"desc": "Type of handle to add",
|
||||
"items": {
|
||||
"bone": "Bone (drags bone position)",
|
||||
"slot": "Slot (drags slot attachment position)"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"name": "Name",
|
||||
"desc": "Name of the bone or slot to add handle to"
|
||||
},
|
||||
"radius": {
|
||||
"name": "Radius",
|
||||
"desc": "Radius of the clickable area in pixels"
|
||||
},
|
||||
"debug": {
|
||||
"name": "Debug",
|
||||
"desc": "Whether to show debug visualization for the handle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"remove-handle": {
|
||||
"list-name": "Remove handle",
|
||||
"display-text": "Remove handle from {0} {1}",
|
||||
"description": "Remove an interactive handle from a bone or slot.",
|
||||
"params": {
|
||||
"type": {
|
||||
"name": "Type",
|
||||
"desc": "Type of handle to remove",
|
||||
"items": {
|
||||
"bone": "Bone",
|
||||
"slot": "Slot"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"name": "Name",
|
||||
"desc": "Name of the bone or slot to remove handle from"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"expressions": {
|
||||
@ -457,6 +583,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"bone-world-x": {
|
||||
"description": "Get the C3 world X position of a bone.",
|
||||
"translated-name": "BoneWorldX",
|
||||
"params": {
|
||||
"bone-name": {
|
||||
"name": "Bone name",
|
||||
"desc": "Name of the bone"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bone-world-y": {
|
||||
"description": "Get the C3 world Y position of a bone.",
|
||||
"translated-name": "BoneWorldY",
|
||||
"params": {
|
||||
"bone-name": {
|
||||
"name": "Bone name",
|
||||
"desc": "Name of the bone"
|
||||
}
|
||||
}
|
||||
},
|
||||
"current-skin": {
|
||||
"description": "Get the current skin name. Returns comma-separated names if multiple skins are active.",
|
||||
"translated-name": "CurrentSkin"
|
||||
|
||||
@ -58,6 +58,10 @@
|
||||
"name": "Y缩放",
|
||||
"desc": "Y缩放"
|
||||
},
|
||||
"spine-debug-skeleton": {
|
||||
"name": "调试骨架",
|
||||
"desc": "绘制骨架骨骼的调试可视化"
|
||||
},
|
||||
"spine-bounds-offset-x": {
|
||||
"name": "X偏移",
|
||||
"desc": "X偏移"
|
||||
@ -113,6 +117,25 @@
|
||||
"list-name": "是否正在播放",
|
||||
"display-text": "是否正在播放",
|
||||
"description": "检查动画是否正在播放"
|
||||
},
|
||||
"is-inside-slot": {
|
||||
"list-name": "点是否在插槽内",
|
||||
"display-text": "点({0}, {1})是否在插槽{2}内",
|
||||
"description": "检查世界坐标中的点是否在插槽的附件多边形内",
|
||||
"params": {
|
||||
"x": {
|
||||
"name": "X",
|
||||
"desc": "X世界坐标"
|
||||
},
|
||||
"y": {
|
||||
"name": "Y",
|
||||
"desc": "Y世界坐标"
|
||||
},
|
||||
"slot-name": {
|
||||
"name": "插槽名称",
|
||||
"desc": "要检查的插槽名称"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
@ -406,6 +429,109 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"update-bone-pose": {
|
||||
"list-name": "更新骨骼姿势",
|
||||
"display-text": "将骨骼{2}的位置设置为({0}, {1})",
|
||||
"description": "将骨骼的姿势位置更新为特定的世界坐标。",
|
||||
"params": {
|
||||
"x": {
|
||||
"name": "X",
|
||||
"desc": "X世界坐标"
|
||||
},
|
||||
"y": {
|
||||
"name": "Y",
|
||||
"desc": "Y世界坐标"
|
||||
},
|
||||
"bone-name": {
|
||||
"name": "骨骼名称",
|
||||
"desc": "要更新的骨骼名称"
|
||||
}
|
||||
}
|
||||
},
|
||||
"attach-instance-to-bone": {
|
||||
"list-name": "将实例附加到骨骼",
|
||||
"display-text": "将实例UID {0}附加到骨骼{1},偏移({2}, {3}, {4}°)",
|
||||
"description": "使对象实例跟随骨架骨骼的位置和旋转。实例将每帧自动更新其位置和角度以匹配骨骼。偏移量在骨骼的本地空间中应用(随骨骼旋转)。",
|
||||
"params": {
|
||||
"uid": {
|
||||
"name": "UID",
|
||||
"desc": "要附加的对象实例的UID(使用类似Sprite.UID的表达式)"
|
||||
},
|
||||
"bone-name": {
|
||||
"name": "骨骼名称",
|
||||
"desc": "要跟随的骨骼名称"
|
||||
},
|
||||
"offset-x": {
|
||||
"name": "X偏移",
|
||||
"desc": "距骨骼位置的X偏移(在骨骼本地空间中)"
|
||||
},
|
||||
"offset-y": {
|
||||
"name": "Y偏移",
|
||||
"desc": "距骨骼位置的Y偏移(在骨骼本地空间中)"
|
||||
},
|
||||
"offset-angle": {
|
||||
"name": "角度偏移",
|
||||
"desc": "距骨骼旋转的角度偏移(度)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"detach-instance-from-bone": {
|
||||
"list-name": "将实例从骨骼分离",
|
||||
"display-text": "将实例从骨骼{0}分离",
|
||||
"description": "停止对象实例跟随骨骼。实例将保持在其当前位置。",
|
||||
"params": {
|
||||
"bone-name": {
|
||||
"name": "骨骼名称",
|
||||
"desc": "要分离的骨骼名称"
|
||||
}
|
||||
}
|
||||
},
|
||||
"add-handle": {
|
||||
"list-name": "添加控制柄",
|
||||
"display-text": "为{0} {1}添加交互控制柄,半径{2}(调试:{3})",
|
||||
"description": "为骨骼或插槽添加可以用鼠标拖动的交互控制柄。半径决定可点击区域的大小。",
|
||||
"params": {
|
||||
"type": {
|
||||
"name": "类型",
|
||||
"desc": "要添加的控制柄类型",
|
||||
"items": {
|
||||
"bone": "骨骼(拖动骨骼位置)",
|
||||
"slot": "插槽(拖动插槽附件位置)"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"name": "名称",
|
||||
"desc": "要添加控制柄的骨骼或插槽名称"
|
||||
},
|
||||
"radius": {
|
||||
"name": "半径",
|
||||
"desc": "可点击区域的半径(像素)"
|
||||
},
|
||||
"debug": {
|
||||
"name": "调试",
|
||||
"desc": "是否显示控制柄的调试可视化"
|
||||
}
|
||||
}
|
||||
},
|
||||
"remove-handle": {
|
||||
"list-name": "移除控制柄",
|
||||
"display-text": "从{0} {1}移除控制柄",
|
||||
"description": "从骨骼或插槽移除交互控制柄。",
|
||||
"params": {
|
||||
"type": {
|
||||
"name": "类型",
|
||||
"desc": "要移除的控制柄类型",
|
||||
"items": {
|
||||
"bone": "骨骼",
|
||||
"slot": "插槽"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"name": "名称",
|
||||
"desc": "要移除控制柄的骨骼或插槽名称"
|
||||
}
|
||||
}
|
||||
},
|
||||
"expressions": {
|
||||
"double": {
|
||||
"description": "将数字翻倍。",
|
||||
@ -457,6 +583,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"bone-world-x": {
|
||||
"description": "获取骨骼的C3世界X位置。",
|
||||
"translated-name": "BoneWorldX",
|
||||
"params": {
|
||||
"bone-name": {
|
||||
"name": "骨骼名称",
|
||||
"desc": "骨骼的名称"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bone-world-y": {
|
||||
"description": "获取骨骼的C3世界Y位置。",
|
||||
"translated-name": "BoneWorldY",
|
||||
"params": {
|
||||
"bone-name": {
|
||||
"name": "骨骼名称",
|
||||
"desc": "骨骼的名称"
|
||||
}
|
||||
}
|
||||
},
|
||||
"current-skin": {
|
||||
"description": "获取当前皮肤名称。如果有多个皮肤处于活动状态,返回逗号分隔的名称。",
|
||||
"translated-name": "CurrentSkin"
|
||||
|
||||
@ -33,6 +33,7 @@ const PLUGIN_CLASS = class SpineC3Plugin extends SDK.IPluginBase {
|
||||
static PROP_BOUNDS_OFFSET_ANGLE = "spine-bounds-offset-angle";
|
||||
static PROP_SKELETON_SCALE_X = "spine-scale-x";
|
||||
static PROP_SKELETON_SCALE_Y = "spine-scale-y";
|
||||
static PROP_DEBUG_SKELETON = "spine-debug-skeleton";
|
||||
|
||||
static TYPE_BOUNDS_SETUP = "setup";
|
||||
static TYPE_BOUNDS_ANIMATION_SKIN = "animation-skin";
|
||||
@ -71,6 +72,7 @@ const PLUGIN_CLASS = class SpineC3Plugin extends SDK.IPluginBase {
|
||||
new SDK.PluginProperty("float", SpineC3Plugin.PROP_LOADER_SCALE, 1),
|
||||
new SDK.PluginProperty("text", SpineC3Plugin.PROP_SKIN, ""),
|
||||
new SDK.PluginProperty("text", SpineC3Plugin.PROP_ANIMATION, ""),
|
||||
new SDK.PluginProperty("check", SpineC3Plugin.PROP_DEBUG_SKELETON, false),
|
||||
new SDK.PluginProperty("info", SpineC3Plugin.PROP_ERRORS, {
|
||||
infoCallback (inst) {
|
||||
const errors = (inst.GetInstance() as unknown as { errors: Record<string, string> }).errors;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user