-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWindow_MapName.js
72 lines (60 loc) · 1.99 KB
/
Window_MapName.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
//-----------------------------------------------------------------------------
// Window_MapName
//
// The window for displaying the map name on the map screen.
function Window_MapName() {
this.initialize.apply(this, arguments);
}
Window_MapName.prototype = Object.create(Window_Base.prototype);
Window_MapName.prototype.constructor = Window_MapName;
Window_MapName.prototype.initialize = function() {
var wight = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, 0, 0, wight, height);
this.opacity = 0;
this.contentsOpacity = 0;
this._showCount = 0;
this.refresh();
};
Window_MapName.prototype.windowWidth = function() {
return 360;
};
Window_MapName.prototype.windowHeight = function() {
return this.fittingHeight(1);
};
Window_MapName.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this._showCount > 0 && $gameMap.isNameDisplayEnabled()) {
this.updateFadeIn();
this._showCount--;
} else {
this.updateFadeOut();
}
};
Window_MapName.prototype.updateFadeIn = function() {
this.contentsOpacity += 16;
};
Window_MapName.prototype.updateFadeOut = function() {
this.contentsOpacity -= 16;
};
Window_MapName.prototype.open = function() {
this.refresh();
this._showCount = 150;
};
Window_MapName.prototype.close = function() {
this._showCount = 0;
};
Window_MapName.prototype.refresh = function() {
this.contents.clear();
if ($gameMap.displayName()) {
var width = this.contentsWidth();
this.drawBackground(0, 0, width, this.lineHeight());
this.drawText($gameMap.displayName(), 0, 0, width, 'center');
}
};
Window_MapName.prototype.drawBackground = function(x, y, width, height) {
var color1 = this.dimColor1();
var color2 = this.dimColor2();
this.contents.gradientFillRect(x, y, width / 2, height, color2, color1);
this.contents.gradientFillRect(x + width / 2, y, width / 2, height, color1, color2);
};