chore: error handling
This commit is contained in:
parent
5f701f1525
commit
a906073b91
|
@ -80,6 +80,8 @@ export class Resource extends decorate(class {}) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error(`Failed loading '${uri}'.`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,14 @@ export class AnimationView extends Renderable {
|
||||||
this.animation = animation;
|
this.animation = animation;
|
||||||
this.container = new Container();
|
this.container = new Container();
|
||||||
if (hasGraphics) {
|
if (hasGraphics) {
|
||||||
|
if (this.animation.imageUri) {
|
||||||
Image.load(this.animation.imageUri).then((image) => {
|
Image.load(this.animation.imageUri).then((image) => {
|
||||||
this.sprite = new Sprite(image);
|
this.sprite = new Sprite(image);
|
||||||
this.container.addChild(this.sprite);
|
this.container.addChild(this.sprite);
|
||||||
this.resetSourceRectangle();
|
this.resetSourceRectangle();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
animation.on(
|
animation.on(
|
||||||
['directionChanged', 'indexChanged'],
|
['directionChanged', 'indexChanged'],
|
||||||
this.onAnimationChanged,
|
this.onAnimationChanged,
|
||||||
|
|
|
@ -128,6 +128,8 @@ export default class Animated extends decorate(Trait) {
|
||||||
});
|
});
|
||||||
// Bounding box update.
|
// Bounding box update.
|
||||||
this.entity.updateVisibleBoundingBox();
|
this.entity.updateVisibleBoundingBox();
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error(`Failed loading some or all animations.`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +158,8 @@ export default class Animated extends decorate(Trait) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.setSpriteScale();
|
this.setSpriteScale();
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error(`Failed loading some or all animation images.`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user