-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Scene_Skill.js
104 lines (88 loc) · 3.24 KB
/
Scene_Skill.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
//-----------------------------------------------------------------------------
// Scene_Skill
//
// The scene class of the skill screen.
function Scene_Skill() {
this.initialize.apply(this, arguments);
}
Scene_Skill.prototype = Object.create(Scene_ItemBase.prototype);
Scene_Skill.prototype.constructor = Scene_Skill;
Scene_Skill.prototype.initialize = function() {
Scene_ItemBase.prototype.initialize.call(this);
};
Scene_Skill.prototype.create = function() {
Scene_ItemBase.prototype.create.call(this);
this.createHelpWindow();
this.createSkillTypeWindow();
this.createStatusWindow();
this.createItemWindow();
this.createActorWindow();
};
Scene_Skill.prototype.start = function() {
Scene_ItemBase.prototype.start.call(this);
this.refreshActor();
};
Scene_Skill.prototype.createSkillTypeWindow = function() {
var wy = this._helpWindow.height;
this._skillTypeWindow = new Window_SkillType(0, wy);
this._skillTypeWindow.setHelpWindow(this._helpWindow);
this._skillTypeWindow.setHandler('skill', this.commandSkill.bind(this));
this._skillTypeWindow.setHandler('cancel', this.popScene.bind(this));
this._skillTypeWindow.setHandler('pagedown', this.nextActor.bind(this));
this._skillTypeWindow.setHandler('pageup', this.previousActor.bind(this));
this.addWindow(this._skillTypeWindow);
};
Scene_Skill.prototype.createStatusWindow = function() {
var wx = this._skillTypeWindow.width;
var wy = this._helpWindow.height;
var ww = Graphics.boxWidth - wx;
var wh = this._skillTypeWindow.height;
this._statusWindow = new Window_SkillStatus(wx, wy, ww, wh);
this._statusWindow.reserveFaceImages();
this.addWindow(this._statusWindow);
};
Scene_Skill.prototype.createItemWindow = function() {
var wx = 0;
var wy = this._statusWindow.y + this._statusWindow.height;
var ww = Graphics.boxWidth;
var wh = Graphics.boxHeight - wy;
this._itemWindow = new Window_SkillList(wx, wy, ww, wh);
this._itemWindow.setHelpWindow(this._helpWindow);
this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
this._skillTypeWindow.setSkillWindow(this._itemWindow);
this.addWindow(this._itemWindow);
};
Scene_Skill.prototype.refreshActor = function() {
var actor = this.actor();
this._skillTypeWindow.setActor(actor);
this._statusWindow.setActor(actor);
this._itemWindow.setActor(actor);
};
Scene_Skill.prototype.user = function() {
return this.actor();
};
Scene_Skill.prototype.commandSkill = function() {
this._itemWindow.activate();
this._itemWindow.selectLast();
};
Scene_Skill.prototype.onItemOk = function() {
this.actor().setLastMenuSkill(this.item());
this.determineItem();
};
Scene_Skill.prototype.onItemCancel = function() {
this._itemWindow.deselect();
this._skillTypeWindow.activate();
};
Scene_Skill.prototype.playSeForItem = function() {
SoundManager.playUseSkill();
};
Scene_Skill.prototype.useItem = function() {
Scene_ItemBase.prototype.useItem.call(this);
this._statusWindow.refresh();
this._itemWindow.refresh();
};
Scene_Skill.prototype.onActorChange = function() {
this.refreshActor();
this._skillTypeWindow.activate();
};