-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWindow_EquipStatus.js
89 lines (75 loc) · 2.63 KB
/
Window_EquipStatus.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
//-----------------------------------------------------------------------------
// Window_EquipStatus
//
// The window for displaying parameter changes on the equipment screen.
function Window_EquipStatus() {
this.initialize.apply(this, arguments);
}
Window_EquipStatus.prototype = Object.create(Window_Base.prototype);
Window_EquipStatus.prototype.constructor = Window_EquipStatus;
Window_EquipStatus.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._actor = null;
this._tempActor = null;
this.refresh();
};
Window_EquipStatus.prototype.windowWidth = function() {
return 312;
};
Window_EquipStatus.prototype.windowHeight = function() {
return this.fittingHeight(this.numVisibleRows());
};
Window_EquipStatus.prototype.numVisibleRows = function() {
return 7;
};
Window_EquipStatus.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
Window_EquipStatus.prototype.refresh = function() {
this.contents.clear();
if (this._actor) {
this.drawActorName(this._actor, this.textPadding(), 0);
for (var i = 0; i < 6; i++) {
this.drawItem(0, this.lineHeight() * (1 + i), 2 + i);
}
}
};
Window_EquipStatus.prototype.setTempActor = function(tempActor) {
if (this._tempActor !== tempActor) {
this._tempActor = tempActor;
this.refresh();
}
};
Window_EquipStatus.prototype.drawItem = function(x, y, paramId) {
this.drawParamName(x + this.textPadding(), y, paramId);
if (this._actor) {
this.drawCurrentParam(x + 140, y, paramId);
}
this.drawRightArrow(x + 188, y);
if (this._tempActor) {
this.drawNewParam(x + 222, y, paramId);
}
};
Window_EquipStatus.prototype.drawParamName = function(x, y, paramId) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x, y, 120);
};
Window_EquipStatus.prototype.drawCurrentParam = function(x, y, paramId) {
this.resetTextColor();
this.drawText(this._actor.param(paramId), x, y, 48, 'right');
};
Window_EquipStatus.prototype.drawRightArrow = function(x, y) {
this.changeTextColor(this.systemColor());
this.drawText('\u2192', x, y, 32, 'center');
};
Window_EquipStatus.prototype.drawNewParam = function(x, y, paramId) {
var newValue = this._tempActor.param(paramId);
var diffvalue = newValue - this._actor.param(paramId);
this.changeTextColor(this.paramchangeTextColor(diffvalue));
this.drawText(newValue, x, y, 48, 'right');
};