From 9431bb259a138f4833b07cdd2e37fe52b2f8d5d2 Mon Sep 17 00:00:00 2001 From: frtk Date: Wed, 17 Feb 2016 01:37:52 +0100 Subject: [PATCH] v0.2.0 - Start Menu Page base --- client/lib/core/page_handler.js | 24 ++++++++++++++++++- client/lib/npg_client.js | 34 ++++++++++++++++++++++++--- client/lib/socket/socketio_handler.js | 5 ++-- version.md | 25 +++++++++++++------- 4 files changed, 74 insertions(+), 14 deletions(-) diff --git a/client/lib/core/page_handler.js b/client/lib/core/page_handler.js index a330e7f..580b4d9 100644 --- a/client/lib/core/page_handler.js +++ b/client/lib/core/page_handler.js @@ -14,6 +14,8 @@ NPGClient.PageHandler = { self.currPage = NPGClient.LOGIN.NAME; // create login page self.createLoginPage(); + // create start menu page + self.createStartMenuPage(); }, // @@ -85,7 +87,7 @@ NPGClient.PageHandler = { // console.log('[NPGClient] Creating Login Page'); var self = this; - var p = new NPGClient.AppPage('login'); + var p = new NPGClient.AppPage(NPGClient.LOGIN.NAME); // Title label p.addUIObject(new NPGClient.UILabel('login_title', NPGClient.LOGIN.TITLE)); // name input @@ -98,5 +100,25 @@ NPGClient.PageHandler = { self.pages.push(p); }, + + // create login page + createStartMenuPage: function() { + // + console.log('[NPGClient] Creating Start Menu Page'); + var self = this; + var p = new NPGClient.AppPage(NPGClient.STARTMENU.NAME); + // Title label + p.addUIObject(new NPGClient.UILabel('login_title', NPGClient.STARTMENU.TITLE)); + // Start Menu + + // Server Players and Games status + + // + self.pages.push(p); + }, + + + + }; diff --git a/client/lib/npg_client.js b/client/lib/npg_client.js index ffc6a85..d95026b 100644 --- a/client/lib/npg_client.js +++ b/client/lib/npg_client.js @@ -82,12 +82,40 @@ NPGClient.LOGIN = { 'bw': 0, 'bc': '', } + }, +}; + + +/* + * Start Menu Page + */ +NPGClient.STARTMENU = { + NAME: 'start_menu', + SERVSTATUS: { + 'text': { + 'online' : 'server: online', + 'offline' : 'server: offline', + }, + 'x': 400, + 'y': 450, + 'style': { + 'font': '15px Arial', + 'col': '#FFFFFF', + 'align': 'center' + }, + }, + TITLE: { + 'text': 'nodePong', + 'x': 400, + 'y': 150, + 'style': { + 'font': '50px Arial', + 'col': '#FFFFFF', + 'align': 'center' + } }, - }; - - diff --git a/client/lib/socket/socketio_handler.js b/client/lib/socket/socketio_handler.js index 0cca8f7..74a08a9 100644 --- a/client/lib/socket/socketio_handler.js +++ b/client/lib/socket/socketio_handler.js @@ -84,7 +84,8 @@ NPGClient.SocketIO = { // 'regDone' self.socket.on('regDone', function() { NPGClient.Utils.log(' > Server: User registration done'); - //NPGClient.PageHandler.moveToPage(NPGClient.LOGIN.NAME); + //NPGClient.PageHandler.moveToPage(NPGClient.STARTMENU.NAME); + NPGClient.PageHandler.setCurrPage(NPGClient.STARTMENU.NAME); }); // 'regNameTaken' @@ -93,7 +94,7 @@ NPGClient.SocketIO = { NPGClient.PageHandler.moveToPage(NPGClient.LOGIN.NAME); }); - }, + }, // send message to server sendMsg: function(name, data) { diff --git a/version.md b/version.md index a2300fc..4dd54ac 100644 --- a/version.md +++ b/version.md @@ -1,25 +1,34 @@ -### **v0.1.5:** + +# **v0.2.0:** +##focus: Start Menu Page +-------------------------- +### client +- create start menu page skeletton with title +- socketio: on 'regDone' move current page to 'start menu' page + + + + +# **v0.1.5:** +##focus: client/server user registration -------------------------- -focus: client/server user registration --------------------------- ----- added socket messages in npg_server.js and client/lib/socket/socketio_handler.js +### added socket messages in npg_server.js and client/lib/socket/socketio_handler.js 'regRequest' server socket msg 'regDone' client socket message 'regNameTaken' client socket message ----- +### Added user handling utilities { userRegistration clientDisconnect } ----- added User object on server +### added User object on server check if user already exist and handle issues ----- +### user disconnection handling (server & client) ### **v0.1.4:** --------------------------- focus: client ui lib -------------------------- ---- changed font (Lucida -> Arial)