Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion js/rpg_core/Bitmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,8 @@ Bitmap.prototype.decode = function(){
this._decodeAfterRequest = true;
if (!this._loader) {
this._loader = ResourceHandler.createLoader(this._url, this._requestImage.bind(this, this._url), this._onError.bind(this));
this._image.onerror = this._loader;
this._image.removeEventListener('error', this._errorListener);
this._image.addEventListener('error', this._errorListener = this._loader);
}
break;

Expand Down
4 changes: 3 additions & 1 deletion js/rpg_core/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ Input._onKeyDown = function(event) {
this.clear();
}
var buttonName = this.keyMapper[event.keyCode];
if (buttonName) {
if (ResourceHandler.exists() && buttonName === 'ok') {
ResourceHandler.retry();
} else if (buttonName) {
this._currentState[buttonName] = true;
}
};
Expand Down
2 changes: 2 additions & 0 deletions js/rpg_core/ResourceHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ResourceHandler.createLoader = function(url, retryMethod, resignMethod, retryInt
if (url) {
if (reloaders.length === 0) {
Graphics.printLoadingError(url);
SceneManager.stop();
}
reloaders.push(function() {
retryCount = 0;
Expand All @@ -43,6 +44,7 @@ ResourceHandler.exists = function() {
ResourceHandler.retry = function() {
if (this._reloaders.length > 0) {
Graphics.eraseLoadingError();
SceneManager.resume();
this._reloaders.forEach(function(reloader) {
reloader();
});
Expand Down
13 changes: 9 additions & 4 deletions js/rpg_managers/SceneManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,6 @@ SceneManager.changeScene = function() {
};

SceneManager.updateScene = function() {
if (ResourceHandler.exists() && Input.isTriggered('ok')) {
ResourceHandler.retry();
this.updateInputData();
}
if (this._scene) {
if (!this._sceneStarted && this._scene.isReady()) {
this._scene.start();
Expand Down Expand Up @@ -355,3 +351,12 @@ SceneManager.snapForBackground = function() {
SceneManager.backgroundBitmap = function() {
return this._backgroundBitmap;
};

SceneManager.resume = function() {
this._stopped = false;
this.requestUpdate();
if (!Utils.isMobileSafari()) {
this._currentTime = this._getTimeInMsWithoutMobileSafari();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd better clear _accumulator too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

this._accumulator = 0;
}
};
2 changes: 1 addition & 1 deletion plugins/Debug_FailLoading.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
var _Bitmap_onLoad = Bitmap.prototype._onLoad;
Bitmap.prototype._onLoad = function() {
if (Math.random() < failImage) {
this._image.onerror();
this._errorListener();
} else {
_Bitmap_onLoad.apply(this, arguments);
}
Expand Down