From 4ec82f14ce1c09bd290db5f80ef7fabc0ad9f15a Mon Sep 17 00:00:00 2001 From: Nio Kasgami Date: Thu, 13 Apr 2017 22:54:42 -0400 Subject: [PATCH 1/6] Added docs Added documentations to the Scene_Base class. --- js/rpg_scenes/Scene_Base.js | 165 +++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 3 deletions(-) diff --git a/js/rpg_scenes/Scene_Base.js b/js/rpg_scenes/Scene_Base.js index 354fb63f..788b7187 100644 --- a/js/rpg_scenes/Scene_Base.js +++ b/js/rpg_scenes/Scene_Base.js @@ -1,8 +1,14 @@ +/============================================================================= +// ■ Scene_Base V.1.4.0 (community-1.1b) //----------------------------------------------------------------------------- -// Scene_Base -// -// The superclass of all scenes within the game. +/** + * The Superclass of all scene within the game. + * + * @class Scene_Base + * @constructor + * @extends Stage + */ function Scene_Base() { this.initialize.apply(this, arguments); } @@ -10,6 +16,13 @@ function Scene_Base() { Scene_Base.prototype = Object.create(Stage.prototype); Scene_Base.prototype.constructor = Scene_Base; + +/** + * Create a instance of Scene_Base. + * + * @constructor + * @memberof Scene_Base + */ Scene_Base.prototype.initialize = function() { Stage.prototype.initialize.call(this); this._active = false; @@ -19,45 +32,115 @@ Scene_Base.prototype.initialize = function() { this._imageReservationId = Utils.generateRuntimeId(); }; +/** + * Attach a reservation to the reserve queue. + * + * @method attachReservation + * @memberof Scene_Base + */ Scene_Base.prototype.attachReservation = function() { ImageManager.setDefaultReservationId(this._imageReservationId); }; +/** + * Remove the reservation from the Reserve queue. + * + * @method detachReservation + * @memberof Scene_Base + */ Scene_Base.prototype.detachReservation = function() { ImageManager.releaseReservation(this._imageReservationId); }; +/** + * Create the components and add them to the rendering process. + * + * @method create + * @memberof Scene_Base + */ Scene_Base.prototype.create = function() { }; +/** + * Returns wether the scene is active or not. + * + * @method isActive + * @memberof Scene_Base + * @return {Boolean} return true if the scene is active + */ Scene_Base.prototype.isActive = function() { return this._active; }; +/** + * Return wether the scene is ready to start or not. + * + * @method isReady + * @memberof Scene_Base + * @return {Boolean} Return true if the scene is ready to start + */ Scene_Base.prototype.isReady = function() { return ImageManager.isReady(); }; +/** + * Start the scene processing. + * + * @method start + * @memberof Scene_Base + */ Scene_Base.prototype.start = function() { this._active = true; }; +/** + * Update the scene processing each new frame. + * + * @method update + * @memberof Scene_Base + */ Scene_Base.prototype.update = function() { this.updateFade(); this.updateChildren(); + AudioManager.checkErrors(); }; +/** + * Stop the scene processing. + * + * @method stop + * @memberof Scene_Base + */ Scene_Base.prototype.stop = function() { this._active = false; }; +/** + * Return wether the scene is busy or not. + * + * @method isBusy + * @return {boolean} true if the scene is currently busy doing a fade + */ Scene_Base.prototype.isBusy = function() { return this._fadeDuration > 0; }; +/** + * Terminate the scene before switching to a another scene. + * + * @method terminate + * @memberof Scene_Base + */ Scene_Base.prototype.terminate = function() { }; +/** + * Create the layer for the windows children + * and add it to the rendering process. + * + * @method createWindowLayer + * @memberof Scene_Base + */ Scene_Base.prototype.createWindowLayer = function() { var width = Graphics.boxWidth; var height = Graphics.boxHeight; @@ -68,10 +151,25 @@ Scene_Base.prototype.createWindowLayer = function() { this.addChild(this._windowLayer); }; +/** + * Add the children window to the windowLayer processing. + * + * @method addWindow + * @memberof Scene_Base + */ Scene_Base.prototype.addWindow = function(window) { this._windowLayer.addChild(window); }; +/** + * Request a fadeIn screen process. + * + * @method startFadeIn + * @param {Number} [duration=30] The time the process will take for fadeIn the screen + * @param {Boolean} [white=false] If true the fadein will be process with a white color else it's will be black + * + * @memberof Scene_Base + */ Scene_Base.prototype.startFadeIn = function(duration, white) { this.createFadeSprite(white); this._fadeSign = 1; @@ -79,6 +177,15 @@ Scene_Base.prototype.startFadeIn = function(duration, white) { this._fadeSprite.opacity = 255; }; +/** + * Request a fadeOut screen process. + * + * @method startFadeOut + * @param {Number} [duration=30] The time the process will take for fadeOut the screen + * @param {boolean} [white=false] If true the fadeOut will be process with a white color else it's will be black + * + * @memberof Scene_Base + */ Scene_Base.prototype.startFadeOut = function(duration, white) { this.createFadeSprite(white); this._fadeSign = -1; @@ -86,6 +193,13 @@ Scene_Base.prototype.startFadeOut = function(duration, white) { this._fadeSprite.opacity = 0; }; +/** + * Create a Screen sprite for the fadein and fadeOut purpose and + * add it to the rendering process. + * + * @method createFadeSprite + * @memberof Scene_Base + */ Scene_Base.prototype.createFadeSprite = function(white) { if (!this._fadeSprite) { this._fadeSprite = new ScreenSprite(); @@ -98,6 +212,12 @@ Scene_Base.prototype.createFadeSprite = function(white) { } }; +/** + * Update the screen fade processing. + * + * @method updateFade + * @memberof Scene_Base + */ Scene_Base.prototype.updateFade = function() { if (this._fadeDuration > 0) { var d = this._fadeDuration; @@ -110,6 +230,12 @@ Scene_Base.prototype.updateFade = function() { } }; +/** + * Update the children of the scene EACH frame. + * + * @method updateChildren + * @memberof Scene_Base + */ Scene_Base.prototype.updateChildren = function() { this.children.forEach(function(child) { if (child.update) { @@ -118,16 +244,35 @@ Scene_Base.prototype.updateChildren = function() { }); }; +/** + * Pop the scene from the stack array and switch to the + * previous scene. + * + * @method popScene + * @memberof Scene_Base + */ Scene_Base.prototype.popScene = function() { SceneManager.pop(); }; +/** + * Check wether the game should be triggering a gameover. + * + * @method checkGameover + * @memberof Scene_Base + */ Scene_Base.prototype.checkGameover = function() { if ($gameParty.isAllDead()) { SceneManager.goto(Scene_Gameover); } }; +/** + * Slowly fade out all the visual and audio of the scene. + * + * @method fadeOutAll + * @memberof Scene_Base + */ Scene_Base.prototype.fadeOutAll = function() { var time = this.slowFadeSpeed() / 60; AudioManager.fadeOutBgm(time); @@ -136,10 +281,24 @@ Scene_Base.prototype.fadeOutAll = function() { this.startFadeOut(this.slowFadeSpeed()); }; +/** + * Return the screen fade speed value. + * + * @method fadeSpeed + * @memberof Scene_Base + * @return {Number} Return the fade speed + */ Scene_Base.prototype.fadeSpeed = function() { return 24; }; +/** + * Return a slow screen fade speed value. + * + * @method slowFadeSpeed + * @memberof Scene_Base + * @return {Number} Return the fade speed. + */ Scene_Base.prototype.slowFadeSpeed = function() { return this.fadeSpeed() * 2; }; From 66511529f3bb8fd69ce315ee5bcde1343ca2460b Mon Sep 17 00:00:00 2001 From: Nio Kasgami Date: Thu, 13 Apr 2017 23:08:46 -0400 Subject: [PATCH 2/6] Update Scene_Base.js --- js/rpg_scenes/Scene_Base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/rpg_scenes/Scene_Base.js b/js/rpg_scenes/Scene_Base.js index 788b7187..efbbbca7 100644 --- a/js/rpg_scenes/Scene_Base.js +++ b/js/rpg_scenes/Scene_Base.js @@ -1,4 +1,4 @@ -/============================================================================= +//============================================================================= // ■ Scene_Base V.1.4.0 (community-1.1b) //----------------------------------------------------------------------------- From e4edf6333decee592214a3b36061595f01c86ab5 Mon Sep 17 00:00:00 2001 From: Nio Kasgami Date: Fri, 14 Apr 2017 12:08:01 -0400 Subject: [PATCH 3/6] Updated Jsdoc errors Updated the jsdoc for the initialize for remove the constructor tags since it's provoking a bug to the jsdoc generations or intelisenses. The Also added "@instance" to method for tell the system it's not a static class. --- js/rpg_scenes/Scene_Base.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/js/rpg_scenes/Scene_Base.js b/js/rpg_scenes/Scene_Base.js index efbbbca7..1061725b 100644 --- a/js/rpg_scenes/Scene_Base.js +++ b/js/rpg_scenes/Scene_Base.js @@ -20,7 +20,7 @@ Scene_Base.prototype.constructor = Scene_Base; /** * Create a instance of Scene_Base. * - * @constructor + * @instance * @memberof Scene_Base */ Scene_Base.prototype.initialize = function() { @@ -36,6 +36,7 @@ Scene_Base.prototype.initialize = function() { * Attach a reservation to the reserve queue. * * @method attachReservation + * @instance * @memberof Scene_Base */ Scene_Base.prototype.attachReservation = function() { @@ -46,6 +47,7 @@ Scene_Base.prototype.attachReservation = function() { * Remove the reservation from the Reserve queue. * * @method detachReservation + * @instance * @memberof Scene_Base */ Scene_Base.prototype.detachReservation = function() { @@ -56,6 +58,7 @@ Scene_Base.prototype.detachReservation = function() { * Create the components and add them to the rendering process. * * @method create + * @instance * @memberof Scene_Base */ Scene_Base.prototype.create = function() { @@ -65,6 +68,7 @@ Scene_Base.prototype.create = function() { * Returns wether the scene is active or not. * * @method isActive + * @instance * @memberof Scene_Base * @return {Boolean} return true if the scene is active */ @@ -76,6 +80,7 @@ Scene_Base.prototype.isActive = function() { * Return wether the scene is ready to start or not. * * @method isReady + * @instance * @memberof Scene_Base * @return {Boolean} Return true if the scene is ready to start */ @@ -87,6 +92,7 @@ Scene_Base.prototype.isReady = function() { * Start the scene processing. * * @method start + * @instance * @memberof Scene_Base */ Scene_Base.prototype.start = function() { @@ -97,6 +103,7 @@ Scene_Base.prototype.start = function() { * Update the scene processing each new frame. * * @method update + * @instance * @memberof Scene_Base */ Scene_Base.prototype.update = function() { @@ -109,6 +116,7 @@ Scene_Base.prototype.update = function() { * Stop the scene processing. * * @method stop + * @instance * @memberof Scene_Base */ Scene_Base.prototype.stop = function() { @@ -119,6 +127,7 @@ Scene_Base.prototype.stop = function() { * Return wether the scene is busy or not. * * @method isBusy + * @instance * @return {boolean} true if the scene is currently busy doing a fade */ Scene_Base.prototype.isBusy = function() { @@ -129,6 +138,7 @@ Scene_Base.prototype.isBusy = function() { * Terminate the scene before switching to a another scene. * * @method terminate + * @instance * @memberof Scene_Base */ Scene_Base.prototype.terminate = function() { @@ -139,6 +149,7 @@ Scene_Base.prototype.terminate = function() { * and add it to the rendering process. * * @method createWindowLayer + * @instance * @memberof Scene_Base */ Scene_Base.prototype.createWindowLayer = function() { @@ -155,6 +166,7 @@ Scene_Base.prototype.createWindowLayer = function() { * Add the children window to the windowLayer processing. * * @method addWindow + * @instance * @memberof Scene_Base */ Scene_Base.prototype.addWindow = function(window) { @@ -168,6 +180,7 @@ Scene_Base.prototype.addWindow = function(window) { * @param {Number} [duration=30] The time the process will take for fadeIn the screen * @param {Boolean} [white=false] If true the fadein will be process with a white color else it's will be black * + * @instance * @memberof Scene_Base */ Scene_Base.prototype.startFadeIn = function(duration, white) { @@ -182,8 +195,9 @@ Scene_Base.prototype.startFadeIn = function(duration, white) { * * @method startFadeOut * @param {Number} [duration=30] The time the process will take for fadeOut the screen - * @param {boolean} [white=false] If true the fadeOut will be process with a white color else it's will be black + * @param {Boolean} [white=false] If true the fadeOut will be process with a white color else it's will be black * + * @instance * @memberof Scene_Base */ Scene_Base.prototype.startFadeOut = function(duration, white) { @@ -198,6 +212,7 @@ Scene_Base.prototype.startFadeOut = function(duration, white) { * add it to the rendering process. * * @method createFadeSprite + * @instance * @memberof Scene_Base */ Scene_Base.prototype.createFadeSprite = function(white) { @@ -216,6 +231,7 @@ Scene_Base.prototype.createFadeSprite = function(white) { * Update the screen fade processing. * * @method updateFade + * @instance * @memberof Scene_Base */ Scene_Base.prototype.updateFade = function() { @@ -234,6 +250,7 @@ Scene_Base.prototype.updateFade = function() { * Update the children of the scene EACH frame. * * @method updateChildren + * @instance * @memberof Scene_Base */ Scene_Base.prototype.updateChildren = function() { @@ -249,6 +266,7 @@ Scene_Base.prototype.updateChildren = function() { * previous scene. * * @method popScene + * @instance * @memberof Scene_Base */ Scene_Base.prototype.popScene = function() { @@ -259,6 +277,7 @@ Scene_Base.prototype.popScene = function() { * Check wether the game should be triggering a gameover. * * @method checkGameover + * @instance * @memberof Scene_Base */ Scene_Base.prototype.checkGameover = function() { @@ -271,6 +290,7 @@ Scene_Base.prototype.checkGameover = function() { * Slowly fade out all the visual and audio of the scene. * * @method fadeOutAll + * @instance * @memberof Scene_Base */ Scene_Base.prototype.fadeOutAll = function() { @@ -285,6 +305,7 @@ Scene_Base.prototype.fadeOutAll = function() { * Return the screen fade speed value. * * @method fadeSpeed + * @instance * @memberof Scene_Base * @return {Number} Return the fade speed */ @@ -296,9 +317,11 @@ Scene_Base.prototype.fadeSpeed = function() { * Return a slow screen fade speed value. * * @method slowFadeSpeed + * @instance * @memberof Scene_Base * @return {Number} Return the fade speed. */ Scene_Base.prototype.slowFadeSpeed = function() { return this.fadeSpeed() * 2; }; + From c6d8df6701614c46c6373b21956fbb30938ebe90 Mon Sep 17 00:00:00 2001 From: Nio Kasgami Date: Fri, 14 Apr 2017 12:16:05 -0400 Subject: [PATCH 4/6] fixed isBusy --- js/rpg_scenes/Scene_Base.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/rpg_scenes/Scene_Base.js b/js/rpg_scenes/Scene_Base.js index 1061725b..ba9daf59 100644 --- a/js/rpg_scenes/Scene_Base.js +++ b/js/rpg_scenes/Scene_Base.js @@ -129,6 +129,7 @@ Scene_Base.prototype.stop = function() { * @method isBusy * @instance * @return {boolean} true if the scene is currently busy doing a fade + * @memberof Scene_Base */ Scene_Base.prototype.isBusy = function() { return this._fadeDuration > 0; From 79a33bca3b6f587c30f5b158eb7e83c6533676e0 Mon Sep 17 00:00:00 2001 From: Nio Kasgami Date: Tue, 16 May 2017 11:25:31 -0400 Subject: [PATCH 5/6] Corrected Misspelling and header Removed the Header and corrected the misspelling error --- js/rpg_scenes/Scene_Base.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/js/rpg_scenes/Scene_Base.js b/js/rpg_scenes/Scene_Base.js index ba9daf59..a81c92f7 100644 --- a/js/rpg_scenes/Scene_Base.js +++ b/js/rpg_scenes/Scene_Base.js @@ -1,6 +1,4 @@ //============================================================================= -// ■ Scene_Base V.1.4.0 (community-1.1b) -//----------------------------------------------------------------------------- /** * The Superclass of all scene within the game. @@ -65,7 +63,7 @@ Scene_Base.prototype.create = function() { }; /** - * Returns wether the scene is active or not. + * Returns whether the scene is active or not. * * @method isActive * @instance @@ -77,7 +75,7 @@ Scene_Base.prototype.isActive = function() { }; /** - * Return wether the scene is ready to start or not. + * Return whether the scene is ready to start or not. * * @method isReady * @instance @@ -123,13 +121,14 @@ Scene_Base.prototype.stop = function() { this._active = false; }; + /** - * Return wether the scene is busy or not. + * Return whether the scene is busy or not. * * @method isBusy - * @instance - * @return {boolean} true if the scene is currently busy doing a fade + * @instance * @memberof Scene_Base + * @return {Boolean} Return true if the scene is currently busy */ Scene_Base.prototype.isBusy = function() { return this._fadeDuration > 0; @@ -275,7 +274,7 @@ Scene_Base.prototype.popScene = function() { }; /** - * Check wether the game should be triggering a gameover. + * Check whether the game should be triggering a gameover. * * @method checkGameover * @instance @@ -320,9 +319,8 @@ Scene_Base.prototype.fadeSpeed = function() { * @method slowFadeSpeed * @instance * @memberof Scene_Base - * @return {Number} Return the fade speed. + * @return {Number} Return the fade speed */ Scene_Base.prototype.slowFadeSpeed = function() { return this.fadeSpeed() * 2; }; - From 9865abcd806fe0857fb0cbdfee8a4d743df678d6 Mon Sep 17 00:00:00 2001 From: Nio Kasgami Date: Tue, 16 May 2017 11:34:46 -0400 Subject: [PATCH 6/6] Removed a outdated command line Removed AudioManager.checkErrors(); --- js/rpg_scenes/Scene_Base.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/rpg_scenes/Scene_Base.js b/js/rpg_scenes/Scene_Base.js index a81c92f7..4ab0e6a6 100644 --- a/js/rpg_scenes/Scene_Base.js +++ b/js/rpg_scenes/Scene_Base.js @@ -107,7 +107,6 @@ Scene_Base.prototype.start = function() { Scene_Base.prototype.update = function() { this.updateFade(); this.updateChildren(); - AudioManager.checkErrors(); }; /**