mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[phaser] Clean-up, TypeScript example README, non-null SpineGameObject fields.
This commit is contained in:
parent
cc0ee7ce80
commit
2900605300
@ -350,6 +350,10 @@ cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-ts/spine-phaser/example/
|
||||
cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||
cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||
|
||||
cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-ts/spine-phaser/example/typescript/assets/"
|
||||
cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-ts/spine-phaser/example/typescript/assets/"
|
||||
cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-ts/spine-phaser/example/typescript/assets/"
|
||||
|
||||
cp -f ../coin/export/coin-pro.skel "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||
cp -f ../coin/export/coin-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||
cp -f ../coin/export/coin-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
let game = new Phaser.Game(config);
|
||||
|
||||
function preload() {
|
||||
this.load.image('logo', 'assets/phaser.png');
|
||||
this.load.image('logo', 'phaser.png');
|
||||
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
|
||||
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
preload() {
|
||||
this.load.image('logo', 'assets/phaser.png');
|
||||
this.load.image('logo', 'phaser.png');
|
||||
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
|
||||
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
|
||||
}
|
||||
|
||||
6
spine-ts/spine-phaser/example/typescript/README.md
Normal file
6
spine-ts/spine-phaser/example/typescript/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# spine-phaser TypeScript
|
||||
Minimal example project using Phaser, spine-phaser, and TypeScript via NPM and [esbuild](https://esbuild.github.io/).
|
||||
|
||||
1. Install dependencies: `npm install`
|
||||
2. Build bundle: `npm run build`
|
||||
3. Development (run server and recompile in watch mode): `npm run dev`
|
||||
@ -1,5 +1,5 @@
|
||||
import {Scene} from "phaser"
|
||||
import {SpineGameObject, SpineGameObjectBoundsProvider, SpinePlugin} from "@esotericsoftware/spine-phaser"
|
||||
import {SpinePlugin} from "@esotericsoftware/spine-phaser"
|
||||
|
||||
class SpineDemo extends Scene {
|
||||
preload() {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"name": "name",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@esotericsoftware/spine-phaser": "4.1.*",
|
||||
"@esotericsoftware/spine-phaser": "../../",
|
||||
"phaser": "3.60.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -370,34 +370,34 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esotericsoftware/spine-canvas": {
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-canvas/-/spine-canvas-4.2.11.tgz",
|
||||
"integrity": "sha512-NEYBSPxAvVaJO2Jtcr/FCYzq6uZprX2BuohA3isq2xn/BckXfZQXLlLT/1+34kK3+gc5XQsMA2YfrHYw35QAMQ==",
|
||||
"version": "4.1.29",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-canvas/-/spine-canvas-4.1.29.tgz",
|
||||
"integrity": "sha512-X5wbvIPeYRQGvRa30gc2/FNbw6K0IQCn4ByjIB23pEutmXeJJyuRPON0Kn3951Ir5BPUohZoZMYHd2uxyLXTGA==",
|
||||
"dependencies": {
|
||||
"@esotericsoftware/spine-core": "^4.2.11"
|
||||
"@esotericsoftware/spine-core": "4.1.29"
|
||||
}
|
||||
},
|
||||
"node_modules/@esotericsoftware/spine-core": {
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-core/-/spine-core-4.2.11.tgz",
|
||||
"integrity": "sha512-yyieou3t6XNYNqbWDdGEkVBg2JAAjLrtrNxGIkweNaH38O4p5Z4pPw2r7BKhCkUEW6+TITYkbNslsGGPU3HMAw=="
|
||||
"version": "4.1.29",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-core/-/spine-core-4.1.29.tgz",
|
||||
"integrity": "sha512-Lzgt30MioPRWaco8fyaoVqBOfWO/jsGtRNl+6I1h3sWu9AhpV+/sXYcplSqma3KzWvALh2Q/WFOr5bUSReqINw=="
|
||||
},
|
||||
"node_modules/@esotericsoftware/spine-phaser": {
|
||||
"version": "4.1.28",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-phaser/-/spine-phaser-4.1.28.tgz",
|
||||
"integrity": "sha512-vlDBFeBNLEjxWS4uo24AH4HZeEMfYIDzpsyV8cvnLI5F3E9l+GfHOtdc2to9m1CYOilawZA4zl4oOOCLPgbmWA==",
|
||||
"version": "4.1.29",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-phaser/-/spine-phaser-4.1.29.tgz",
|
||||
"integrity": "sha512-6vStoBJxnBii9Mk+adX7nygicCwboK49EcIVH+O9C128mH1jc16pb9OeQAT6xeLpFOnE6k+Nre2EXYdQ+eXXYw==",
|
||||
"dependencies": {
|
||||
"@esotericsoftware/spine-canvas": "^4.1.28",
|
||||
"@esotericsoftware/spine-core": "^4.1.28",
|
||||
"@esotericsoftware/spine-webgl": "^4.1.28"
|
||||
"@esotericsoftware/spine-canvas": "4.1.29",
|
||||
"@esotericsoftware/spine-core": "4.1.29",
|
||||
"@esotericsoftware/spine-webgl": "4.1.29"
|
||||
}
|
||||
},
|
||||
"node_modules/@esotericsoftware/spine-webgl": {
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-webgl/-/spine-webgl-4.2.11.tgz",
|
||||
"integrity": "sha512-DCk+Qp4QxzA3PCYpxtVxt1cChnDhs9AjvbzVtHkHE7nKyRnoYjH7JDghuyVvOEI8YJZS29vDD0rD7i22ne9QXg==",
|
||||
"version": "4.1.29",
|
||||
"resolved": "https://registry.npmjs.org/@esotericsoftware/spine-webgl/-/spine-webgl-4.1.29.tgz",
|
||||
"integrity": "sha512-sucAXTO0Hp5BR4DqkQTkA+gKI62AtCoSmz1Ld9akowG/x1+XYLVJ9GEbYLsUEUyoZOAP7aWa/HzGDSi/sHRs0w==",
|
||||
"dependencies": {
|
||||
"@esotericsoftware/spine-core": "^4.2.11"
|
||||
"@esotericsoftware/spine-core": "4.1.29"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"dev": "npx concurrently \"npx live-server --no-browser\" \"npm run build -- --watch\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@esotericsoftware/spine-phaser": "4.1.*",
|
||||
"@esotericsoftware/spine-phaser": "../../",
|
||||
"phaser": "3.60.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -77,9 +77,9 @@ export class SkinsAndAnimationBoundsProvider implements SpineGameObjectBoundsPro
|
||||
|
||||
export class SpineGameObject extends ComputedSizeMixin(DepthMixin(FlipMixin(ScrollFactorMixin(TransformMixin(VisibleMixin(AlphaMixin(BaseSpineGameObject))))))) {
|
||||
blendMode = -1;
|
||||
skeleton: Skeleton | null = null;
|
||||
animationStateData: AnimationStateData | null = null;
|
||||
animationState: AnimationState | null = null;
|
||||
skeleton: Skeleton;
|
||||
animationStateData: AnimationStateData;
|
||||
animationState: AnimationState;
|
||||
private premultipliedAlpha = false;
|
||||
private _displayOriginX = 0;
|
||||
private _displayOriginY = 0;
|
||||
@ -89,21 +89,12 @@ export class SpineGameObject extends ComputedSizeMixin(DepthMixin(FlipMixin(Scro
|
||||
constructor (scene: Phaser.Scene, private plugin: SpinePlugin, x: number, y: number, dataKey: string, atlasKey: string, public boundsProvider: SpineGameObjectBoundsProvider = new SetupPoseBoundsProvider()) {
|
||||
super(scene, SPINE_GAME_OBJECT_TYPE);
|
||||
this.setPosition(x, y);
|
||||
this.setSkeleton(dataKey, atlasKey);
|
||||
}
|
||||
|
||||
setSkeleton (dataKey: string, atlasKey: string) {
|
||||
if (dataKey && atlasKey) {
|
||||
this.premultipliedAlpha = this.plugin.isAtlasPremultiplied(atlasKey);
|
||||
this.skeleton = this.plugin.createSkeleton(dataKey, atlasKey);
|
||||
this.animationStateData = new AnimationStateData(this.skeleton.data);
|
||||
this.animationState = new AnimationState(this.animationStateData);
|
||||
this.updateSize();
|
||||
} else {
|
||||
this.skeleton = null;
|
||||
this.animationStateData = null;
|
||||
this.animationState = null;
|
||||
}
|
||||
|
||||
this.premultipliedAlpha = this.plugin.isAtlasPremultiplied(atlasKey);
|
||||
this.skeleton = this.plugin.createSkeleton(dataKey, atlasKey);
|
||||
this.animationStateData = new AnimationStateData(this.skeleton.data);
|
||||
this.animationState = new AnimationState(this.animationStateData);
|
||||
this.updateSize();
|
||||
}
|
||||
|
||||
public get displayOriginX () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user