JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix shuffling, auto hide/show card text overflow
authorJason Woofenden <jason@jasonwoof.com>
Sat, 5 Nov 2011 05:39:17 +0000 (01:39 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Sat, 5 Nov 2011 05:39:17 +0000 (01:39 -0400)
client.coffee
index.html
server.coffee
style.less

index 0c54a71..6da0968 100644 (file)
@@ -298,7 +298,7 @@ init_card_designer = ->
 
        container.append ul
 
-       submit = $ $ "<div style=\"border: 1px solid black\">Done</div>"
+       submit = $ $ "<div style=\"border: 1px solid black; margin: 0 auto 10px 10px; width: 40px; text-align: center\">Done</div>"
        submit.bind 'click', ->
                $('#deck_designer').remove()
                show_message cards_in_deck
@@ -310,15 +310,17 @@ init_card_designer = ->
                                pile: "#{state.agent}_draw"
                                x: 0
                                y: 0
-                               z: next_card_z()
                                flipped: true
                        }
                        cards.push card
-                       cards.push card
-                       cards.push card
-                       cards.push card
+                       cards.push $.extend {}, card # clone
+                       cards.push $.extend {}, card # clone
+                       cards.push $.extend {}, card # clone
 
+               # asign z-index in random order
                cards.shuffle()
+               for card in cards
+                       card.z = next_card_z()
                show_message cards
 
                # let server assign card numbers
index 548d51d..0602c9f 100644 (file)
@@ -22,6 +22,6 @@
                </div>
                <div id="my_side">Cards in this green area (except the two piles on the right) always appear face-down to the other player.</div>
        </div>
-       <div id="deck_designer"><h1>Deck Designer</h1><p>Click each card you'd like in your deck and then click "done" at the bottom.</p></div>
+       <div id="deck_designer"><h1>Deck Designer</h1><p>Click each card you'd like in your deck (you'll get four of each) and then click "done" at the bottom.</p></div>
 </body>
 </html>
index 29b3e50..91250cb 100644 (file)
@@ -143,9 +143,8 @@ answer_now = (game) ->
                queue = game.p2_queue
                game.p2_waiter = false
                game.p2_queue = []
-               timeout 2000, -> # FIXME remove this delay for player 2 (just here to test lag handling)
-                       waiter.writeHead 200, 'Content-Type': 'text/javascript'
-                       waiter.end JSON.stringify queue
+               waiter.writeHead 200, 'Content-Type': 'text/javascript'
+               waiter.end JSON.stringify queue
 
 # this marks a game as "dirty" and makes sure there's exactly one timeout
 # that'll respond to any clients that are waiting, and now have messages.
index 622e725..bc3eae3 100644 (file)
@@ -63,9 +63,12 @@ h1 {
 .card {
        background: #fff;
        border: 2px solid #fff;
+       overflow: hidden;
        .shadow(1px, 1px, 8px, 0.4);
 
        &:hover {
+               height: auto;
+               min-height: @card-height;
                z-index: 9999 !important;
        }
        .button {