blob: ddbb152befcbba3ff36cdf418bf7c174b42efe6d (
plain)
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
|
import About from './collections/about';
import Login from './collections/login';
import Play from './collections/play';
/**
* Controller class for Page UI
*/
export default class UIManager {
/**
* Initializes new UI Manager
* @param {Interface} iface Interface for inter-object communication
*/
constructor(iface) {
this.currentUI = null;
iface.addObject(this, 'uiMananger', ['initAbout', 'initLogin', 'initPlay']);
this.iface = iface;
}
/**
* Initializes UI Components of About Page
*/
initAbout() {
this.clearComponents();
this.about = new About(this.iface);
this.currentUI = 'about';
}
/**
* Initializes UI Components of Login page
*/
initLogin() {
this.clearComponents();
this.login = new Login(this.iface);
this.currentUI = 'login';
}
/**
* Initializes UI Components of Play page
*/
initPlay() {
this.clearComponents();
this.play = new Play(this.iface);
this.currentUI = 'play';
}
/**
* Clears currently loaded components
*/
clearComponents() {
switch (this.currentUI) {
case null: return;
case 'about': this.about = null; break;
case 'login': this.login = null; break;
case 'play': this.play = null; break;
}
this.currentUI = null;
}
}
|