/
Phileas_NameInputWindowRectSettings.js
147 lines (138 loc) · 4.58 KB
/
Phileas_NameInputWindowRectSettings.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
//=============================================================================
// Phileas_NameInputWindowRectSettings.js
//=============================================================================
// [Update History]
// 2023.August.9 Ver1.0.0 First Release
/*:
* @target MZ
* @plugindesc Allows you to set custom name input window sizes and coordinates.
* @author Phileas
*
* @param nameWindowWidth
* @text Name window width (top window)
* @type number
* @default 0
*
* @param nameWindowHeight
* @text Name window height (top window)
* @type number
* @default 0
*
* @param inputWindowWidth
* @text Input window width (bottom window)
* @type number
* @default 0
*
* @param inputWindowHeight
* @text Input window height (bottom window)
* @type number
* @default 0
*
* @param windowX
* @text X coordinate
* @desc X coordinate of the upper-left corner of the window.
* @type number
* @default 0
*
* @param windowY
* @text Y coordinate
* @desc Y coordinate of the upper-left corner of the window.
* @type number
* @default 0
*
*
* @help
* [Summary]
* If the value of the parameter is less than 1, then the default value is set.
*
* [License]
* This plugin is released under MIT license.
* http://opensource.org/licenses/mit-license.php
*
* This means that you can freely use the plugin in non-commercial and commercial games and even edit it.
* But be sure to include me in the credits!
*/
/*:ru
* @target MZ
* @plugindesc Позволяет задать пользовательские размеры и координаты окна ввода имени.
* @author Phileas
*
* @param nameWindowWidth
* @text Ширина окна имени (верхнее окно)
* @type number
* @default 0
*
* @param nameWindowHeight
* @text Высота окна имени (верхнее окно)
* @type number
* @default 0
*
* @param inputWindowWidth
* @text Ширина окна ввода (нижнее окно)
* @type number
* @default 0
*
* @param inputWindowHeight
* @text Высота окна ввода (нижнее окно)
* @type number
* @default 0
*
* @param windowX
* @text X coordinate
* @desc X-координата верхнего левого угла окна
* @type number
* @default 0
*
* @param windowY
* @text Y coordinate
* @desc Y-координата верхнего левого угла окна
* @type number
* @default 0
*
*
* @help
* [Summary]
* Если значение параметра меньше 1, устанавливается стандартное значение.
*
* [License]
* Этот плагин распространяется по лицензии MIT.
* http://opensource.org/licenses/mit-license.php
*
* Это означает, что вы можете свободно использовать плагин в некоммерческих и коммерческих играх и даже редактировать его.
* Но обязательно укажите меня в титрах!
*/
(function() {
//--------DATA:
var parameters = PluginManager.parameters("Phileas_NameInputWindowRectSettings");
var nameWindowWidth = Number(parameters["nameWindowWidth"] || 0);
var nameWindowHeight = Number(parameters["nameWindowHeight"] || 0);
var inputWindowWidth = Number(parameters["inputWindowWidth"] || 0);
var inputWindowHeight = Number(parameters["inputWindowHeight"] || 0);
var windowX = Number(parameters["windowX"] || 0);
var windowY = Number(parameters["windowY"] || 0);
//--------CHANGED CORE:
function calculateSize(defaultValue, plaginValue) {
if (plaginValue < 1) {
return defaultValue;
}
return plaginValue;
}
Origin_editWindowRect = Scene_Name.prototype.editWindowRect;
Scene_Name.prototype.editWindowRect = function() {
var rect = Origin_editWindowRect.call(this);
rect.width = calculateSize(rect.width, nameWindowWidth);
rect.height = calculateSize(rect.height, nameWindowHeight);
rect.x = calculateSize(rect.x, windowX);
rect.y = calculateSize(rect.y, windowY);
return rect;
};
Origin_inputWindowRect = Scene_Name.prototype.inputWindowRect;
Scene_Name.prototype.inputWindowRect = function() {
var rect = Origin_inputWindowRect.call(this);
rect.width = calculateSize(rect.width, inputWindowWidth);
rect.height = calculateSize(rect.height, inputWindowHeight);
rect.x = calculateSize(rect.x, windowX);
rect.y = windowY < 1 ? rect.y : windowY + this._editWindow.height + 8;
return rect;
};
}());