summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-15 17:52:18 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 12:53:17 +0100
commitb794669d0ec1aa634272fe5f138eda847506b454 (patch)
tree97f025a5d7274d85c21b942b73398c1f47bed002
parent05890057c5e22d3bbcca569d0033ba5484a707dc (diff)
downloadhammer-of-the-scots-b794669d0ec1aa634272fe5f138eda847506b454.tar.gz
Add "Rematch" button for easier repeat match making.
-rw-r--r--play.html2
-rw-r--r--ui.js14
2 files changed, 7 insertions, 9 deletions
diff --git a/play.html b/play.html
index d347df6..09ac0c9 100644
--- a/play.html
+++ b/play.html
@@ -360,6 +360,8 @@ div.card_3{background-image:url('cards/card_3.jpg')}
<button id="undo_button" onclick="on_button_undo()" class="hide">
Undo
</button>
+
+ <div id="rematch_button" class="image_button hide" onclick="send_rematch()"><img src="/images/cycle.svg"></div>
</div>
<div class="grid_role">
diff --git a/ui.js b/ui.js
index d7655c1..75d97a4 100644
--- a/ui.js
+++ b/ui.js
@@ -38,8 +38,6 @@ function toggle_blocks() {
document.getElementById("map").classList.toggle("hide_blocks");
}
-let game = null;
-
let ui = {
cards: {},
areas: {},
@@ -475,7 +473,7 @@ function hide_block(element) {
ui.offmap_element.appendChild(element);
}
-function update_map(player) {
+function update_map() {
let overflow = { England: [], Scotland: [] };
let layout = {};
@@ -628,7 +626,7 @@ function update_cards() {
document.querySelector("#scotland_card").className = "small_card " + CARDS[game.s_card].image;
}
-function update_battle(player) {
+function update_battle() {
function fill_cell(name, list, reserve) {
let cell = window[name];
@@ -706,9 +704,7 @@ function update_battle(player) {
}
}
-function on_update(state, player) {
- game = state;
-
+function on_update() {
show_action_button("#undo_button", "undo");
show_action_button("#pass_button", "pass");
show_action_button("#play_event_button", "play_event");
@@ -729,7 +725,7 @@ function on_update(state, player) {
document.getElementById("scotland_vp").textContent = game.s_vp;
update_cards();
- update_map(player);
+ update_map();
if (game.actions && game.actions.noble) {
document.querySelector(".herald").classList.add("show");
@@ -748,7 +744,7 @@ function on_update(state, player) {
document.querySelector(".battle_header").textContent = game.battle.title;
document.querySelector(".battle_message").textContent = game.battle.flash;
document.querySelector(".battle").classList.add("show");
- update_battle(player);
+ update_battle();
} else {
document.querySelector(".battle").classList.remove("show");
}