version 0.2.2

This commit is contained in:
2016-02-25 23:35:06 +01:00
parent 2636cf3db7
commit babb856b83
13 changed files with 290 additions and 48 deletions

View File

@@ -31,6 +31,16 @@ NPGClient.AppPage.prototype = {
return self.uiElems;
},
//
hasUIElem: function(name) {
var self = this;
if (self.uiElems.length > 0) {
for (var i = 0; i < self.uiElems.length; i++)
if (self.uiElems[i].name == name) return true;
}
return false;
},
//
getUIElemByName: function(name) {

View File

@@ -57,6 +57,21 @@ NPGClient.PageHandler = {
return undefined;
},
//
getUIElem: function(name) {
var self = this;
var elem = [];
if (self.pages.length > 0) {
for (var i = 0; i < self.pages.length; i++) {
elem = self.pages[i].getUIElems();
for (e in elem) {
if (elem[e].name == name) return elem[e];
}
}
}
return undefined;
},
// @need rework
getUIElemFromPage: function(elem, page) {
var self = this;
@@ -82,6 +97,18 @@ NPGClient.PageHandler = {
return undefined;
},
//
updateServerInfos: function() {
var self = this;
// server infos
self.getUIElem('servinfo_users').update(NPGClient.SERVER.nPlayers);
self.getUIElem('servinfo_games_running').update(NPGClient.SERVER.nGamesRunning);
self.getUIElem('servinfo_games_avail').update(NPGClient.SERVER.nGamesAvail);
},
// create login page
createLoginPage: function() {
//
@@ -89,7 +116,8 @@ NPGClient.PageHandler = {
var self = this;
var p = new NPGClient.AppPage(NPGClient.LOGIN.NAME);
// Title label
p.addUIObject(new NPGClient.UILabel('login_title', NPGClient.LOGIN.TITLE));
//p.addUIObject(new NPGClient.UILabel('login_title', NPGClient.LOGIN.TITLE));
p.addUIObject(new NPGClient.UILabel(NPGClient.LOGIN.TITLE));
// name input
p.addUIObject(new NPGClient.UIInputText('login_input', NPGClient.LOGIN.INPUT));
// Server status
@@ -108,11 +136,14 @@ NPGClient.PageHandler = {
var self = this;
var p = new NPGClient.AppPage(NPGClient.STARTMENU.NAME);
// Title label
p.addUIObject(new NPGClient.UILabel('login_title', NPGClient.STARTMENU.TITLE));
//p.addUIObject(new NPGClient.UILabel('startmenu_title', NPGClient.STARTMENU.TITLE));
p.addUIObject(new NPGClient.UILabel(NPGClient.STARTMENU.TITLE));
// Start Menu
p.addUIObject(new NPGClient.UIMenu(NPGClient.STARTMENU.MENU));
// Server Players and Games status
// Server Players and Games info
p.addUIObject(new NPGClient.UIStatusValue(NPGClient.STARTMENU.SERVINFO_USERS));
p.addUIObject(new NPGClient.UIStatusValue(NPGClient.STARTMENU.SERVINFO_GAMES_RUNNING));
p.addUIObject(new NPGClient.UIStatusValue(NPGClient.STARTMENU.SERVINFO_GAMES_AVAIL));
//
self.pages.push(p);
},