minor corrections and addition of more deck UI controls. Minor testing
This commit is contained in:
parent
f8583ab99e
commit
b395dfaf82
@ -346,7 +346,12 @@ my $server = Net::WebSocket::Server->new(
|
|||||||
# each card (so we scale better)
|
# each card (so we scale better)
|
||||||
if (@hand) { for (@hand) {
|
if (@hand) { for (@hand) {
|
||||||
my $card = $_;
|
my $card = $_;
|
||||||
$current->send_utf8('{"action":"addCard","hand":"'.$handID.'", "card":"'.$card.'"}');
|
my %message = (
|
||||||
|
action => "addCard",
|
||||||
|
hand => $handID,
|
||||||
|
card => $card
|
||||||
|
);
|
||||||
|
$current->send_utf8(to_json(\%message));
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
@ -371,7 +376,7 @@ my $server = Net::WebSocket::Server->new(
|
|||||||
$conn->send_utf8('{"info":"hand returned to deck","request":"update"}');
|
$conn->send_utf8('{"info":"hand returned to deck","request":"update"}');
|
||||||
}
|
}
|
||||||
if ($messageData->{action} =~ /shuffle/) {
|
if ($messageData->{action} =~ /shuffle/) {
|
||||||
shuffleDeck($conn->{session},$messageData->{action});
|
shuffleDeck($conn->{session},$messageData->{deck});
|
||||||
$conn->send_utf8('{"info":"deck shuffeled","request":"update"}');
|
$conn->send_utf8('{"info":"deck shuffeled","request":"update"}');
|
||||||
}
|
}
|
||||||
if ($messageData->{action} =~ /add/) {
|
if ($messageData->{action} =~ /add/) {
|
||||||
|
@ -47,7 +47,7 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
height: 80vh;
|
height: 95vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ body {
|
|||||||
#decks, #hands, #pools, #users {
|
#decks, #hands, #pools, #users {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-around;
|
justify-content: start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -20,7 +20,9 @@ function updateEvent() {
|
|||||||
window.UI.display.innerHTML = "";
|
window.UI.display.innerHTML = "";
|
||||||
if (window.UI.menu.decks.button.checked) {
|
if (window.UI.menu.decks.button.checked) {
|
||||||
elementPlace("#display","decks",null,"ol");
|
elementPlace("#display","decks",null,"ol");
|
||||||
Object.keys(window.gameState.decks).forEach(function (deckID) {
|
var myKeys = Object.keys(window.gameState.decks);
|
||||||
|
myKeys.sort();
|
||||||
|
myKeys.forEach(function (deckID) {
|
||||||
var deck = window.gameState.decks[deckID];
|
var deck = window.gameState.decks[deckID];
|
||||||
window.UI.display[deckID] = elementPlace("#decks","Deck_"+deck.name,"deck","li");
|
window.UI.display[deckID] = elementPlace("#decks","Deck_"+deck.name,"deck","li");
|
||||||
window.UI.display[deckID].innerText = deck.name+":"+deck.size;
|
window.UI.display[deckID].innerText = deck.name+":"+deck.size;
|
||||||
@ -31,7 +33,7 @@ function updateEvent() {
|
|||||||
var message = {};
|
var message = {};
|
||||||
message.action = "ddf";
|
message.action = "ddf";
|
||||||
message.deck = deckID;
|
message.deck = deckID;
|
||||||
message.ddf = file;
|
message.ddf = file.target.result;
|
||||||
window.gameSession.send(JSON.stringify(message));
|
window.gameSession.send(JSON.stringify(message));
|
||||||
}
|
}
|
||||||
myFile.readAsText(f[0]);
|
myFile.readAsText(f[0]);
|
||||||
@ -44,9 +46,15 @@ function updateEvent() {
|
|||||||
window.gameSession.send('{"action":"draw","deck":"'+deckID+'","hand":"'+"default"+'"}'); // Will need to be updated when I figure out selection
|
window.gameSession.send('{"action":"draw","deck":"'+deckID+'","hand":"'+"default"+'"}'); // Will need to be updated when I figure out selection
|
||||||
}, "deck_button draw","div");
|
}, "deck_button draw","div");
|
||||||
});
|
});
|
||||||
|
buttonAdd("#decks",null,"+",function () {
|
||||||
|
popupDialog("addDeck","Please name new deck",true, inputDialog,{"inputType":"text"},function (newDeckName) {
|
||||||
|
window.gameSession.send('{"action":"add","type":"deck","id":"'+newDeckName+'"}');
|
||||||
|
});
|
||||||
|
}, "add_button","li");
|
||||||
}
|
}
|
||||||
if (window.UI.menu.users.button.checked) {
|
if (window.UI.menu.users.button.checked) {
|
||||||
elementPlace("#display","users",null,"ol");
|
elementPlace("#display","users",null,"ol");
|
||||||
|
window.gameState.users.sort();
|
||||||
window.gameState.users.forEach(function (user) {
|
window.gameState.users.forEach(function (user) {
|
||||||
window.UI.display[user] = elementPlace("#users","User_"+user,"username","li");
|
window.UI.display[user] = elementPlace("#users","User_"+user,"username","li");
|
||||||
window.UI.display[user].innerText = user;
|
window.UI.display[user].innerText = user;
|
||||||
@ -54,7 +62,9 @@ function updateEvent() {
|
|||||||
}
|
}
|
||||||
if (window.UI.menu.hands.button.checked) {
|
if (window.UI.menu.hands.button.checked) {
|
||||||
elementPlace("#display","hands",null,"ol");
|
elementPlace("#display","hands",null,"ol");
|
||||||
Object.keys(window.gameState.hands).forEach(function (handID) {
|
var myHands = Object.keys(window.gameState.hands);
|
||||||
|
myHands.sort();
|
||||||
|
myHands.forEach(function (handID) {
|
||||||
var hand = window.gameState.hands[handID];
|
var hand = window.gameState.hands[handID];
|
||||||
window.UI.display[handID] = elementPlace("#hands","Hand_"+hand.name,"hand","li");
|
window.UI.display[handID] = elementPlace("#hands","Hand_"+hand.name,"hand","li");
|
||||||
window.UI.display[handID].innerText = hand.name;
|
window.UI.display[handID].innerText = hand.name;
|
||||||
@ -67,7 +77,9 @@ function updateEvent() {
|
|||||||
}
|
}
|
||||||
if (window.UI.menu.pools.button.checked) {
|
if (window.UI.menu.pools.button.checked) {
|
||||||
elementPlace("#display","pools",null,"ol");
|
elementPlace("#display","pools",null,"ol");
|
||||||
Object.keys(window.gameState.pools).forEach(function (poolID) {
|
var myPools = Object.keys(window.gameState.pools);
|
||||||
|
myPools.sort();
|
||||||
|
myPools.forEach(function (poolID) {
|
||||||
var pool = window.gameState.pools[poolID];
|
var pool = window.gameState.pools[poolID];
|
||||||
window.UI.display[poolID] = elementPlace("#pools","Pool_"+pool.name,"pool","li");
|
window.UI.display[poolID] = elementPlace("#pools","Pool_"+pool.name,"pool","li");
|
||||||
window.UI.display[poolID].innerText = pool.name+":"+pool.top;
|
window.UI.display[poolID].innerText = pool.name+":"+pool.top;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user