From d583fe5c581ac02a1667930b43bcff7784a035f0 Mon Sep 17 00:00:00 2001 From: Luke Ingram Date: Fri, 19 Jan 2024 11:41:22 -0400 Subject: [PATCH 1/3] [ts] Update simple input example to showcase keyboard input. --- spine-ts/spine-pixi/example/simple-input.html | 57 +++++++++++++++---- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/spine-ts/spine-pixi/example/simple-input.html b/spine-ts/spine-pixi/example/simple-input.html index 105991c84..994d348ff 100644 --- a/spine-ts/spine-pixi/example/simple-input.html +++ b/spine-ts/spine-pixi/example/simple-input.html @@ -34,7 +34,7 @@ // Set the default animation and the // default mix for transitioning between animations. - spineboy.state.setAnimation(0, "run", true); + spineboy.state.setAnimation(0, "hoverboard", true); spineboy.state.data.defaultMix = 0.2; // Center the spine object on screen. @@ -42,20 +42,57 @@ spineboy.y = window.innerHeight / 2 + spineboy.getBounds().height / 2; // Make it so that you can interact with Spineboy. - // Also, handle the case that you click or tap on the screen. - // The callback function definition can be seen below. + // Handle the case that you click/tap the screen. spineboy.eventMode = 'static'; spineboy.on('pointerdown', onClick); - + // Add the display object to the stage. app.stage.addChild(spineboy); - - // This callback function handles what happens - // when you click or tap on the screen. - function onClick() { - spineboy.state.addAnimation(0, "jump", false, 0); - spineboy.state.addAnimation(0, "idle", true, 0); + + // Add variables for movement, speed. + let moveLeft = false; + let moveRight = false; + const speed = 5; + + // Handle the case that the keyboard keys specified below are pressed. + function onKeyDown(key) { + if (key.code === "ArrowLeft" || key.code === "KeyA") { + moveLeft = true; + spineboy.skeleton.scaleX = -1; + } else if (key.code === "ArrowRight" || key.code === "KeyD") { + moveRight = true; + spineboy.skeleton.scaleX = 1; + } } + + // Handle when the keys are released, if they were pressed. + function onKeyUp(key) { + if (key.code === "ArrowLeft" || key.code === "KeyA") { + moveLeft = false; + } else if (key.code === "ArrowRight" || key.code === "KeyD") { + moveRight = false; + } + } + + // Handle if you click/tap the screen. + function onClick() { + spineboy.state.setAnimation(1, "shoot", false, 0); + } + + // Add event listeners so that the window will correctly handle input. + window.addEventListener("keydown", onKeyDown); + window.addEventListener("keyup", onKeyUp); + + // Update the application to move Spineboy if input is detected. + app.ticker.add(() => { + if (moveLeft) { + spineboy.x -= speed; + } + if (moveRight) { + spineboy.x += speed; + } + }); + })(); From 2c6d10bef88b84c78dc3cec5f36dd3574a6581db Mon Sep 17 00:00:00 2001 From: Kaisei Date: Mon, 22 Jan 2024 23:14:26 +0900 Subject: [PATCH 2/3] Fix skeleton.getY() and skeleton.getScaleY() (#2454) --- spine-flutter/lib/spine_flutter.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-flutter/lib/spine_flutter.dart b/spine-flutter/lib/spine_flutter.dart index d49a30993..a5fdd51eb 100644 --- a/spine-flutter/lib/spine_flutter.dart +++ b/spine-flutter/lib/spine_flutter.dart @@ -3010,7 +3010,7 @@ class Skeleton { ///

/// Bones that do not inherit translation are still affected by this property. double getY() { - return _bindings.spine_skeleton_get_x(_skeleton); + return _bindings.spine_skeleton_get_y(_skeleton); } void setY(double y) { @@ -3032,7 +3032,7 @@ class Skeleton { /// /// Bones that do not inherit scale are still affected by this property. double getScaleY() { - return _bindings.spine_skeleton_get_scale_x(_skeleton); + return _bindings.spine_skeleton_get_scale_y(_skeleton); } void setScaleY(double scaleY) { From 42635d2a8feaba0814becffe0949487a3ae4572e Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 24 Jan 2024 17:10:54 +0100 Subject: [PATCH 3/3] [unity] Editor icons not loaded from UPM package on Unity 2022.1. Closes #2455. --- .../spine-unity/Editor/Utility/SpineEditorUtilities.cs | 5 ++--- spine-unity/Assets/Spine/package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs index 95d69a951..86a63a79f 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs @@ -172,15 +172,14 @@ namespace Spine.Unity.Editor { if (EditorApplication.isPlayingOrWillChangePlaymode) return; - string[] folders = { "Assets", "Packages" }; string[] assets; string assetPath; - assets = AssetDatabase.FindAssets("t:texture icon-subMeshRenderer", folders); + assets = AssetDatabase.FindAssets("t:texture icon-subMeshRenderer", null); if (assets.Length > 0) { assetPath = AssetDatabase.GUIDToAssetPath(assets[0]); editorGUIPath = Path.GetDirectoryName(assetPath).Replace('\\', '/'); } - assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities", folders); + assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities", null); if (assets.Length > 0) { assetPath = AssetDatabase.GUIDToAssetPath(assets[0]); editorPath = Path.GetDirectoryName(assetPath).Replace('\\', '/'); diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index a37922cd6..4a4956a2b 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.1.34", + "version": "4.1.35", "unity": "2018.3", "author": { "name": "Esoteric Software",