-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Scene_Menu.js
128 lines (110 loc) · 4.2 KB
/
Scene_Menu.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
//-----------------------------------------------------------------------------
// Scene_Menu
//
// The scene class of the menu screen.
function Scene_Menu() {
this.initialize.apply(this, arguments);
}
Scene_Menu.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Menu.prototype.constructor = Scene_Menu;
Scene_Menu.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Menu.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createGoldWindow();
this.createStatusWindow();
};
Scene_Menu.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
this._statusWindow.refresh();
};
Scene_Menu.prototype.createCommandWindow = function() {
this._commandWindow = new Window_MenuCommand(0, 0);
this._commandWindow.setHandler('item', this.commandItem.bind(this));
this._commandWindow.setHandler('skill', this.commandPersonal.bind(this));
this._commandWindow.setHandler('equip', this.commandPersonal.bind(this));
this._commandWindow.setHandler('status', this.commandPersonal.bind(this));
this._commandWindow.setHandler('formation', this.commandFormation.bind(this));
this._commandWindow.setHandler('options', this.commandOptions.bind(this));
this._commandWindow.setHandler('save', this.commandSave.bind(this));
this._commandWindow.setHandler('gameEnd', this.commandGameEnd.bind(this));
this._commandWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._commandWindow);
};
Scene_Menu.prototype.createGoldWindow = function() {
this._goldWindow = new Window_Gold(0, 0);
this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height;
this.addWindow(this._goldWindow);
};
Scene_Menu.prototype.createStatusWindow = function() {
this._statusWindow = new Window_MenuStatus(this._commandWindow.width, 0);
this._statusWindow.reserveFaceImages();
this.addWindow(this._statusWindow);
};
Scene_Menu.prototype.commandItem = function() {
SceneManager.push(Scene_Item);
};
Scene_Menu.prototype.commandPersonal = function() {
this._statusWindow.setFormationMode(false);
this._statusWindow.selectLast();
this._statusWindow.activate();
this._statusWindow.setHandler('ok', this.onPersonalOk.bind(this));
this._statusWindow.setHandler('cancel', this.onPersonalCancel.bind(this));
};
Scene_Menu.prototype.commandFormation = function() {
this._statusWindow.setFormationMode(true);
this._statusWindow.selectLast();
this._statusWindow.activate();
this._statusWindow.setHandler('ok', this.onFormationOk.bind(this));
this._statusWindow.setHandler('cancel', this.onFormationCancel.bind(this));
};
Scene_Menu.prototype.commandOptions = function() {
SceneManager.push(Scene_Options);
};
Scene_Menu.prototype.commandSave = function() {
SceneManager.push(Scene_Save);
};
Scene_Menu.prototype.commandGameEnd = function() {
SceneManager.push(Scene_GameEnd);
};
Scene_Menu.prototype.onPersonalOk = function() {
switch (this._commandWindow.currentSymbol()) {
case 'skill':
SceneManager.push(Scene_Skill);
break;
case 'equip':
SceneManager.push(Scene_Equip);
break;
case 'status':
SceneManager.push(Scene_Status);
break;
}
};
Scene_Menu.prototype.onPersonalCancel = function() {
this._statusWindow.deselect();
this._commandWindow.activate();
};
Scene_Menu.prototype.onFormationOk = function() {
var index = this._statusWindow.index();
var actor = $gameParty.members()[index];
var pendingIndex = this._statusWindow.pendingIndex();
if (pendingIndex >= 0) {
$gameParty.swapOrder(index, pendingIndex);
this._statusWindow.setPendingIndex(-1);
this._statusWindow.redrawItem(index);
} else {
this._statusWindow.setPendingIndex(index);
}
this._statusWindow.activate();
};
Scene_Menu.prototype.onFormationCancel = function() {
if (this._statusWindow.pendingIndex() >= 0) {
this._statusWindow.setPendingIndex(-1);
this._statusWindow.activate();
} else {
this._statusWindow.deselect();
this._commandWindow.activate();
}
};