mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Added AssetManager#require which throws an error for an asset that isn't loaded.
This commit is contained in:
parent
1fbe75cd71
commit
b8bf2a9bbb
26
spine-ts/build/spine-all.d.ts
vendored
26
spine-ts/build/spine-all.d.ts
vendored
@ -361,6 +361,7 @@ declare module spine {
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
require(path: string): any;
|
||||
remove(path: string): any;
|
||||
removeAll(): void;
|
||||
isLoadingComplete(): boolean;
|
||||
@ -1778,7 +1779,7 @@ declare module spine {
|
||||
interface SpinePlayerConfig {
|
||||
jsonUrl: string;
|
||||
jsonField: string;
|
||||
skelUrl: string;
|
||||
binaryUrl: string;
|
||||
atlasUrl: string;
|
||||
rawDataURIs: Map<string>;
|
||||
animation: string;
|
||||
@ -1826,9 +1827,10 @@ declare module spine {
|
||||
controlBones: string[];
|
||||
success: (player: SpinePlayer) => void;
|
||||
error: (player: SpinePlayer, msg: string) => void;
|
||||
frame: (player: SpinePlayer) => void;
|
||||
update: (player: SpinePlayer) => void;
|
||||
draw: (player: SpinePlayer) => void;
|
||||
frame: (player: SpinePlayer, delta: number) => void;
|
||||
update: (player: SpinePlayer, delta: number) => void;
|
||||
draw: (player: SpinePlayer, delta: number) => void;
|
||||
loading: (player: SpinePlayer, delta: number) => void;
|
||||
downloader: spine.Downloader;
|
||||
}
|
||||
interface Viewport {
|
||||
@ -1843,12 +1845,12 @@ declare module spine {
|
||||
}
|
||||
class SpinePlayer {
|
||||
private config;
|
||||
private parent;
|
||||
parent: HTMLElement;
|
||||
dom: HTMLElement;
|
||||
canvas: HTMLCanvasElement;
|
||||
private context;
|
||||
private sceneRenderer;
|
||||
private loadingScreen;
|
||||
context: spine.webgl.ManagedWebGLRenderingContext;
|
||||
sceneRenderer: spine.webgl.SceneRenderer;
|
||||
loadingScreen: spine.webgl.LoadingScreen;
|
||||
assetManager: spine.webgl.AssetManager;
|
||||
bg: Color;
|
||||
bgFullscreen: Color;
|
||||
@ -1864,16 +1866,17 @@ declare module spine {
|
||||
error: boolean;
|
||||
skeleton: Skeleton;
|
||||
animationState: AnimationState;
|
||||
private paused;
|
||||
paused: boolean;
|
||||
speed: number;
|
||||
private time;
|
||||
time: TimeKeeper;
|
||||
private stopRequestAnimationFrame;
|
||||
private viewport;
|
||||
private currentViewport;
|
||||
private previousViewport;
|
||||
private viewportTransitionStart;
|
||||
constructor(parent: HTMLElement | string, config: SpinePlayerConfig);
|
||||
private validateConfig;
|
||||
private create;
|
||||
private initialize;
|
||||
private loadSkeleton;
|
||||
private setupInput;
|
||||
play(): void;
|
||||
@ -1884,7 +1887,6 @@ declare module spine {
|
||||
private percentageToWorldUnit;
|
||||
private calculateAnimationViewport;
|
||||
private drawFrame;
|
||||
private scale;
|
||||
stopRendering(): void;
|
||||
private showSpeedDialog;
|
||||
private showAnimationsDialog;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
spine-ts/build/spine-canvas.d.ts
vendored
1
spine-ts/build/spine-canvas.d.ts
vendored
@ -361,6 +361,7 @@ declare module spine {
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
require(path: string): any;
|
||||
remove(path: string): any;
|
||||
removeAll(): void;
|
||||
isLoadingComplete(): boolean;
|
||||
|
||||
@ -2882,7 +2882,7 @@ var spine;
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page image: " + imagePath);
|
||||
abort_1 = true;
|
||||
});
|
||||
};
|
||||
@ -2901,6 +2901,14 @@ var spine;
|
||||
AssetManager.prototype.get = function (path) {
|
||||
return this.assets[this.pathPrefix + path];
|
||||
};
|
||||
AssetManager.prototype.require = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
if (asset)
|
||||
return asset;
|
||||
var error = this.errors[path];
|
||||
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
||||
};
|
||||
AssetManager.prototype.remove = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
spine-ts/build/spine-core.d.ts
vendored
1
spine-ts/build/spine-core.d.ts
vendored
@ -361,6 +361,7 @@ declare module spine {
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
require(path: string): any;
|
||||
remove(path: string): any;
|
||||
removeAll(): void;
|
||||
isLoadingComplete(): boolean;
|
||||
|
||||
@ -2882,7 +2882,7 @@ var spine;
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page image: " + imagePath);
|
||||
abort_1 = true;
|
||||
});
|
||||
};
|
||||
@ -2901,6 +2901,14 @@ var spine;
|
||||
AssetManager.prototype.get = function (path) {
|
||||
return this.assets[this.pathPrefix + path];
|
||||
};
|
||||
AssetManager.prototype.require = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
if (asset)
|
||||
return asset;
|
||||
var error = this.errors[path];
|
||||
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
||||
};
|
||||
AssetManager.prototype.remove = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
spine-ts/build/spine-player.d.ts
vendored
1
spine-ts/build/spine-player.d.ts
vendored
@ -361,6 +361,7 @@ declare module spine {
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
require(path: string): any;
|
||||
remove(path: string): any;
|
||||
removeAll(): void;
|
||||
isLoadingComplete(): boolean;
|
||||
|
||||
@ -2882,7 +2882,7 @@ var spine;
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page image: " + imagePath);
|
||||
abort_1 = true;
|
||||
});
|
||||
};
|
||||
@ -2901,6 +2901,14 @@ var spine;
|
||||
AssetManager.prototype.get = function (path) {
|
||||
return this.assets[this.pathPrefix + path];
|
||||
};
|
||||
AssetManager.prototype.require = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
if (asset)
|
||||
return asset;
|
||||
var error = this.errors[path];
|
||||
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
||||
};
|
||||
AssetManager.prototype.remove = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
@ -11799,7 +11807,7 @@ var spine;
|
||||
if (this.assetManager.hasErrors())
|
||||
this.showError("Error: Assets could not be loaded.\n" + toString(this.assetManager.getErrors()));
|
||||
var config = this.config;
|
||||
var atlas = this.assetManager.get(config.atlasUrl);
|
||||
var atlas = this.assetManager.require(config.atlasUrl);
|
||||
var gl = this.context.gl, anisotropic = gl.getExtension("EXT_texture_filter_anisotropic");
|
||||
for (var _i = 0, _a = atlas.pages; _i < _a.length; _i++) {
|
||||
var page = _a[_i];
|
||||
@ -12191,7 +12199,7 @@ var spine;
|
||||
renderer.begin();
|
||||
var bgImage = config.backgroundImage;
|
||||
if (bgImage) {
|
||||
var texture = this.assetManager.get(bgImage.url);
|
||||
var texture = this.assetManager.require(bgImage.url);
|
||||
if (bgImage.x !== void 0 && bgImage.y !== void 0 && bgImage.width && bgImage.height)
|
||||
renderer.drawTexture(texture, bgImage.x, bgImage.y, bgImage.width, bgImage.height);
|
||||
else
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
spine-ts/build/spine-threejs.d.ts
vendored
1
spine-ts/build/spine-threejs.d.ts
vendored
@ -361,6 +361,7 @@ declare module spine {
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
require(path: string): any;
|
||||
remove(path: string): any;
|
||||
removeAll(): void;
|
||||
isLoadingComplete(): boolean;
|
||||
|
||||
@ -2882,7 +2882,7 @@ var spine;
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page image: " + imagePath);
|
||||
abort_1 = true;
|
||||
});
|
||||
};
|
||||
@ -2901,6 +2901,14 @@ var spine;
|
||||
AssetManager.prototype.get = function (path) {
|
||||
return this.assets[this.pathPrefix + path];
|
||||
};
|
||||
AssetManager.prototype.require = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
if (asset)
|
||||
return asset;
|
||||
var error = this.errors[path];
|
||||
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
||||
};
|
||||
AssetManager.prototype.remove = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
spine-ts/build/spine-webgl.d.ts
vendored
1
spine-ts/build/spine-webgl.d.ts
vendored
@ -361,6 +361,7 @@ declare module spine {
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
require(path: string): any;
|
||||
remove(path: string): any;
|
||||
removeAll(): void;
|
||||
isLoadingComplete(): boolean;
|
||||
|
||||
@ -2882,7 +2882,7 @@ var spine;
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page image: " + imagePath);
|
||||
abort_1 = true;
|
||||
});
|
||||
};
|
||||
@ -2901,6 +2901,14 @@ var spine;
|
||||
AssetManager.prototype.get = function (path) {
|
||||
return this.assets[this.pathPrefix + path];
|
||||
};
|
||||
AssetManager.prototype.require = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
if (asset)
|
||||
return asset;
|
||||
var error = this.errors[path];
|
||||
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
||||
};
|
||||
AssetManager.prototype.remove = function (path) {
|
||||
path = this.pathPrefix + path;
|
||||
var asset = this.assets[path];
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -58,7 +58,7 @@ function loadSkeleton (name, initialAnimation, skin) {
|
||||
|
||||
// Load the texture atlas using name.atlas and name.png from the AssetManager.
|
||||
// The function passed to TextureAtlas is used to resolve relative paths.
|
||||
atlas = new spine.TextureAtlas(assetManager.get(name.replace("-pro", "").replace("-ess", "") + ".atlas"));
|
||||
atlas = new spine.TextureAtlas(assetManager.require(name.replace("-pro", "").replace("-ess", "") + ".atlas"));
|
||||
atlas.setTextures(assetManager);
|
||||
|
||||
// Create a AtlasAttachmentLoader, which is specific to the WebGL backend.
|
||||
@ -68,7 +68,7 @@ function loadSkeleton (name, initialAnimation, skin) {
|
||||
var skeletonJson = new spine.SkeletonJson(atlasLoader);
|
||||
|
||||
// Set the scale to apply during parsing, parse the file, and create a new skeleton.
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(name + ".json"));
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.require(name + ".json"));
|
||||
var skeleton = new spine.Skeleton(skeletonData);
|
||||
skeleton.scaleY = -1;
|
||||
var bounds = calculateBounds(skeleton);
|
||||
|
||||
@ -154,7 +154,7 @@ module spine {
|
||||
}
|
||||
},
|
||||
(imagePath: string, message: string) => {
|
||||
if (!abort) this.error(error, path, `Couldn't load texture atlas ${path} page ${imagePath}: ${message}`);
|
||||
if (!abort) this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
||||
abort = true;
|
||||
}
|
||||
);
|
||||
@ -171,6 +171,14 @@ module spine {
|
||||
return this.assets[this.pathPrefix + path];
|
||||
}
|
||||
|
||||
require (path: string) {
|
||||
path = this.pathPrefix + path;
|
||||
let asset = this.assets[path];
|
||||
if (asset) return asset;
|
||||
let error = this.errors[path];
|
||||
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
||||
}
|
||||
|
||||
remove (path: string) {
|
||||
path = this.pathPrefix + path;
|
||||
let asset = this.assets[path];
|
||||
|
||||
@ -397,7 +397,7 @@ module spine {
|
||||
let config = this.config;
|
||||
|
||||
// Configure filtering.
|
||||
let atlas = this.assetManager.get(config.atlasUrl);
|
||||
let atlas = this.assetManager.require(config.atlasUrl);
|
||||
let gl = this.context.gl, anisotropic = gl.getExtension("EXT_texture_filter_anisotropic");
|
||||
for (let page of atlas.pages) {
|
||||
let minFilter = page.minFilter;
|
||||
@ -818,7 +818,7 @@ module spine {
|
||||
// Draw the background image.
|
||||
let bgImage = config.backgroundImage;
|
||||
if (bgImage) {
|
||||
let texture = this.assetManager.get(bgImage.url);
|
||||
let texture = this.assetManager.require(bgImage.url);
|
||||
if (bgImage.x !== void 0 && bgImage.y !== void 0 && bgImage.width && bgImage.height)
|
||||
renderer.drawTexture(texture, bgImage.x, bgImage.y, bgImage.width, bgImage.height);
|
||||
else
|
||||
|
||||
@ -54,7 +54,7 @@ function load (name, scale) {
|
||||
|
||||
// Load the texture atlas using name.atlas and name.png from the AssetManager.
|
||||
// The function passed to TextureAtlas is used to resolve relative paths.
|
||||
atlas = assetManager.get(atlasFile);
|
||||
atlas = assetManager.require(atlasFile);
|
||||
|
||||
// Create a AtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
||||
atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
@ -64,7 +64,7 @@ function load (name, scale) {
|
||||
|
||||
// Set the scale to apply during parsing, parse the file, and create a new skeleton.
|
||||
skeletonJson.scale = 0.4;
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.get(skeletonFile));
|
||||
var skeletonData = skeletonJson.readSkeletonData(assetManager.require(skeletonFile));
|
||||
|
||||
// Create a SkeletonMesh from the data and attach it to the scene
|
||||
skeletonMesh = new spine.threejs.SkeletonMesh(skeletonData, function(parameters) {
|
||||
|
||||
@ -60,7 +60,7 @@ function load () {
|
||||
|
||||
function loadSpineboy (initialAnimation, premultipliedAlpha) {
|
||||
// Load the texture atlas from the AssetManager.
|
||||
var atlas = assetManager.get("assets/spineboy-pma.atlas");
|
||||
var atlas = assetManager.require("assets/spineboy-pma.atlas");
|
||||
|
||||
// Create a AtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
@ -70,7 +70,7 @@ function loadSpineboy (initialAnimation, premultipliedAlpha) {
|
||||
|
||||
// Set the scale to apply during parsing, parse the file, and create a new skeleton.
|
||||
skeletonBinary.scale = 1;
|
||||
var skeletonData = skeletonBinary.readSkeletonData(assetManager.get("assets/spineboy-pro.skel"));
|
||||
var skeletonData = skeletonBinary.readSkeletonData(assetManager.require("assets/spineboy-pro.skel"));
|
||||
var skeleton = new spine.Skeleton(skeletonData);
|
||||
var bounds = calculateSetupPoseBounds(skeleton);
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ function init () {
|
||||
batcher = new spine.webgl.PolygonBatcher(gl);
|
||||
mvp.ortho2d(0, 0, canvas.width - 1, canvas.height - 1);
|
||||
skeletonRenderer = new spine.webgl.SkeletonRenderer(gl);
|
||||
assetManager = new spine.webgl.AssetManager(gl);
|
||||
assetManager = new spine.webgl.AssetManager(gl, "assets/");
|
||||
|
||||
// Create a debug renderer and the ShapeRenderer it needs to render lines.
|
||||
debugRenderer = new spine.webgl.SkeletonDebugRenderer(gl);
|
||||
@ -72,30 +72,30 @@ function init () {
|
||||
|
||||
// Tell AssetManager to load the resources for each skeleton, including the exported data file, the .atlas file and the .png
|
||||
// file for the atlas. We then wait until all resources are loaded in the load() method.
|
||||
assetManager.loadBinary("assets/spineboy-pro.skel");
|
||||
assetManager.loadText("assets/spineboy-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/spineboy-pma.atlas");
|
||||
assetManager.loadBinary("assets/raptor-pro.skel");
|
||||
assetManager.loadText("assets/raptor-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/raptor-pma.atlas");
|
||||
assetManager.loadBinary("assets/tank-pro.skel");
|
||||
assetManager.loadText("assets/tank-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/tank-pma.atlas");
|
||||
assetManager.loadBinary("assets/goblins-pro.skel");
|
||||
assetManager.loadText("assets/goblins-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/goblins-pma.atlas");
|
||||
assetManager.loadBinary("assets/vine-pro.skel");
|
||||
assetManager.loadText("assets/vine-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/vine-pma.atlas");
|
||||
assetManager.loadBinary("assets/stretchyman-pro.skel");
|
||||
assetManager.loadText("assets/stretchyman-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/stretchyman-pma.atlas");
|
||||
assetManager.loadBinary("assets/coin-pro.skel");
|
||||
assetManager.loadText("assets/coin-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/coin-pma.atlas");
|
||||
assetManager.loadBinary("assets/mix-and-match-pro.skel");
|
||||
assetManager.loadText("assets/mix-and-match-pro.json");
|
||||
assetManager.loadTextureAtlas("assets/mix-and-match-pma.atlas");
|
||||
assetManager.loadBinary("spineboy-pro.skel");
|
||||
assetManager.loadText("spineboy-pro.json");
|
||||
assetManager.loadTextureAtlas("spineboy-pma.atlas");
|
||||
assetManager.loadBinary("raptor-pro.skel");
|
||||
assetManager.loadText("raptor-pro.json");
|
||||
assetManager.loadTextureAtlas("raptor-pma.atlas");
|
||||
assetManager.loadBinary("tank-pro.skel");
|
||||
assetManager.loadText("tank-pro.json");
|
||||
assetManager.loadTextureAtlas("tank-pma.atlas");
|
||||
assetManager.loadBinary("goblins-pro.skel");
|
||||
assetManager.loadText("goblins-pro.json");
|
||||
assetManager.loadTextureAtlas("goblins-pma.atlas");
|
||||
assetManager.loadBinary("vine-pro.skel");
|
||||
assetManager.loadText("vine-pro.json");
|
||||
assetManager.loadTextureAtlas("vine-pma.atlas");
|
||||
assetManager.loadBinary("stretchyman-pro.skel");
|
||||
assetManager.loadText("stretchyman-pro.json");
|
||||
assetManager.loadTextureAtlas("stretchyman-pma.atlas");
|
||||
assetManager.loadBinary("coin-pro.skel");
|
||||
assetManager.loadText("coin-pro.json");
|
||||
assetManager.loadTextureAtlas("coin-pma.atlas");
|
||||
assetManager.loadBinary("mix-and-match-pro.skel");
|
||||
assetManager.loadText("mix-and-match-pro.json");
|
||||
assetManager.loadTextureAtlas("mix-and-match-pma.atlas");
|
||||
requestAnimationFrame(load);
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ function loadSkeleton (name, initialAnimation, premultipliedAlpha, skin) {
|
||||
if (skin === undefined) skin = "default";
|
||||
|
||||
// Load the texture atlas using name.atlas from the AssetManager.
|
||||
var atlas = assetManager.get("assets/" + name.replace(/(?:-ess|-pro)\.(skel|json)/, "") + (premultipliedAlpha ? "-pma": "") + ".atlas");
|
||||
var atlas = assetManager.require(name.replace(/(?:-ess|-pro)\.(skel|json)/, "") + (premultipliedAlpha ? "-pma": "") + ".atlas");
|
||||
|
||||
// Create an AtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
||||
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
||||
@ -157,7 +157,7 @@ function loadSkeleton (name, initialAnimation, premultipliedAlpha, skin) {
|
||||
|
||||
// Set the scale to apply during parsing, parse the file, and create a new skeleton.
|
||||
skeletonLoader.scale = 1;
|
||||
var skeletonData = skeletonLoader.readSkeletonData(assetManager.get("assets/" + name));
|
||||
var skeletonData = skeletonLoader.readSkeletonData(assetManager.require(name));
|
||||
var skeleton = new spine.Skeleton(skeletonData);
|
||||
skeleton.setSkinByName(skin);
|
||||
var bounds = calculateSetupPoseBounds(skeleton);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user