Browse Source

Strategická: Ještě pouzek herního UI

master
Jiří Kalvoda 2 years ago
parent
commit
c0c3bfc4a2
  1. 50
      server/hra/web/game.py
  2. 2
      server/hra/web/pages.py
  3. 9
      server/static/occupy.css

50
server/hra/web/game.py

@ -96,7 +96,7 @@ class Occupy(WLogic):
else:
b("Konec kola není stanoven")
def status():
def status(position="left"):
members_counts = [0 for _ in teams]
occupied_counts = [0 for _ in teams]
@ -109,21 +109,24 @@ class Occupy(WLogic):
members_counts[occupied_by_team] += len(members)
with b.div(_class="game_left_status button form-frame"):
b.b("Kolo ", state.round)
with b.p():
reaming_time(id="time_left")
with b.p():
with b.div(_class=f"game_{position}_status button form-frame"):
if position != "up":
b.b("Kolo ", state.round)
with b.p():
reaming_time(id="time_left")
with b.p() if position == "left" else b.bucket():
for t, occupied_count, members_count in zip(teams, occupied_counts, members_counts):
with b.line().span(_class=f"game_team_{t.team_id}"):
b.b("Tým ", t.print())
b.br()
b("Bodů: ", t.get_move(state.round).points)
b.br()
b("Políček: ", occupied_count)
b.br()
b("Vojáků: ", members_count)
b.br()
with b.p() if position == "up" else b.bucket():
with b.line().span(_class=f"game_team_{t.team_id}"):
b.b("Tým ", t.print())
b.br()
b("Bodů: ", t.get_move(state.round).points)
b.br()
b("Políček: ", occupied_count)
b.br()
b("Vojáků: ", members_count)
b.br()
b.div(style="clear: both")("")
def table():
@ -185,15 +188,18 @@ class Occupy(WLogic):
b.p("Po kliknutí na buňku se zobrazí další informace.")
if conff.refresh.data == conff.refresh_meta and time_reaming is None:
b.p(f"Není známo, kdy nastane další kolo, proto může být aktualizace až o {meta_refresh_without_reaming} sekund opožděna.")
with b.p():
if team is not None:
b.line().b(_class=f"game_team_{team.team_id}")(f"Pohled týmu {team.print()}")
with b.p():
if team is not None:
b.line().b(_class=f"game_team_{team.team_id}")(f"Pohled týmu {team.print()}")
if not conff.show_data_only.data or conff.status.data == conff.status_up:
with b.line().b(_class="pull-right"):
reaming_time()
if conff.status.data == conff.status_up:
status("up")
b.div(style="clear: both; margin-bottom: 1ex")("")
with b.div().div(style="text-align:center;", id="game_main"):
with b.div().div(id="game_main"):
if conff.status.data == conff.status_left:
status()
status("left")
table()
if conff.clickable.data == conff.clickable_right:
clickable()
@ -224,8 +230,8 @@ class Occupy(WLogic):
main_w = table_w + left_w
if conff.clickable.data == conff.clickable_right:
right_w = 400
main_w += right_w
style += f".game_tab {{\n width: {right_w}px\n}}\n"
main_w += right_w + 40
style += f".game_tab {{\n width: {right_w}px; margin-left: 10pt; \n}}\n"
if main_w > page_w:
margin_cmd = f"margin-left: {(page_w-main_w) / 2}px;"
if conff.refresh.data == conff.refresh_meta:

2
server/hra/web/pages.py

@ -244,7 +244,7 @@ def web_index():
u = app.url_for('static', filename='client/client.py', _external=True)
v = app.url_for('static', filename='client/play.py', _external=True)
b.p(b._a(href=u)(u), b._br(), b._a(href=v)(v))
b.line().li("Git: ", b._pre(f"git clone {app.url_for('static', filename='client.git', _external=True)}", _class="margin: 0pt 0pt"))
b.line().li("Git: ", b._pre(f"git clone {app.url_for('static', filename='client.git', _external=True)}", style="margin: 0pt 0pt"))
return b.print_file()

9
server/static/occupy.css

@ -1,4 +1,8 @@
.game_left_status{
margin-right: 10pt;
}
table.game_table{
margin-left: auto;
margin-right: auto;
@ -140,3 +144,8 @@ table.game_table tr td a, table.game_table tr td a:hover, table.game_table tr td
#game_main div, #game_main table {
float: left;
}
.game_up_status p {
float: left;
width: 170pt;
}

Loading…
Cancel
Save