mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
540319e1d4
@ -3010,7 +3010,7 @@ class Skeleton {
|
|||||||
/// <p>
|
/// <p>
|
||||||
/// Bones that do not inherit translation are still affected by this property.
|
/// Bones that do not inherit translation are still affected by this property.
|
||||||
double getY() {
|
double getY() {
|
||||||
return _bindings.spine_skeleton_get_x(_skeleton);
|
return _bindings.spine_skeleton_get_y(_skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setY(double y) {
|
void setY(double y) {
|
||||||
@ -3032,7 +3032,7 @@ class Skeleton {
|
|||||||
///
|
///
|
||||||
/// Bones that do not inherit scale are still affected by this property.
|
/// Bones that do not inherit scale are still affected by this property.
|
||||||
double getScaleY() {
|
double getScaleY() {
|
||||||
return _bindings.spine_skeleton_get_scale_x(_skeleton);
|
return _bindings.spine_skeleton_get_scale_y(_skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setScaleY(double scaleY) {
|
void setScaleY(double scaleY) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
// Set the default animation and the
|
// Set the default animation and the
|
||||||
// default mix for transitioning between animations.
|
// default mix for transitioning between animations.
|
||||||
spineboy.state.setAnimation(0, "run", true);
|
spineboy.state.setAnimation(0, "hoverboard", true);
|
||||||
spineboy.state.data.defaultMix = 0.2;
|
spineboy.state.data.defaultMix = 0.2;
|
||||||
|
|
||||||
// Center the spine object on screen.
|
// Center the spine object on screen.
|
||||||
@ -42,20 +42,57 @@
|
|||||||
spineboy.y = window.innerHeight / 2 + spineboy.getBounds().height / 2;
|
spineboy.y = window.innerHeight / 2 + spineboy.getBounds().height / 2;
|
||||||
|
|
||||||
// Make it so that you can interact with Spineboy.
|
// Make it so that you can interact with Spineboy.
|
||||||
// Also, handle the case that you click or tap on the screen.
|
// Handle the case that you click/tap the screen.
|
||||||
// The callback function definition can be seen below.
|
|
||||||
spineboy.eventMode = 'static';
|
spineboy.eventMode = 'static';
|
||||||
spineboy.on('pointerdown', onClick);
|
spineboy.on('pointerdown', onClick);
|
||||||
|
|
||||||
// Add the display object to the stage.
|
// Add the display object to the stage.
|
||||||
app.stage.addChild(spineboy);
|
app.stage.addChild(spineboy);
|
||||||
|
|
||||||
// This callback function handles what happens
|
// Add variables for movement, speed.
|
||||||
// when you click or tap on the screen.
|
let moveLeft = false;
|
||||||
function onClick() {
|
let moveRight = false;
|
||||||
spineboy.state.addAnimation(0, "jump", false, 0);
|
const speed = 5;
|
||||||
spineboy.state.addAnimation(0, "idle", true, 0);
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -172,15 +172,14 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
if (EditorApplication.isPlayingOrWillChangePlaymode) return;
|
if (EditorApplication.isPlayingOrWillChangePlaymode) return;
|
||||||
|
|
||||||
string[] folders = { "Assets", "Packages" };
|
|
||||||
string[] assets;
|
string[] assets;
|
||||||
string assetPath;
|
string assetPath;
|
||||||
assets = AssetDatabase.FindAssets("t:texture icon-subMeshRenderer", folders);
|
assets = AssetDatabase.FindAssets("t:texture icon-subMeshRenderer", null);
|
||||||
if (assets.Length > 0) {
|
if (assets.Length > 0) {
|
||||||
assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);
|
assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);
|
||||||
editorGUIPath = Path.GetDirectoryName(assetPath).Replace('\\', '/');
|
editorGUIPath = Path.GetDirectoryName(assetPath).Replace('\\', '/');
|
||||||
}
|
}
|
||||||
assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities", folders);
|
assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities", null);
|
||||||
if (assets.Length > 0) {
|
if (assets.Length > 0) {
|
||||||
assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);
|
assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);
|
||||||
editorPath = Path.GetDirectoryName(assetPath).Replace('\\', '/');
|
editorPath = Path.GetDirectoryName(assetPath).Replace('\\', '/');
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-unity",
|
"name": "com.esotericsoftware.spine.spine-unity",
|
||||||
"displayName": "spine-unity Runtime",
|
"displayName": "spine-unity Runtime",
|
||||||
"description": "This plugin provides the spine-unity runtime core.",
|
"description": "This plugin provides the spine-unity runtime core.",
|
||||||
"version": "4.2.45",
|
"version": "4.2.46",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user