/
AltMenuScreen2.js
161 lines (146 loc) · 5.7 KB
/
AltMenuScreen2.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
//=============================================================================
// AltMenuScreen2.js
//=============================================================================
/*:ja
* @plugindesc 更改選單畫面排版。
* @author Yoji Ojima、神無月サスケ(翻譯 : ReIris)
*
* @param backGroundBitmap
* @text 背景圖片
* @desc 選單背景的圖片。
* 圖片放置於 img/pictures 內。
* @default
*
* @param maxColsMenu
* @text 最大列數
* @desc 主畫面中顯示角色窗口的最大列數。
* @default 4
*
* @param commandRows
* @text 選單命令行數
* @desc 命令窗口中的行數。
* @default 2
*
* @param isDisplayStatus
* @text 是否顯示狀態欄
* @desc 選擇是否顯示狀態。
* (1 = 顯示、0 = 不顯示)
* @default 0
*
* @help 這個插件沒有插件命令。
*
* 與 AltMenuscreen 的不同之處在於:
* - 選單畫面上的所有窗口都是透明的。
* - 可以給每個選單添加背景圖片。
* - 角色使用立繪。
*
* 在角色的注釋欄寫入以下內容:
* <stand_picture:圖片名稱>圖片名將是角色的立繪。
* 圖片放在 img/pictures 資料夾內。
*
* 希望的角色立繪大小:
* 寬:3 列 : 240 px / 4 列:174 px
* 高:命令窗口 1 行 : 444 px / 2 行 : 408 px
*
*/
(function() {
// set parameters
var parameters = PluginManager.parameters('AltMenuScreen2');
var backGroundBitmap = parameters['backGroundBitmap'] || '';
var maxColsMenuWnd = Number(parameters['maxColsMenu'] || 4);
var rowsCommandWnd = Number(parameters['commandRows'] || 2);
var isDisplayStatus = !!Number(parameters['isDisplayStatus']);
var _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
this._statusWindow.x = 0;
this._statusWindow.y = this._commandWindow.height;
this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
// make transparent for all windows at menu scene.
this._statusWindow.opacity = 0;
this._goldWindow.opacity = 0;
this._commandWindow.opacity = 0;
};
// load bitmap that set in plugin parameter
var _Scene_Menu_createBackground = Scene_Menu.prototype.createBackground;
Scene_Menu.prototype.createBackground = function(){
if(backGroundBitmap){
this._backgroundSprite = new Sprite();
this._backgroundSprite.bitmap =
ImageManager.loadPicture(backGroundBitmap);
this.addChild(this._backgroundSprite);
return;
}
// if background file is invalid, it does original process.
_Scene_Menu_createBackground.call(this);
};
Window_MenuCommand.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
Window_MenuCommand.prototype.maxCols = function() {
return 4;
};
Window_MenuCommand.prototype.numVisibleRows = function() {
return rowsCommandWnd;
};
Window_MenuStatus.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
Window_MenuStatus.prototype.windowHeight = function() {
var h1 = this.fittingHeight(1);
var h2 = this.fittingHeight(rowsCommandWnd);
return Graphics.boxHeight - h1 - h2;
};
Window_MenuStatus.prototype.maxCols = function() {
return maxColsMenuWnd;
};
Window_MenuStatus.prototype.numVisibleRows = function() {
return 1;
};
Window_MenuStatus.prototype.drawItemImage = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRectForText(index);
// load stand_picture
var bitmapName = $dataActors[actor.actorId()].meta.stand_picture;
var bitmap = bitmapName ? ImageManager.loadPicture(bitmapName) : null;
var w = Math.min(rect.width, (bitmapName ? bitmap.width : 144));
var h = Math.min(rect.height, (bitmapName ? bitmap.height : 144));
var lineHeight = this.lineHeight();
this.changePaintOpacity(actor.isBattleMember());
if(bitmap){
var sx = (bitmap.width > w) ? (bitmap.width - w) / 2 : 0;
var sy = (bitmap.height > h) ? (bitmap.height - h) / 2 : 0;
var dx = (bitmap.width > rect.width) ? rect.x :
rect.x + (rect.width - bitmap.width) / 2;
var dy = (bitmap.height > rect.height) ? rect.y :
rect.y + (rect.height - bitmap.height) / 2;
this.contents.blt(bitmap, sx, sy, w, h, dx, dy);
} else { // when bitmap is not set, do the original process.
this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
}
this.changePaintOpacity(true);
};
Window_MenuStatus.prototype.drawItemStatus = function(index) {
if(!isDisplayStatus){
return;
}
var actor = $gameParty.members()[index];
var rect = this.itemRectForText(index);
var x = rect.x;
var y = rect.y;
var width = rect.width;
var bottom = y + rect.height;
var lineHeight = this.lineHeight();
this.drawActorName(actor, x, y + lineHeight * 0, width);
this.drawActorLevel(actor, x, y + lineHeight * 1, width);
this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
};
var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
Window_MenuActor.prototype.initialize = function() {
_Window_MenuActor_initialize.call(this);
this.y = this.fittingHeight(2);
};
})();