summaryrefslogtreecommitdiff
path: root/WebInterface/NodeJSServer/src/js/modules/ui/uiManager.js
diff options
context:
space:
mode:
authorTrueKuehli <rctcoaster2000@hotmail.de>2018-11-27 12:16:33 +0100
committerTrueKuehli <rctcoaster2000@hotmail.de>2018-11-27 12:16:33 +0100
commit9f0b255f32dfa81bffe75f89335a78a659b4ce6a (patch)
treec4345ef6f98fee35f326bc06c29cada542a78e43 /WebInterface/NodeJSServer/src/js/modules/ui/uiManager.js
parenta653a4efc60ef0bbc18e65cb11a4bd8c06c7ad5c (diff)
Reworked the code, but currently unable to test, so bugs are bound to be in there
Will test it sometime later. There also might still be stuff, that has yet to be reworked.
Diffstat (limited to 'WebInterface/NodeJSServer/src/js/modules/ui/uiManager.js')
-rw-r--r--WebInterface/NodeJSServer/src/js/modules/ui/uiManager.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/WebInterface/NodeJSServer/src/js/modules/ui/uiManager.js b/WebInterface/NodeJSServer/src/js/modules/ui/uiManager.js
new file mode 100644
index 0000000..ddbb152
--- /dev/null
+++ b/WebInterface/NodeJSServer/src/js/modules/ui/uiManager.js
@@ -0,0 +1,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;
+ }
+}