diff --git a/js/rpg_core/Bitmap.js b/js/rpg_core/Bitmap.js index 81374f3d..0f5a41a4 100644 --- a/js/rpg_core/Bitmap.js +++ b/js/rpg_core/Bitmap.js @@ -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; diff --git a/js/rpg_core/Input.js b/js/rpg_core/Input.js index 9192952b..9c305c59 100644 --- a/js/rpg_core/Input.js +++ b/js/rpg_core/Input.js @@ -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; } }; diff --git a/js/rpg_core/ResourceHandler.js b/js/rpg_core/ResourceHandler.js index 6157d0a5..43e111ee 100644 --- a/js/rpg_core/ResourceHandler.js +++ b/js/rpg_core/ResourceHandler.js @@ -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; @@ -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(); }); diff --git a/js/rpg_managers/SceneManager.js b/js/rpg_managers/SceneManager.js index be1919eb..3a506805 100644 --- a/js/rpg_managers/SceneManager.js +++ b/js/rpg_managers/SceneManager.js @@ -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(); @@ -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(); + this._accumulator = 0; + } +}; diff --git a/plugins/Debug_FailLoading.js b/plugins/Debug_FailLoading.js index a52138f2..aa4a8946 100644 --- a/plugins/Debug_FailLoading.js +++ b/plugins/Debug_FailLoading.js @@ -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); }