Changeset 21174

Show
Ignore:
Timestamp:
10/12/08 18:07:18 (3 months ago)
Author:
nishio
Message:

/lang/python/saichugen 直前のラウンドの結果を表示、ログアウト

Location:
lang/python/saichugen/gae
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/python/saichugen/gae/app.yaml

    r21099 r21174  
    1 application: saichugen 
     1application: saichugen-online 
    22version: 1 
    33runtime: python 
  • lang/python/saichugen/gae/saichugen/main/views.py

    r21172 r21174  
    1111def main(req): 
    1212    user = users.get_current_user() 
    13     if user: 
    14          
    15         result = "Hello, " + user.nickname() 
    16     else: 
    17         result = "Welcome! You can <a href='%s'>login</a>" % users.create_login_url(req.get_full_path()) 
    18          
    1913    return HttpResponse( 
    20         template.render("template/index.html", dict(obj=1)) + result 
    21     ) 
     14        template.render( 
     15            "template/index.html",  
     16            dict( 
     17                user=user, 
     18                login_url=users.create_login_url(req.get_full_path()), 
     19                logout_url=users.create_logout_url(req.get_full_path()), ))) 
     20 
    2221 
    2322def start_single_game(req): 
     
    2625        game_score = [0, 0, 0], 
    2726        round_score = [0, 0, 0], 
     27        round_score_log = [], 
    2828        winner_of_turn = [], 
    2929        plays = [], 
     
    5252        for card_id in sorted(info["hands"][0])] 
    5353    tvalue["myhand"] = myhand 
     54    if game.step % 3 == 0 and game.step > 0: 
     55        tvalue["last_score_round"] = info["round_score_log"][-1] 
     56        tvalue["last_winner_of_round"] = info["winner_of_round"][-1] 
    5457 
    5558    # 過去の手をリアルなプレイに似せて出力 
     
    158161            info["winner_of_round"].append(winner) 
    159162            addTimeLog(info, "System", "END_ROUND", game.get_round()) 
     163            info["round_score_log"].append(rs) 
    160164            info["round_score"] = [0, 0, 0] 
    161165            if game.get_round() < 5: 
  • lang/python/saichugen/gae/template/game.html

    r21172 r21174  
    99{% for card in last_play %} {{ card }} {% endfor %} 
    1010</p> 
     11{% if last_score_round %} 
     12Last round's score is {{ last_round_score }}, Player {{ last_winner_of_round }} won. 
     13{% endif %} 
     14 
    1115{% endif %} 
    1216<hr> 
  • lang/python/saichugen/gae/template/index.html

    r21153 r21174  
    22<body> 
    33<h1>最中限(Saichugen)</h1> 
     4<p> 
     5{% if user %} 
     6  Hello, {{ user.nickname }} !  
     7<p> 
     8  You can <a href='/start_single_game'>start new game</a> or <a href=' {{ logout_url }}'>log out</a>. 
     9 
     10{% else %} 
     11  Welcome! You can <a href='{{ login_url }}'>login</a> to play new game. 
     12{% endif %} 
     13         
     14 
    415 
    516<p> 
    6 <a href='/start_single_game'>start new game</a> 
    7  
    8 <p> 
     17<hr> 
     18<div style="align: left;"> 
    919by NISHIO Hirokazu 
    10  
    11 <hr> 
    12  
    13 {{ obj }} 
     20</div>