|
| 1 | +/*: |
| 2 | + * @plugindesc Basic plugin for manipulating important parameters. |
| 3 | + * @author RM CoreScript team |
| 4 | + * |
| 5 | + * @help |
| 6 | + * Basic plugin for manipulating important parameters. |
| 7 | + * There is no plugin command. |
| 8 | + * |
| 9 | + * Caching images improves performance but increases memory allocation. |
| 10 | + * On mobile devices, a lot of memory allocation causes the browser to crash. |
| 11 | + * Therefore, the upper limit of memory allocation is set with cacheLimit. |
| 12 | + * |
| 13 | + * If you want to regain high performance, just increase cacheLimit. |
| 14 | + * There is no need to revert to 1.4. |
| 15 | + * |
| 16 | + * @param cacheLimit |
| 17 | + * @type number |
| 18 | + * @desc The upper limit of images' cached size (MPixel) |
| 19 | + * @default 10 |
| 20 | + * |
| 21 | + * @param screenWidth |
| 22 | + * @type number |
| 23 | + * @desc The resolution of screen width |
| 24 | + * @default 816 |
| 25 | + * |
| 26 | + * @param screenHeight |
| 27 | + * @type number |
| 28 | + * @desc The resolution of screen height |
| 29 | + * @default 624 |
| 30 | + * |
| 31 | + * @param changeWindowWidthTo |
| 32 | + * @type number |
| 33 | + * @desc If set, change window width to this value |
| 34 | + * |
| 35 | + * @param changeWindowHeightTo |
| 36 | + * @type number |
| 37 | + * @desc If set, change window height to this value |
| 38 | + * |
| 39 | + * @param renderingMode |
| 40 | + * @type select |
| 41 | + * @option canvas |
| 42 | + * @option webgl |
| 43 | + * @option auto |
| 44 | + * @desc The rendering mode (canvas/webgl/auto) |
| 45 | + * @default auto |
| 46 | + * |
| 47 | + * @param alwaysDash |
| 48 | + * @type boolean |
| 49 | + * @desc The initial value whether the player always dashes (on/off) |
| 50 | + * @on ON |
| 51 | + * @off OFF |
| 52 | + * @default false |
| 53 | + * |
| 54 | + * @param textSpeed |
| 55 | + * @type number |
| 56 | + * @desc The text speed on "Show Text". The larger this parameter is, the slower text speed. (0: show all texts at once) |
| 57 | + * @default 1 |
| 58 | + * |
| 59 | + * @param autoSaveFileId |
| 60 | + * @type number |
| 61 | + * @desc The file number to auto save when "Transfer Player" (0: off) |
| 62 | + * @default 0 |
| 63 | + * |
| 64 | + * @param errorMessage |
| 65 | + * @type string |
| 66 | + * @desc The message when error occurred |
| 67 | + * @default Error occurred. Please ask to the creator of this game. |
| 68 | + * |
| 69 | + * @param showErrorDetail |
| 70 | + * @type boolean |
| 71 | + * @desc Show where the error is caused and stack trace when error |
| 72 | + * @default true |
| 73 | + * |
| 74 | + * @param enableProgressBar |
| 75 | + * @type boolean |
| 76 | + * @desc Show progress bar when it takes a long time to load resources |
| 77 | + * @default true |
| 78 | + * |
| 79 | + * @param maxRenderingFps |
| 80 | + * @type number |
| 81 | + * @desc The maximum value of rendering frame per seconds (0: unlimited) |
| 82 | + * @default 0 |
| 83 | + */ |
| 84 | + |
| 85 | +/*:ja |
| 86 | + * @plugindesc 基本的なパラメーターを設定するプラグインです。 |
| 87 | + * @author RM CoreScript team |
| 88 | + * |
| 89 | + * @help |
| 90 | + * 基本的なパラメーターを設定するプラグインです。 |
| 91 | + * このプラグインにはプラグインコマンドはありません。 |
| 92 | + * |
| 93 | + * 画像をキャッシュするとパフォーマンスは向上しますが、その分メモリ確保も増大します。 |
| 94 | + * モバイルデバイスでは、たくさんのメモリ確保はブラウザをクラッシュさせます。 |
| 95 | + * そこで、メモリ確保の上限を「画像キャッシュ上限値」で設定しています。 |
| 96 | + * |
| 97 | + * もし高いパフォーマンスを取り戻したければ、ただ画像キャッシュ上限値を増加させればよいです。 |
| 98 | + * 1.4に戻す必要はありません。 |
| 99 | + * |
| 100 | + * @param cacheLimit |
| 101 | + * @type number |
| 102 | + * @text 画像キャッシュ上限値 |
| 103 | + * @desc 画像のメモリへのキャッシュの上限値 (MPix) |
| 104 | + * @default 10 |
| 105 | + * |
| 106 | + * @param screenWidth |
| 107 | + * @type number |
| 108 | + * @text ゲーム画面の幅 |
| 109 | + * @default 816 |
| 110 | + * |
| 111 | + * @param screenHeight |
| 112 | + * @type number |
| 113 | + * @text ゲーム画面の高さ |
| 114 | + * @default 624 |
| 115 | + * |
| 116 | + * @param changeWindowWidthTo |
| 117 | + * @type number |
| 118 | + * @text ウィンドウの幅 |
| 119 | + * @desc 値が設定されなかった場合、ゲーム画面の幅と同じ |
| 120 | + * |
| 121 | + * @param changeWindowHeightTo |
| 122 | + * @type number |
| 123 | + * @text ウィンドウの高さ |
| 124 | + * @desc 値が設定されなかった場合、ゲーム画面の高さと同じ |
| 125 | + * |
| 126 | + * @param renderingMode |
| 127 | + * @type select |
| 128 | + * @option canvas |
| 129 | + * @option webgl |
| 130 | + * @option auto |
| 131 | + * @text レンダリングモード |
| 132 | + * @default auto |
| 133 | + * |
| 134 | + * @param alwaysDash |
| 135 | + * @type boolean |
| 136 | + * @text 「常時ダッシュ」の初期値 |
| 137 | + * @on ON |
| 138 | + * @off OFF |
| 139 | + * @default false |
| 140 | + * |
| 141 | + * @param textSpeed |
| 142 | + * @type number |
| 143 | + * @text 「文章の表示」のスピード |
| 144 | + * @desc 数字が大きいほど文章の表示スピードが遅くなります (0を指定した場合は一度に全文を表示します) |
| 145 | + * @default 1 |
| 146 | + * |
| 147 | + * @param autoSaveFileId |
| 148 | + * @type number |
| 149 | + * @text オートセーブ番号 |
| 150 | + * @desc 「場所移動」の際に指定したファイル番号にオートセーブします(0を指定した場合はオートセーブしません) |
| 151 | + * @default 0 |
| 152 | + * |
| 153 | + * @param errorMessage |
| 154 | + * @type string |
| 155 | + * @text エラーメッセージ |
| 156 | + * @desc エラー時にプレイヤーに向けて表示するメッセージです |
| 157 | + * @default エラーが発生しました。ゲームの作者にご連絡ください。 |
| 158 | + * |
| 159 | + * @param showErrorDetail |
| 160 | + * @type boolean |
| 161 | + * @text エラー詳細表示 |
| 162 | + * @desc ONにすると、エラー時にエラーを発生させたイベントの情報とスタックトレースを表示します |
| 163 | + * @default true |
| 164 | + * |
| 165 | + * @param enableProgressBar |
| 166 | + * @type boolean |
| 167 | + * @text ロード進捗バー有効化 |
| 168 | + * @desc ONにすると、読み込みに時間がかかっている時にロード進捗バーを表示します |
| 169 | + * @default true |
| 170 | + * |
| 171 | + * @param maxRenderingFps |
| 172 | + * @type number |
| 173 | + * @text 描画FPS上限値 |
| 174 | + * @desc 描画FPSの上限値を設定します (0を指定した場合は制限なし) |
| 175 | + * @default 0 |
| 176 | + */ |
| 177 | + |
| 178 | +(function() { |
| 179 | + 'use strict'; |
| 180 | + function isNumber(str) { |
| 181 | + return !!str && !isNaN(str); |
| 182 | + } |
| 183 | + |
| 184 | + function toNumber(str, def) { |
| 185 | + return isNumber(str) ? +str : def; |
| 186 | + } |
| 187 | + |
| 188 | + var parameters = PluginManager.parameters('Community_Basic'); |
| 189 | + var cacheLimit = toNumber(parameters['cacheLimit'], 10); |
| 190 | + var screenWidth = toNumber(parameters['screenWidth'], 816); |
| 191 | + var screenHeight = toNumber(parameters['screenHeight'], 624); |
| 192 | + var renderingMode = parameters['renderingMode'].toLowerCase(); |
| 193 | + var alwaysDash = (parameters['alwaysDash'] === 'true') ||(parameters['alwaysDash'] === 'on'); |
| 194 | + var textSpeed = toNumber(parameters['textSpeed'], 1); |
| 195 | + var windowWidthTo = toNumber(parameters['changeWindowWidthTo'], 0); |
| 196 | + var windowHeightTo = toNumber(parameters['changeWindowHeightTo'], 0); |
| 197 | + var maxRenderingFps = toNumber(parameters['maxRenderingFps'], 0); |
| 198 | + var autoSaveFileId = toNumber(parameters['autoSaveFileId'], 0); |
| 199 | + var errorMessage = parameters['errorMessage']; |
| 200 | + var showErrorDetail = parameters['showErrorDetail'] === 'true'; |
| 201 | + var enableProgressBar = parameters['enableProgressBar'] === 'true'; |
| 202 | + |
| 203 | + var windowWidth; |
| 204 | + var windowHeight; |
| 205 | + |
| 206 | + if(windowWidthTo){ |
| 207 | + windowWidth = windowWidthTo; |
| 208 | + }else if(screenWidth !== SceneManager._screenWidth){ |
| 209 | + windowWidth = screenWidth; |
| 210 | + } |
| 211 | + |
| 212 | + if(windowHeightTo){ |
| 213 | + windowHeight = windowHeightTo; |
| 214 | + }else if(screenHeight !== SceneManager._screenHeight){ |
| 215 | + windowHeight = screenHeight; |
| 216 | + } |
| 217 | + |
| 218 | + |
| 219 | + ImageCache.limit = cacheLimit * 1000 * 1000; |
| 220 | + SceneManager._screenWidth = screenWidth; |
| 221 | + SceneManager._screenHeight = screenHeight; |
| 222 | + SceneManager._boxWidth = screenWidth; |
| 223 | + SceneManager._boxHeight = screenHeight; |
| 224 | + |
| 225 | + SceneManager.preferableRendererType = function() { |
| 226 | + if (Utils.isOptionValid('canvas')) { |
| 227 | + return 'canvas'; |
| 228 | + } else if (Utils.isOptionValid('webgl')) { |
| 229 | + return 'webgl'; |
| 230 | + } else if (renderingMode === 'canvas') { |
| 231 | + return 'canvas'; |
| 232 | + } else if (renderingMode === 'webgl') { |
| 233 | + return 'webgl'; |
| 234 | + } else { |
| 235 | + return 'auto'; |
| 236 | + } |
| 237 | + }; |
| 238 | + |
| 239 | + var _ConfigManager_applyData = ConfigManager.applyData; |
| 240 | + ConfigManager.applyData = function(config) { |
| 241 | + _ConfigManager_applyData.apply(this, arguments); |
| 242 | + if (config['alwaysDash'] === undefined) { |
| 243 | + this.alwaysDash = alwaysDash; |
| 244 | + } |
| 245 | + }; |
| 246 | + |
| 247 | + var _Window_Message_clearFlags = Window_Message.prototype.clearFlags; |
| 248 | + Window_Message.prototype.clearFlags = function(textState) { |
| 249 | + _Window_Message_clearFlags.apply(this, arguments); |
| 250 | + this._textSpeed = textSpeed - 1; |
| 251 | + }; |
| 252 | + |
| 253 | + var _SceneManager_initNwjs = SceneManager.initNwjs; |
| 254 | + SceneManager.initNwjs = function() { |
| 255 | + _SceneManager_initNwjs.apply(this, arguments); |
| 256 | + |
| 257 | + if (Utils.isNwjs() && windowWidth && windowHeight) { |
| 258 | + var dw = windowWidth - window.innerWidth; |
| 259 | + var dh = windowHeight - window.innerHeight; |
| 260 | + window.moveBy(-dw / 2, -dh / 2); |
| 261 | + window.resizeBy(dw, dh); |
| 262 | + } |
| 263 | + }; |
| 264 | + |
| 265 | + if (maxRenderingFps) { |
| 266 | + var currentTime = Date.now(); |
| 267 | + var deltaTime = 1000 / maxRenderingFps; |
| 268 | + var accumulator = 0; |
| 269 | + var _SceneManager_renderScene = SceneManager.renderScene; |
| 270 | + SceneManager.renderScene = function() { |
| 271 | + var newTime = Date.now(); |
| 272 | + accumulator += newTime - currentTime; |
| 273 | + currentTime = newTime; |
| 274 | + if (accumulator >= deltaTime) { |
| 275 | + accumulator -= deltaTime; |
| 276 | + _SceneManager_renderScene.apply(this, arguments); |
| 277 | + } |
| 278 | + }; |
| 279 | + } |
| 280 | + |
| 281 | + DataManager.setAutoSaveFileId(autoSaveFileId); |
| 282 | + Graphics.setErrorMessage(errorMessage); |
| 283 | + Graphics.setShowErrorDetail(showErrorDetail); |
| 284 | + Graphics.setProgressEnabled(enableProgressBar); |
| 285 | +})(); |
0 commit comments