/
MOG_MenuParticles.js
326 lines (309 loc) · 11.5 KB
/
MOG_MenuParticles.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
//===========================================================================
// MOG_MenuParticles.js
// Translate to Japanese : fungamemake.com
//===========================================================================
/*:
* @plugindesc (v1.1) Adiciona partículas nas cenas menu.
* @author Moghunter
*
* @param Number of Particles
* @desc Definição do numero de partículas.
* @default 15
*
* @param Disable Scenes
* @desc Definição das cenas que terão o efeito desativado.
* Scene_Name1 , Scene_Name2 , Scene_Name3 ...
* @default Scene_Test1,Scene_Test2,Scene_Test3
*
* @param Unique Particles
* @desc Cada cena terá uma imagem de partícula diferente.
* @default false
*
* @param X-Axis Speed
* @desc Definição da velocidade de deslize na horizontal.
* @default 0
*
* @param Y-Axis Speed
* @desc Definição da velocidade de deslize na vertical.
* @default -1
*
* @param Rotation Speed
* @desc Definição da velocidade da rotação.
* @default 1
*
* @param Blend Mode
* @desc Definição do modo Blend.
* @default 1
*
* @help
* ===========================================================================
* +++ MOG - Menu Particles (v1.1) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* ===========================================================================
* Adiciona partículas nas cenas menu
* É possivel ativar uma partícula diferente para cada cena ou desativar a
* partícula em cenas especificas.
* ===========================================================================
* As imagens das patículas deverão ficar na paste /img/menus/
* ===========================================================================
* No caso da opção Unique Particles estiver ativada cada partícula deverá
* seguir essa nomeação.
*
* SCENE_NAME + _par.png
*
* Exemplo.
*
* Scene_Menu_par.png
* Scene_Item_par.png
* Scene_Skill_par.png
* etc...
* ===========================================================================
* HISTÓRICO
* ===========================================================================
* (v1.1) - Correção da função UNIQUE PARTICLES.
*
*/
/*:ja
* @plugindesc (v1.1) メニューにパーティクルを追加します。
* @author Moghunter
*
* @param Number of Particles
* @text パーティクル量
* @default 15
*
* @param Unique Particles
* @text シーン別パーティクルの有効化
* @type boolean
* @on 有効
* @off 無効
* @default false
*
* @param Disable Scenes
* @text 無効にするシーン
* @desc 例:Scene_Menu, Scene_Item, Scene_Skill, Scene_Equip, Scene_Status, Scene_Options, Scene_Save, Scene_GameEnd
* @default Scene_Menu,Scene_Item,Scene_Skill,Scene_Equip,Scene_Status,Scene_Options,Scene_Save,Scene_GameEnd
*
* @param X-Axis Speed
* @text X方向移動速度
* @desc 正:右 / 負:左
* @default 0
*
* @param Y-Axis Speed
* @text Y方向移動速度
* @desc 正:下 / 負:上
* @default -1
*
* @param Rotation Speed
* @text 回転速度
* @desc 正:時計回り / 負:反時計回り。絶対値が大きいほど高速。
* @default 1
*
* @param Blend Mode
* @text 合成方法
* @desc 0:通常 / 1:加算 / 2:乗算
* @type select
* @option 通常
* @value 0
* @option 加算
* @value 1
* @option 乗算
* @value 2
* @default 1
*
* @help
* 翻訳:ムノクラ
* https://fungamemake.com/
* https://twitter.com/munokura/
*
* ===========================================================================
* +++ MOG - Menu Particles (v1.1) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* ===========================================================================
* メニューにパーティクルを追加します。
* シーン別に異なるパーティクルを有効/無効にできます。
* ===========================================================================
* 必要な画像ファイルを下記に保存して下さい。
* /img/menus/
*
* デフォルトのパーティクル画像ファイルが必要です。
* Particles.png
*
* ===========================================================================
* シーン別パーティクルが有効の場合、
* 各パーティクル画像ファイル名は下記の法則に従って下さい。
*
* Scene_Name + _par.png
*
* 例
*
* Scene_Menu_par.png
* Scene_Item_par.png
* Scene_Skill_par.png
* Scene_Equip_par.png
* Scene_Status_par.png
* Scene_Options_par.png
* Scene_Save_par.png
* Scene_GameEnd_par.png
*
* ===========================================================================
* 更新履歴
* ===========================================================================
* (v1.1) - シーン別パーティクル機能修正
*
*/
//===========================================================================
// ** PLUGIN PARAMETERS
//===========================================================================
var Imported = Imported || {};
Imported.MOG_MenuParticles = true;
var Moghunter = Moghunter || {};
Moghunter.parameters = PluginManager.parameters('MOG_MenuParticles');
Moghunter.mpart_selfpart = String(Moghunter.parameters['Unique Particles'] || "false");
Moghunter.mpart_skipscenes = Object(Moghunter.parameters['Disable Scenes'] || []);
Moghunter.mpart_ox = Number(Moghunter.parameters['X-Axis Speed'] || 0);
Moghunter.mpart_oy = Number(Moghunter.parameters['Y-Axis Speed'] || -1);
Moghunter.mpart_a = Number(Moghunter.parameters['Rotation Speed'] || 1);
Moghunter.mpart_number = Number(Moghunter.parameters['Number of Particles'] || 15);
Moghunter.mpart_blendMode = Number(Moghunter.parameters['Blend Mode'] || 1);
SceneManager._mpart = false;
//===========================================================================
// ** ImageManager
//===========================================================================
//==============================
// * Menus
//==============================
ImageManager.loadMenus = function (filename) {
return this.loadBitmap('img/menus/', filename, 0, true);
};
//===========================================================================
// ** Game System
//===========================================================================
//==============================
// * Get Par Array
//==============================
Game_System.prototype.get_par_array = function (object, value, type) {
if (value.length === 0) { return };
var s = value.split(',');
if (type === 0) {
for (var i = 0; i < s.length; i++) { object.push(String(s[i])); };
} else {
for (var i = 0; i < s.length; i++) { object.push(Number(s[i])); };
};
};
//===========================================================================
// ** Scene MenuBase
//===========================================================================
//==============================
// * Skip Particles
//==============================
Scene_MenuBase.prototype.skip_particles = function () {
if (!SceneManager._scene) { return false };
this._mb_skip_scenes = [];
$gameSystem.get_par_array(this._mb_skip_scenes, Moghunter.mpart_skipscenes, 0);
for (var i = 0; i < this._mb_skip_scenes.length; i++) {
if (this._mb_skip_scenes[i] === SceneManager._scene.constructor.name) { return true };
};
return false;
};
//==============================
// * Create
//==============================
var _alias_mog_mpart_scbase_createBackground = Scene_MenuBase.prototype.createBackground;
Scene_MenuBase.prototype.createBackground = function () {
SceneManager._mpart = false;
_alias_mog_mpart_scbase_createBackground.call(this);
if (!this.skip_particles()) { this.create_mparticles() };
};
//==============================
// * Terminate
//==============================
var _alias_mog_mpart_scmb_terminate = Scene_MenuBase.prototype.terminate;
Scene_MenuBase.prototype.terminate = function () {
_alias_mog_mpart_scmb_terminate.call(this);
SceneManager._mpart = false;
};
//==============================
// * Set Particle Img
//==============================
Scene_MenuBase.prototype.set_particle_img = function () {
if (this._self_par && SceneManager._scene) { return SceneManager._scene.constructor.name + "_par" }
return "Particles";
};
//==============================
// * Create Mbackground
//==============================
Scene_MenuBase.prototype.create_mparticles = function () {
this._self_par = false;
SceneManager._mpart = true;
if (String(Moghunter.mpart_selfpart) === "true") { this._self_par = true };
this._sprite_particles = [];
this._sprite_particles_data = [];
this._nw = [0, 0];
if (Moghunter.mpart_ox > 0) { this._nw[0] = -(Graphics.boxWidth / 3) };
if (Moghunter.mpart_ox < 0) { this._nw[0] = (Graphics.boxWidth / 3) };
this._nw[1] = Math.abs(this._nw[0]);
for (i = 0; i < Moghunter.mpart_number; i++) {
this._sprite_particles.push(new Sprite(ImageManager.loadMenus(this.set_particle_img())));
this.addChild(this._sprite_particles[i]);
this._sprite_particles_data[i] = []
this.reset_particles(i);
this._sprite_particles[i].x = Math.randomInt(Graphics.boxWidth);
this._sprite_particles[i].y = Math.randomInt(Graphics.boxHeight);
this._sprite_particles[i].opacity = 0;
this._sprite_particles[i].blendMode = Moghunter.mpart_blendMode;
};
};
//==============================
// * Reset Particles
//==============================
Scene_MenuBase.prototype.reset_particles = function (i) {
this._sprite_particles_data[i][0] = ((Math.random() * 2) + 0.4) * Moghunter.mpart_ox
this._sprite_particles_data[i][1] = ((Math.random() * 2) + 0.4) * Moghunter.mpart_oy
this._sprite_particles_data[i][2] = ((Math.random() * Moghunter.mpart_a)) * 0.01;
this._sprite_particles[i].opacity = 0;
this._sprite_particles[i].x = this._nw[0] + Math.randomInt(Graphics.boxWidth);
var pz = ((Math.random() * 0.5) * 1);
this._sprite_particles[i].scale = new PIXI.Point(0.5 + Number(pz), 0.5 + Number(pz));
if (Moghunter.mpart_oy < 0) {
this._sprite_particles[i].y = Graphics.boxHeight + this._sprite_particles[i].height * 3;
} else if (Moghunter.mpart_oy > 0) {
this._sprite_particles[i].y = -this._sprite_particles[i].height * 3;
} else {
this._sprite_particles[i].y = Math.randomInt(Graphics.boxHeight);
};
if (this._sprite_particles_data[i][0] == 0 && this._sprite_particles_data[i][1] == 0) {
this._sprite_particles[i].x = -Graphics.width
};
};
//==============================
// * Update
//==============================
var _mog_mpart_scbase_update = Scene_MenuBase.prototype.update;
Scene_MenuBase.prototype.update = function () {
_mog_mpart_scbase_update.call(this);
if (SceneManager._mpart) { this.update_particles() };
};
//==============================
// * Update Particles
//==============================
Scene_MenuBase.prototype.update_particles = function () {
for (var i = 0; i < this._sprite_particles.length; i++) {
this._sprite_particles[i].x += this._sprite_particles_data[i][0];
this._sprite_particles[i].y += this._sprite_particles_data[i][1];
this._sprite_particles[i].opacity += 4;
this._sprite_particles[i].rotation += this._sprite_particles_data[i][2];
if (this.need_reset_particles(i)) { this.reset_particles(i); };
};
};
//==============================
// * Need Reset Particles
//==============================
Scene_MenuBase.prototype.need_reset_particles = function (i) {
if (this._sprite_particles[i].x < -this._nw[1] - this._sprite_particles[i].width * 3) { return true };
if (this._sprite_particles[i].x > this._nw[1] + Graphics.boxWidth + this._sprite_particles[i].width * 3) { return true };
if (this._sprite_particles[i].y < - this._sprite_particles[i].height * 3) { return true };
if (this._sprite_particles[i].y > Graphics.boxHeight + this._sprite_particles[i].height * 3) { return true };
return false;
};