/
MOG_FakeLoadScreen.js
613 lines (574 loc) · 18.6 KB
/
MOG_FakeLoadScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
//===========================================================================
// MOG_FakeLoadScreen.js
// Translate to Japanese : fungamemake.com
//===========================================================================
/*:
* @plugindesc (v1.0) Apresenta imagens aleatórias durante a cena de arquivos.
* @author Moghunter
*
* @param File Name
* @desc Definição do nome das imagens apresentadas.
* @default Picture_
*
* @param Number of Pictures
* @desc Definição do número de imagens aleatórias apresentadas.
* @default 4
*
* @param Duration
* @desc Definição da duração da cena.
* @default 120
*
* @param Sound File
* @desc Definição do nome do arquivo de som.
* @default Magic4
*
* @param Sound Pitch
* @desc Definição do Pitch do som.
* @default 50
*
* @param Gauge X-axis
* @desc Definição X-axis do medidor.
* @default 313
*
* @param Gauge Y-axis
* @desc Definição Y-axis do medidor.
* @default 551
*
* @param Word Animation
* @desc Ativar animação da palavra de leitura.
* @default true
*
* @param Word X-axis
* @desc Definição X-axis da palavra de leitura.
* @default 330
*
* @param Word Y-axis
* @desc Definição Y-axis da palavra de leitura.
* @default 520
*
* @help
* ===========================================================================
* +++ MOG - Fake Loading Screen (v1.0) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* ===========================================================================
* Ativa uma cena de leitura onde é apresentado imagens aleatórias.
* Essas imagens podem servir para apresentar tutoriais ou artworks do jogos.
*
* ===========================================================================
* UTILIZAÇÃO
* ===========================================================================
* As imagens do sistema deverão ser gravados na pasta.
*
* /img/fakeloadscreen/
*
* ===========================================================================
* As imagens serão selecionadas aleatóriamente, sendo necessário definir
* no parâmetro do plugin o número de imagens.
*
* As imagens deverão ser nomeadas da seguinte forma.
*
* Picture_ + INDEX.png
*
* Ex
*
* Picture_1.png
* Picture_2.png
* Picture_3.png
* Picture_4.png
* ...
*
* ===========================================================================
* PLUGIN COMMAND
* ===========================================================================
* Para ativar a cena através do evento use o plugin command abaixo.
*
* fakeloadbar : MODE : DURATION : PICTURE_NAME
*
* MODE - 0 (Saving) 1 (Loading)
* DURATION - Duração da cena.
* PICTURE_NAME - Nome da Imagem, se definir o nome como "Random" será
* selecionado uma imagem aleatória
*
* ===========================================================================
* Para desativar temporariamente a cena de load use o código abaixo.
*
* fakeloadbar_disable_temp
*
* ===========================================================================
* Para ativar a cena de load use o código abaixo.
*
* fakeloadbar_enable
*
*/
/*:ja
* @plugindesc (v1.0) セーブ/ロードシーンをカスタマイズ。疑似ロードシーンを作り、画像を表示したり、表示画像をランダムにもできます。
* @author Moghunter
*
* @param File Name
* @text 画像ファイル名の接頭辞
* @default Picture_
*
* @param Number of Pictures
* @text 画像のランダム数
* @type number
* @min 1
* @max 9007
* @default 4
*
* @param Duration
* @text シーンの長さ
* @type number
* @min 1
* @max 9007
* @default 120
*
* @param Sound File
* @text SEファイル名
* @type file
* @dir audio/se/
* @default Magic4
*
* @param Sound Pitch
* @text 音のピッチ
* @type number
* @max 9007
* @default 50
*
* @param Gauge X-axis
* @text メーターのX軸位置
* @desc 正:右 / 負:左
* @type number
* @min -9007
* @max 9007
* @default 313
*
* @param Gauge Y-axis
* @text メーターのY軸位置
* @desc 正:下 / 負:上
* @type number
* @min -9007
* @max 9007
* @default 551
*
* @param Word Animation
* @text Word画像のアニメ有効化
* @type boolean
* @on 有効
* @off 無効
* @default true
*
* @param Word X-axis
* @text Word画像のX軸位置
* @desc 正:右 / 負:左
* @type number
* @min -9007
* @max 9007
* @default 330
*
* @param Word Y-axis
* @text Word画像のY軸位置
* @desc 正:下 / 負:上
* @type number
* @min -9007
* @max 9007
* @default 520
*
* @help
* 翻訳:ムノクラ
* https://fungamemake.com/
* https://twitter.com/munokura/
*
* ===========================================================================
* +++ MOG - Fake Loading Screen (v1.0) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* ===========================================================================
* セーブ/ロードシーンをカスタマイズ。
* 疑似ロードシーンを作り、画像を表示します。
* 表示画像をランダムにもできます。
* これらの画像はチュートリアル、アートワークとしても使用できます。
*
* ===========================================================================
* 必要画像ファイル
* ===========================================================================
* システム画像ファイルはフォルダに保存する必要があります。
* /img/fakeloadscreen/
* Layout.png
* Meter.png
* Word.png
*
* ===========================================================================
* 画像をランダムに表示するには、
* プラグインパラメーターで画像の数を指定する必要があります。
* 画像には次のような名前を付ける必要があります。
*
* Picture_ + INDEX.png
*
* 例
* Picture_1.png
* Picture_2.png
* Picture_3.png
* Picture_4.png
* ...
*
* ===========================================================================
* プラグインコマンド
* ===========================================================================
* 下記のプラグインコマンドでロードシーンを指定します。
*
* fakeloadbar : MODE : DURATION : PICTURE_NAME
*
* MODE - 0 (Saving) 1 (Loading)
* DURATION - シーンの長さ
* PICTURE_NAME - 画像ファイル名。
* Random に設定すると、ランダムな画像が表示されます。
*
* 例
* fakeloadbar : 1 : 120 : Random
*
* ===========================================================================
* 下記のプラグインコマンドでロードシーンを無効にします。
*
* fakeloadbar_disable_temp
*
* ===========================================================================
* 下記のプラグインコマンドでロードシーンを有効にします。
*
* fakeloadbar_enable
*
*/
//===========================================================================
// ** PLUGIN PARAMETERS
//===========================================================================
var Imported = Imported || {};
Imported.MOG_FakeLoadScreen = true;
var Moghunter = Moghunter || {};
Moghunter.parameters = PluginManager.parameters('MOG_FakeLoadScreen');
Moghunter.fakeLoad_FileName = String(Moghunter.parameters['File Name'] || "Picture_");
Moghunter.fakeLoad_NumberOfPictures = Number(Moghunter.parameters['Number of Pictures'] || 3);
Moghunter.fakeLoad_Duration = Number(Moghunter.parameters['Duration'] || 120);
Moghunter.fakeLoad_MeterX = Number(Moghunter.parameters['Gauge X-axis'] || 313);
Moghunter.fakeLoad_MeterY = Number(Moghunter.parameters['Gauge Y-axis'] || 551);
Moghunter.fakeLoad_WordFloat = String(Moghunter.parameters['Word Animation'] || "true");
Moghunter.fakeLoad_WordX = Number(Moghunter.parameters['Word X-axis'] || 330);
Moghunter.fakeLoad_WordY = Number(Moghunter.parameters['Word Y-axis'] || 520);
Moghunter.fakeLoad_SoundFile = String(Moghunter.parameters['Sound File'] || "Magic4");
Moghunter.fakeLoad_SoundPitch = Number(Moghunter.parameters['Sound Pitch'] || 50);
//===========================================================================
// ** ImageManager
//===========================================================================
//==============================
// * Menus
//==============================
ImageManager.loadfakeload = function (filename) {
return this.loadBitmap('img/fakeloadscreen/', filename, 0, true);
};
//===========================================================================
// ** Sound Manager
//===========================================================================
//==============================
// * play Save
//==============================
SoundManager.playSave = function () {
};
//==============================
// * play Save 2
//==============================
SoundManager.playSave2 = function () {
this.playSystemSound(5);
};
//==============================
// * Mog Play Sound
//==============================
SoundManager.mogPlaySound = function (fileName, pitch, volume) {
var se = {};
se.name = fileName;
se.pitch = pitch;
se.volume = volume;
AudioManager.playSe(se);
};
//===========================================================================
// ** Game_Interpreter
//===========================================================================
//==============================
// * PluginCommand
//==============================
var _mog_fakeload_pluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function (command, args) {
_mog_fakeload_pluginCommand.call(this, command, args)
if (command === "fakeloadbar") {
if ($gameTemp._fakeloadEnabled) {
var type = Math.min(Math.max(args[1], 0), 1);
var duration = Math.min(Math.max(args[3], 30), 9999);
$gameTemp._fakeload[1] = type;
$gameTemp._fakeload[2] = duration;
$gameTemp._fakeload[3] = null;
if (args[5]) { $gameTemp._fakeload[3] = String(args[5]) };
SceneManager.push(SceneFakeLoadScreen)
this.wait(10);
};
} else if (command === "fakeloadbar_disable_temp") {
$gameTemp._fakeloadEnabled = false;
} else if (command === "fakeloadbar_enable") {
$gameTemp._fakeloadEnabled = true;
};
return true;
};
//===========================================================================
// ** Game_Temp
//===========================================================================
//==============================
// * Initialize
//==============================
var _mog_fakeload_gtemp_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function () {
_mog_fakeload_gtemp_initialize.call(this);
this._fakeload = [false, 0, Moghunter.fakeLoad_Duration, null];
this._fakeloadEnabled = true;
};
//===========================================================================
// ** Scene Save
//===========================================================================
//==============================
// * initialize
//==============================
var _mog_fakeload_ss_initialize = Scene_Save.prototype.initialize;
Scene_Save.prototype.initialize = function () {
_mog_fakeload_ss_initialize.call(this);
this._fileSaved = false;
};
//==============================
// * on Save File OK
//==============================
Scene_Save.prototype.onSavefileOk = function () {
Scene_File.prototype.onSavefileOk.call(this);
$gameSystem.onBeforeSave();
if (DataManager.saveGame(this.savefileId())) {
this._fileSaved = true;
this.onSaveSuccess();
} else {
this._fileSaved = false;
this.onSaveFailure();
}
};
//==============================
// * popScene
//==============================
Scene_Save.prototype.popScene = function () {
if (this._fileSaved) {
if ($gameTemp._fakeloadEnabled) {
$gameTemp._fakeload[1] = 0;
$gameTemp._fakeload[3] = null;
SceneManager.goto(SceneFakeLoadScreen);
SoundManager.playSave();
} else {
SoundManager.playSave();
this.popScene();
};
} else {
SceneManager.pop();
};
};
//===========================================================================
// ** Scene Load
//===========================================================================
//==============================
// * on Load Sucess
//==============================
Scene_Load.prototype.onLoadSuccess = function () {
if ($gameTemp._fakeloadEnabled) {
this.reloadMapIfUpdated();
$gameTemp._fakeload[1] = 2;
$gameTemp._fakeload[3] = null;
SceneManager.goto(SceneFakeLoadScreen);
} else {
SoundManager.playLoad();
this.fadeOutAll();
this.reloadMapIfUpdated();
SceneManager.goto(Scene_Map);
this._loadSuccess = true;
};
};
//===========================================================================
// ** Scene Fake Load Screen
//===========================================================================
function SceneFakeLoadScreen() {
this.initialize.apply(this, arguments);
};
SceneFakeLoadScreen.prototype = Object.create(Scene_MenuBase.prototype);
SceneFakeLoadScreen.prototype.constructor = SceneFakeLoadScreen;
//==============================
// * Initialize
//==============================
SceneFakeLoadScreen.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
this._type = $gameTemp._fakeload[1];
this._duration = [0, $gameTemp._fakeload[2], false];
};
//==============================
// * Create
//==============================
SceneFakeLoadScreen.prototype.create = function () {
Scene_Base.prototype.create.call(this);
this._field = new Sprite();
this.addChild(this._field);
this.loadPictures();
this.creteRandomBackground();
this.createLayout();
this.createMeter();
this.createWord();
SoundManager.mogPlaySound(Moghunter.fakeLoad_SoundFile, Moghunter.fakeLoad_SoundPitch, 100);
};
//==============================
// * Load Pictures
//==============================
SceneFakeLoadScreen.prototype.loadPictures = function () {
this._pictures = [];
if (this.needSetPicture()) {
var fileName = String($gameTemp._fakeload[3]);
this._pictures.push(ImageManager.loadfakeload(fileName.toLowerCase()));
} else {
for (var i = 0; i < Moghunter.fakeLoad_NumberOfPictures; i++) {
var fileName = String(Moghunter.fakeLoad_FileName + (i + 1))
this._pictures.push(ImageManager.loadfakeload(fileName));
};
};
};
//==============================
// * needSetPicture
//==============================
SceneFakeLoadScreen.prototype.needSetPicture = function () {
if (!$gameTemp._fakeload[3]) { return false };
if ($gameTemp._fakeload[3] === "") { return false };
if ($gameTemp._fakeload[3].toLowerCase() == "random") { return false };
return true;
};
//==============================
// * set Bitmap
//==============================
SceneFakeLoadScreen.prototype.setBitmap = function () {
if (this.needSetPicture()) { return this._pictures[0] };
var r = Math.randomInt(Moghunter.fakeLoad_NumberOfPictures);
return this._pictures[r];
};
//==============================
// * create Word
//==============================
SceneFakeLoadScreen.prototype.createWord = function () {
this._word = new Sprite(ImageManager.loadfakeload("Word"));
this._word.visible = false;
this._word.x = Moghunter.fakeLoad_WordX;
this._word.y = Moghunter.fakeLoad_WordY;
this._wordData = [0, 0, false, 0, false];
this._wordData[4] = String(Moghunter.fakeLoad_WordFloat) === "true" ? true : false;
this._field.addChild(this._word);
};
//==============================
// * update Word
//==============================
SceneFakeLoadScreen.prototype.updateWord = function () {
if (!this._wordData[2]) { this.refreshWord() };
if (this._wordData[4]) { this.updateWordFloatEffect() };
this._word.x = Moghunter.fakeLoad_WordX;
this._word.y = Moghunter.fakeLoad_WordY + this._wordData[1];
};
//==============================
// * refresh Word
//==============================
SceneFakeLoadScreen.prototype.refreshWord = function () {
this._wordData[2] = true;
this._word.visible = true;
var ty = this._type > 0 ? 0 : 1;
var cw = this._word.bitmap.width;
var ch = this._word.bitmap.height / 2;
this._word.setFrame(0, ty * ch, cw, ch);
};
//==============================
// * update Word Float Effect
//==============================
SceneFakeLoadScreen.prototype.updateWordFloatEffect = function () {
this._wordData[3]++;
if (this._wordData[3] < 2) { return };
this._wordData[3] = 0;
this._wordData[0]++;
if (this._wordData[0] < 10) {
this._wordData[1]++;
} else if (this._wordData[0] < 20) {
this._wordData[1]--;
} else {
this._wordData[0] = 0;
this._wordData[1] = 0;
};
};
//==============================
// * Create Random Background
//==============================
SceneFakeLoadScreen.prototype.creteRandomBackground = function () {
this._background = new Sprite(this.setBitmap());
this._field.addChild(this._background);
};
//==============================
// * Create Layout
//==============================
SceneFakeLoadScreen.prototype.createLayout = function () {
this._layout = new Sprite(ImageManager.loadfakeload("Layout"));
this._field.addChild(this._layout);
};
//==============================
// * Create Meter
//==============================
SceneFakeLoadScreen.prototype.createMeter = function () {
this._meter = new Sprite(ImageManager.loadfakeload("Meter"));
this._meter.x = Moghunter.fakeLoad_MeterX;
this._meter.y = Moghunter.fakeLoad_MeterY;
this._meter.visible = false;
this._field.addChild(this._meter);
};
//==============================
// * Create Meter
//==============================
SceneFakeLoadScreen.prototype.updateMeter = function () {
this._duration[0]++;
var cw = this._meter.bitmap.width;
var ch = this._meter.bitmap.height;
var rate = this._duration[0] * cw / this._duration[1];
this._meter.setFrame(0, 0, rate, ch);
this._meter.visible = true;
if (this._duration[0] >= this._duration[1]) { this._duration[2] = true };
};
//==============================
// * End Load Scene
//==============================
SceneFakeLoadScreen.prototype.endLoadScene = function () {
AudioManager.stopSe();
if (this._type === 0) {
SoundManager.playSave2();
SceneManager.pop();
} else if (this._type === 1) {
SoundManager.playLoad();
SceneManager.pop();
} else if (this._type === 2) {
SoundManager.playLoad();
SceneManager.goto(Scene_Map);
$gameSystem.onAfterLoad();
} else {
SceneManager.pop();
};
};
//==============================
// * Update Fade End
//==============================
SceneFakeLoadScreen.prototype.updateFadeEnd = function () {
this._field.opacity -= 10;
if (this._field.opacity <= 0) { this.endLoadScene() };
};
//==============================
// * Update
//==============================
SceneFakeLoadScreen.prototype.update = function () {
Scene_MenuBase.prototype.update.call(this);
if (this._meter.bitmap.isReady()) { this.updateMeter() };
if (this._word.bitmap.isReady()) { this.updateWord() };
if (this._duration[2]) { this.updateFadeEnd() };
};