summaryrefslogtreecommitdiff
path: root/WebInterface/NodeJSServer/src/js/src_old/modules/playModule.js
diff options
context:
space:
mode:
Diffstat (limited to 'WebInterface/NodeJSServer/src/js/src_old/modules/playModule.js')
-rw-r--r--WebInterface/NodeJSServer/src/js/src_old/modules/playModule.js46
1 files changed, 0 insertions, 46 deletions
diff --git a/WebInterface/NodeJSServer/src/js/src_old/modules/playModule.js b/WebInterface/NodeJSServer/src/js/src_old/modules/playModule.js
deleted file mode 100644
index 931f598..0000000
--- a/WebInterface/NodeJSServer/src/js/src_old/modules/playModule.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// TODO: Handle disconnect
-
-/**
- * Handles ingame networking;
- */
-export default class GameClient {
- /**
- * Defines basic attributes
- * @param {string} user The username of the player
- * @param {HubConnection} connection Already established connection to the
- * server
- */
- constructor(user, connection) {
- this.user = user;
- this.connection = connection;
- }
-
- /**
- * Registers chat html component
- * @param {string} chatId Id of chat component
- */
- registerChat(chatId) {
- this.chat = document.getElementById(chatId);
- this.messageList = this.chat.querySelector('#message-list');
- this.messageInput = this.chat.querySelector('#input-message');
- this.messageSend = this.chat.querySelector('#send-message');
-
- this.connection.on('ReceiveMessage', (user, message) => {
- let msg = message.replace(/&/g, '&')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;');
- let encodedMsg = user + ' sagt: ' + msg;
-
- let messageP = document.createElement('p');
- messageP.class = 'message';
- messageP.textContent = encodedMsg;
-
- this.messageList.appendChild(messageP);
- });
-
- this.messageSend.addEventListener('click', () => {
- let message = this.messageInput.value;
- this.connection.invoke('SendMessage', this.user, message);
- });
- }
-}