From 05af359b8575095807636210b4c9682afbb5ff87 Mon Sep 17 00:00:00 2001 From: exane Date: Wed, 1 Jul 2015 19:51:09 +0200 Subject: [PATCH] more lobby stuff --- client/js/client.js | 9 ++- client/templates/lobby.handlebars | 10 ++-- server/Connections.js | 7 +++ server/Socket.js | 91 ------------------------------- server/User.js | 8 +-- server/server.js | 3 + 6 files changed, 27 insertions(+), 101 deletions(-) delete mode 100644 server/Socket.js diff --git a/client/js/client.js b/client/js/client.js index 1f69c95..14c8e5c 100644 --- a/client/js/client.js +++ b/client/js/client.js @@ -843,7 +843,10 @@ let Lobby = Backbone.View.extend({ initialize: function(options){ this.user = options.user; this.app = options.app; - this.listenTo(this.app.user, "change", this.render); + + this.app.receive("update:playerOnline", this.renderStatus.bind(this)); + + this.listenTo(this.app.user, "change:serverOffline", this.render); $(".gwent-battle").html(this.el); this.render(); }, @@ -863,6 +866,7 @@ let Lobby = Backbone.View.extend({ return this; }, startMatchmaking: function(){ + this.$el.find(".image-gif-loader").show(); this.app.trigger("startMatchmaking"); }, joinRoom: function(){ @@ -876,6 +880,9 @@ let Lobby = Backbone.View.extend({ changeName: function(e){ let name = $(e.target).val(); this.app.trigger("setName", name); + }, + renderStatus: function(n) { + this.$el.find(".nr-player-online").html(n); } }); diff --git a/client/templates/lobby.handlebars b/client/templates/lobby.handlebars index ff3a1f0..71bff1c 100644 --- a/client/templates/lobby.handlebars +++ b/client/templates/lobby.handlebars @@ -4,12 +4,12 @@ {{#if serverOffline}} Server Status: Offline {{else}} - Server Status: Online + Player online: 0 | Server Status: Online {{/if}}
-
+