1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-10-31 10:36:53 +00:00

add matchmaking button

This commit is contained in:
exane 2015-06-24 19:42:22 +02:00
parent 03fd73fab2
commit ed65e5c1d7
2 changed files with 9 additions and 4 deletions

View File

@ -579,10 +579,10 @@ var User = Backbone.Model.extend({
app.navigate("battle", {trigger: true});
})
app.receive("response:createRoom", function(roomID){
/*app.receive("response:createRoom", function(roomID){
self.set("room", roomID);
console.log("room created", roomID);
});
});*/
app.receive("response:joinRoom", function(roomID){
self.set("room", roomID);
@ -649,10 +649,12 @@ var User = Backbone.Model.extend({
app.send("request:name", this.get("name") == "unnamed" ? null : {name: this.get("name")});
},
startMatchmaking: function(){
this.set("inMatchmakerQueue", true);
this.get("app").send("request:matchmaking");
},
joinRoom: function(){
this.get("app").send("request:joinRoom");
this.set("inMatchmakerQueue", false);
},
subscribeRoom: function(){
var room = this.get("room");
@ -685,7 +687,7 @@ var Lobby = Backbone.View.extend({
},
events: {
"click .startMatchmaking": "startMatchmaking",
"click .join-room": "joinRoom",
/*"click .join-room": "joinRoom",*/
"blur .name-input": "changeName",
"change #deckChoice": "setDeck"
},

View File

@ -14,7 +14,10 @@
</div>
<div class="row">
<div class="col-xs-12">
<button type="button" class="btn btn-primary startMatchmaking">Search Opponent</button>
<button type="button" class="btn btn-primary startMatchmaking"{{#if inMatchmakerQueue}} disabled{{/if}}>
Search Opponent
{{#if inMatchmakerQueue}}<img src="../site/public/assets/img/content-load.gif" width=20 style="margin: 5px;"> {{/if}}
</button>
<!--<button type="button" class="btn btn-primary join-room">Join Room</button>-->
</div>
</div>