-
Notifications
You must be signed in to change notification settings - Fork 0
/
director.js
121 lines (101 loc) · 2.29 KB
/
director.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
/*
* @author Tapani Jamsa
*/
Director = function() {
this.setScreen(DirectorScreens.menu);
};
DirectorScreens = {
menu: 0,
setup: 1,
roomBrowser: 2,
lobby: 3,
controls: 4,
game: 5,
gameMenu: 6,
gameover: 7
};
Director.prototype.setScreen = function(newScreen) {
if (this.screen != newScreen) {
// *hide previous screen items
$("#onlineButton").hide();
$("#offlineButton").hide();
$("#title").hide();
$("#okButton").hide();
$("#helpOnline").hide();
$("#helpOffline").hide();
$("#gameMenuButton").hide();
$("#infoButton").hide();
$("#continueButton").hide();
$("#replayButton").hide();
$("#menuButton").hide();
$("#playersInfo").hide();
this.currentScreen = newScreen;
switch (this.currentScreen) {
case 0: // MENU
// *show title*
// *show play button*
// *show info button*
// *show volume button*
$("#onlineButton").show();
$("#offlineButton").show();
$("#title").show();
$("#infoButton").show();
break;
case 1: // SETUP
// *show setup*
// *show ok button*
break;
case 2: // ROOM BROWSER
// *show rooms*
// *show scrollbar*
break;
case 3: // LOBBY
// *show chat*
// *show ready button*
break;
case 4: // CONTROLS
// *show controls*
// *show ok button*
console.log("controls");
$("#okButton").show();
if (p2pCtrl.netRole === null) {
$("#helpOffline").show();
gui.open();
} else {
$("#helpOnline").show();
gui.close();
}
break;
case 5: // GAME SCENE
// *generate scene*
// *show game menu button*
// *show mini chat*
// *show players infos
$("#gameMenuButton").show();
// Player names and ball counts
$("#playersInfo").show();
// generateScene();
break;
case 6: // GAME MENU (pause)
// *show volume button*
// *show game menu button*
// *show menu button*
// *show replay button *
// *show continue button *
$("#infoButton").show();
$("#continueButton").show();
$("#replayButton").show();
$("#menuButton").show();
break;
case 7: // GAME OVER
// *show game over window*
// *show ok button*
break;
}
} else {
console.log("screen already set");
}
};
Director.prototype.doNextScreen = function() {
this.setScreen(this.currentScreen + 1);
};