From d7c42361bda4c64a0594a8640156a504fc334f11 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sun, 29 Jul 2007 10:39:34 -0700 Subject: LAYOUT: final score is displayed on the table; played card is displayed in trick added another trick as trick13 that displays the final score. Also moved the played card to show up as a normal card and not in the middle of the table anymore. --- css/standard.css | 78 ++++++++++++++++++---------------- index.php | 125 ++++++++++++++++++++++++++++++++----------------------- output.php | 6 +-- 3 files changed, 118 insertions(+), 91 deletions(-) diff --git a/css/standard.css b/css/standard.css index c2cb6f7..9eb54e7 100644 --- a/css/standard.css +++ b/css/standard.css @@ -27,7 +27,7 @@ font-size: smaller; } -.joingame,.sickness,.poverty { +.joingame,.sickness,.poverty,.total { position: absolute; width: 18em; @@ -152,16 +152,16 @@ ul.tricks li div div.card0 { margin:0; padding:0; /*border: 1px solid red;*/ - top: 9em; - right:27em; + top: 7em; + right:22em; } ul.tricks li div div.card1 { position:absolute; margin:0; padding:0; /*border: 1px solid red;*/ - top: -3em; - left:-3em; + top: 1em; + left:-7em; width:28em; text-align:center; } @@ -170,16 +170,16 @@ ul.tricks li div div.card2 { margin:0; padding:0; /*border: 1px solid red;*/ - top: 9em; - right:-2em; + top: 7em; + left: 15em; } ul.tricks li div div.card3 { position:absolute; margin:0; padding:0; /*border: 1px solid red;*/ - top: 20em; - left:-3em; + top: 15em; + left:-7em; width:28em; text-align:center; } @@ -191,24 +191,6 @@ ul.tricks li div div img { padding:0; } -ul.tricks li div div.card0 img { - top: -2em; - left:5em; -} -ul.tricks li div div.card1 img { - top: 3em; - left:10em; -} -ul.tricks li div div.card2 img { - top: -2em; - left:-6em; -} -ul.tricks li div div.card3 img { - top: -6em; - left:10em; -} - - ul.tricks li div div span.comment { position:absolute; background-color:white; @@ -218,27 +200,53 @@ ul.tricks li div div span.comment { border: 1px solid yellow; z-index:-11; } + +ul.tricks li div div span.score { + position:absolute; + width:5em; + background-color: #fff; +} +ul.tricks li div div.card0 span.score { + top: 1em; + left: 2em; +} +ul.tricks li div div.card1 span.score { + top: -1em; + left: 14em; +} +ul.tricks li div div.card2 span.score { + top: 1em; + left: -1em; +} +ul.tricks li div div.card3 span.score { + top: 2em; + left: 14em; +} + ul.tricks li div div span.comment:hover { z-index:11; } +ul.tricks li div div span.comment { + z-index:-11; +} ul.tricks li div div.card0 span.comment{ - top:4em; - left:-10em; + top:6em; + left:-15em; border: 3px solid green; } ul.tricks li div div.card1 span.comment{ - top:-2em; - left:1em; + top:-5em; + left:-4em; border: 3px solid green; } ul.tricks li div div.card2 span.comment{ - top:-2em; - left:0em; + top:-8em; + left:6em; border: 3px solid green; } ul.tricks li div div.card3 span.comment{ - top:2em; - left:20em; + top:5em; + left:27em; border: 3px solid green; } ul.tricks li div div span.comment span{ diff --git a/index.php b/index.php index 4f69522..c8c8804 100644 --- a/index.php +++ b/index.php @@ -303,6 +303,33 @@ else if(myisset("me")) echo "\n"; + + if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' ) + { + echo "
\n"; + + $session = DB_get_session_by_gameid($gameid); + $result = mysql_query("SELECT id,create_date FROM Game". + " WHERE session=$session". + " ORDER BY create_date DESC". + " LIMIT 1"); + $r = -1; + if($result) + $r = mysql_fetch_array($result,MYSQL_NUM); + + if(!$session || $gameid==$r[0]) + { + /* suggest a new game with the same people in it, just rotated once (unless last game was solo) */ + $names = DB_get_all_names_by_gameid($gameid); + $type = DB_get_gametype_by_gameid($gameid); + + if($type=="solo") + output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid); + else + output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid); + } + } + echo "\n"; /* output game */ @@ -1132,15 +1159,10 @@ else if(myisset("me")) if($seq==4) { $trickNR++; - echo " \n \n"; /* end div table, end li table */ + echo " \n \n"; /* end div trick, end li trick */ } } - - if($seq!=4 && $trickNR>1) - echo " \n \n"; /* end div table, end li table */ - - echo "\n"; - + /* whos turn is it? */ if($seq==4) { @@ -1282,13 +1304,20 @@ else if(myisset("me")) }; /* display played card */ - echo "
"; - echo " you played
"; + $pos = DB_get_pos_by_hash($me); + if($sequence==1) + { + echo "
  • Trick ".($tricknr)."\n". + "
    \n". + " \"table\"\n"; + } + + echo "
    "; /* display comments */ display_card($card,$PREF["cardset"]); if($comment!="") - echo "
    Your comment:
    ".$comment."\n"; - echo "
    \n"; + echo " ".$comment."\n"; + echo "
  • \n"; /*check if we still have cards left, else set status to gameover */ if(sizeof(DB_get_hand($me))==0) @@ -1381,6 +1410,36 @@ else if(myisset("me")) { echo "please wait until it's your turn!
    \n"; } + + if($seq!=4 && $trickNR>1) + echo " \n \n"; /* end div trick, end li trick */ + + /* display points in case game is over */ + if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' ) + { + echo "
  • Score\n". + "
    \n"; + /* add pic for re/contra + " \"table\"\n";*/ + + $result = mysql_query("SELECT User.fullname, IFNULL(SUM(Card.points),0), Hand.party,Hand.position FROM Hand". + " LEFT JOIN Trick ON Trick.winner=Hand.position AND Trick.game_id=Hand.game_id". + " LEFT JOIN User ON User.id=Hand.user_id". + " LEFT JOIN Play ON Trick.id=Play.trick_id". + " LEFT JOIN Hand_Card ON Hand_Card.id=Play.hand_card_id". + " LEFT JOIN Card ON Card.id=Hand_Card.card_id". + " WHERE Hand.game_id='$gameid'". + " GROUP BY User.fullname" ); + while( $r = mysql_fetch_array($result,MYSQL_NUM)) + echo "
    \n". + " ".$r[2]."
    ".$r[1]."
    \n". + "
    \n"; + + echo "
    \n
  • \n"; /* end div trick, end li trick */ + } + + + echo "\n"; /* end ul tricks*/ $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); @@ -1462,23 +1521,6 @@ else if(myisset("me")) } else { - echo "the game is over now...
    \n"; - - $result = mysql_query("SELECT User.fullname, IFNULL(SUM(Card.points),0), Hand.party FROM Hand". - " LEFT JOIN Trick ON Trick.winner=Hand.position AND Trick.game_id=Hand.game_id". - " LEFT JOIN User ON User.id=Hand.user_id". - " LEFT JOIN Play ON Trick.id=Play.trick_id". - " LEFT JOIN Hand_Card ON Hand_Card.id=Play.hand_card_id". - " LEFT JOIN Card ON Card.id=Hand_Card.card_id". - " WHERE Hand.game_id='$gameid'". - " GROUP BY User.fullname" ); - echo "Final Score:
    \n". - " \n";; - while( $r = mysql_fetch_array($result,MYSQL_NUM)) - echo " "; - echo "
    ".$r[0]."(".$r[2].") ".$r[1]."
    \n"; - - $result = mysql_query("SELECT Hand.party, IFNULL(SUM(Card.points),0) FROM Hand". " LEFT JOIN Trick ON Trick.winner=Hand.position AND Trick.game_id=Hand.game_id". " LEFT JOIN User ON User.id=Hand.user_id". @@ -1487,32 +1529,11 @@ else if(myisset("me")) " LEFT JOIN Card ON Card.id=Hand_Card.card_id". " WHERE Hand.game_id='$gameid'". " GROUP BY Hand.party" ); - echo "Totals:
    \n". - " \n"; + echo "
    Totals:
    \n"; while( $r = mysql_fetch_array($result,MYSQL_NUM)) - echo "
    \n"; - echo "
    ".$r[0]." ".$r[1]."
    \n"; - - $session = DB_get_session_by_gameid($gameid); - $result = mysql_query("SELECT id,create_date FROM Game". - " WHERE session=$session". - " ORDER BY create_date DESC". - " LIMIT 1"); - $r = -1; - if($result) - $r = mysql_fetch_array($result,MYSQL_NUM); + echo " ".$r[0]." ".$r[1]."
    \n"; + echo "\n"; - if(!$session || $gameid==$r[0]) - { - /* suggest a new game with the same people in it, just rotated once (unless last game was solo) */ - $names = DB_get_all_names_by_gameid($gameid); - $type = DB_get_gametype_by_gameid($gameid); - - if($type=="solo") - output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid); - else - output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid); - } } break; default: diff --git a/output.php b/output.php index 6d84128..ddea3b8 100644 --- a/output.php +++ b/output.php @@ -25,7 +25,6 @@ function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid) global $RULES; echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n"; - echo "
    \n"; echo " \n"; echo " \n"; echo " \n"; @@ -35,7 +34,6 @@ function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid) echo " \n"; echo " \n"; echo " \n"; - echo "
    \n"; return; } @@ -296,7 +294,7 @@ function output_header() function hl(num) { if(document.getElementById){ var i; - for(i=1;i<13;i++){ + for(i=1;i<14;i++){ if(document.getElementById("trick"+i)) document.getElementById("trick"+i).style.display = 'none'; } @@ -306,7 +304,7 @@ function output_header() function high_last(){ if(document.getElementById){ var i; - for(i=12;i>0;i--) { + for(i=13;i>0;i--) { if(document.getElementById("trick"+i)) { hl(i); -- cgit v1.2.3-18-g5258