-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Scene_Boot.js
87 lines (76 loc) · 2.57 KB
/
Scene_Boot.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
//-----------------------------------------------------------------------------
// Scene_Boot
//
// The scene class for initializing the entire game.
function Scene_Boot() {
this.initialize.apply(this, arguments);
}
Scene_Boot.prototype = Object.create(Scene_Base.prototype);
Scene_Boot.prototype.constructor = Scene_Boot;
Scene_Boot.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
this._startDate = Date.now();
};
Scene_Boot.prototype.create = function() {
Scene_Base.prototype.create.call(this);
DataManager.loadDatabase();
ConfigManager.load();
this.loadSystemWindowImage();
};
Scene_Boot.prototype.loadSystemWindowImage = function() {
ImageManager.reserveSystem('Window');
};
Scene_Boot.loadSystemImages = function() {
ImageManager.reserveSystem('IconSet');
ImageManager.reserveSystem('Balloon');
ImageManager.reserveSystem('Shadow1');
ImageManager.reserveSystem('Shadow2');
ImageManager.reserveSystem('Damage');
ImageManager.reserveSystem('States');
ImageManager.reserveSystem('Weapons1');
ImageManager.reserveSystem('Weapons2');
ImageManager.reserveSystem('Weapons3');
ImageManager.reserveSystem('ButtonSet');
};
Scene_Boot.prototype.isReady = function() {
if (Scene_Base.prototype.isReady.call(this)) {
return DataManager.isDatabaseLoaded() && this.isGameFontLoaded();
} else {
return false;
}
};
Scene_Boot.prototype.isGameFontLoaded = function() {
if (Graphics.isFontLoaded('GameFont')) {
return true;
} else if (!Graphics.canUseCssFontLoading()){
var elapsed = Date.now() - this._startDate;
if (elapsed >= 60000) {
throw new Error('Failed to load GameFont');
}
}
};
Scene_Boot.prototype.start = function() {
Scene_Base.prototype.start.call(this);
SoundManager.preloadImportantSounds();
if (DataManager.isBattleTest()) {
DataManager.setupBattleTest();
SceneManager.goto(Scene_Battle);
} else if (DataManager.isEventTest()) {
DataManager.setupEventTest();
SceneManager.goto(Scene_Map);
} else {
this.checkPlayerLocation();
DataManager.setupNewGame();
SceneManager.goto(Scene_Title);
Window_TitleCommand.initCommandPosition();
}
this.updateDocumentTitle();
};
Scene_Boot.prototype.updateDocumentTitle = function() {
document.title = $dataSystem.gameTitle;
};
Scene_Boot.prototype.checkPlayerLocation = function() {
if ($dataSystem.startMapId === 0) {
throw new Error('Player\'s starting position is not set');
}
};