From 12226c7a3a50d5d512cdedac522c24bc33692aa9 Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sun, 13 Oct 2024 17:35:45 +1300 Subject: [PATCH 1/4] diff key for displaying encounter info --- src/clj/web/auth.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clj/web/auth.clj b/src/clj/web/auth.clj index d05545fcd1..75949fafe2 100644 --- a/src/clj/web/auth.clj +++ b/src/clj/web/auth.clj @@ -162,7 +162,8 @@ (defn profile-keys [] [:background :pronouns :language :default-format :show-alt-art :blocked-users :alt-arts :card-resolution :deckstats :gamestats :card-zoom :pin-zoom - :card-back :stacked-cards :ghost-trojans :sides-overlap :archives-sorted :heap-sorted + :card-back :stacked-cards :ghost-trojans :display-encounter-info + :sides-overlap :archives-sorted :heap-sorted :labeled-cards :labeled-unrezzed-cards :bespoke-sounds]) (defn update-profile-handler From ccb50d4912fa566956479c93d9eefdd13104a758 Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sun, 13 Oct 2024 17:36:03 +1300 Subject: [PATCH 2/4] account key for displaying encounter div --- src/cljs/nr/account.cljs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cljs/nr/account.cljs b/src/cljs/nr/account.cljs index 69ad494409..d22503d57e 100644 --- a/src/cljs/nr/account.cljs +++ b/src/cljs/nr/account.cljs @@ -49,6 +49,7 @@ (swap! app-state assoc-in [:options :player-stats-icons] (:player-stats-icons @s)) (swap! app-state assoc-in [:options :stacked-cards] (:stacked-cards @s)) (swap! app-state assoc-in [:options :ghost-trojans] (:ghost-trojans @s)) + (swap! app-state assoc-in [:options :display-encounter-info] (:display-encounter-info @s)) (swap! app-state assoc-in [:options :sides-overlap] (:sides-overlap @s)) (swap! app-state assoc-in [:options :runner-board-order] (:runner-board-order @s)) (swap! app-state assoc-in [:options :log-width] (:log-width @s)) @@ -69,6 +70,7 @@ (.setItem js/localStorage "player-stats-icons" (:player-stats-icons @s)) (.setItem js/localStorage "stacked-cards" (:stacked-cards @s)) (.setItem js/localStorage "ghost-trojans" (:ghost-trojans @s)) + (.setItem js/localStorage "display-encounter-info" (:display-encounter-info @s)) (.setItem js/localStorage "sides-overlap" (:sides-overlap @s)) (.setItem js/localStorage "runner-board-order" (:runner-board-order @s)) (.setItem js/localStorage "card-back" (:card-back @s)) @@ -372,7 +374,13 @@ :value true :checked (:ghost-trojans @s) :on-change #(swap! s assoc-in [:ghost-trojans] (.. % -target -checked))}] - (tr [:settings.ghost-trojans "Display ghosts for hosted programs"])]] + (tr [:settings.display-encounter-info "Display ghosts for hosted programs"])]] + [:div + [:label [:input {:type "checkbox" + :value true + :checked (:display-encounter-info @s) + :on-change #(swap! s assoc-in [:display-encounter-info] (.. % -target -checked))}] + (tr [:settings.display-encounter-info "Always display encounter info dialog"])]] [:div [:label [:input {:type "checkbox" :value true @@ -575,7 +583,7 @@ [api-keys s] - [:section + [:section [:span.flash-message (:flash-message @s)]]]])})) (defn account [] @@ -600,6 +608,7 @@ :card-resolution (get-in @app-state [:options :card-resolution]) :stacked-cards (get-in @app-state [:options :stacked-cards]) :ghost-trojans (get-in @app-state [:options :ghost-trojans]) + :display-encounter-info (get-in @app-state [:options :display-encounter-info]) :sides-overlap (get-in @app-state [:options :sides-overlap]) :player-stats-icons (get-in @app-state [:options :player-stats-icons]) :runner-board-order (get-in @app-state [:options :runner-board-order]) From 247e61706b1ecbf0d321e560df163fd57cc8eda9 Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sun, 13 Oct 2024 17:37:12 +1300 Subject: [PATCH 3/4] display encounter info div during encounter if option is set - can also fire subs from this view --- src/cljs/nr/gameboard/board.cljs | 36 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/cljs/nr/gameboard/board.cljs b/src/cljs/nr/gameboard/board.cljs index d7e5f5e4e3..e20c5a8505 100644 --- a/src/cljs/nr/gameboard/board.cljs +++ b/src/cljs/nr/gameboard/board.cljs @@ -580,17 +580,27 @@ (doall (map-indexed (fn [i sub] - [:div {:key i} - [:span (cond (:broken sub) - {:class :disabled - :style {:font-style :italic}} - (false? (:resolve sub)) - {:class :dont-resolve - :style {:text-decoration :line-through}}) - (render-icons (str " [Subroutine] " (:label sub)))] - [:span.float-right - (cond (:broken sub) banned-span - (:fired sub) "✅")]]) + (let [fire-sub #(when (= :corp (:side @game-state)) + (send-command "subroutine" {:card ice + :subroutine i}) + (close-card-menu))] + [:div {:key i + :tab-index 0 + :on-click fire-sub + :on-key-down #(when (= "Enter" (.-key %)) + (fire-sub)) + :on-key-up #(when (= " " (.-key %)) + (fire-sub))} + [:span (cond (:broken sub) + {:class :disabled + :style {:font-style :italic}} + (false? (:resolve sub)) + {:class :dont-resolve + :style {:text-decoration :line-through}}) + (render-icons (str " [Subroutine] " (:label sub)))] + [:span.float-right + (cond (:broken sub) banned-span + (:fired sub) "✅")]])) subroutines))])) (defn card-abilities [card abilities subroutines] @@ -1430,7 +1440,7 @@ :on-mouse-out #(card-highlight-mouse-out % ice button-channel)} (tr [:game.encounter-ice "Encounter ice"]) ": " (render-message (get-title ice))] [:hr] - (when (:button @app-state) + (when (or (:button @app-state) (get-in @app-state [:options :display-encounter-info])) [encounter-info-div ice])]) (when @run [:h4 (tr [:game.current-phase "Current phase"]) ":" [:br] (get phase->title (:phase @run) (tr [:game.unknown-phase "Unknown phase"]))]) @@ -1500,7 +1510,7 @@ :on-mouse-out #(card-highlight-mouse-out % ice button-channel)} (tr [:game.encounter-ice "Encounter ice"]) ": " (render-message (get-title ice))] [:hr] - (when (:button @app-state) + (when (or (:button @app-state) (get-in @app-state [:options :display-encounter-info])) [encounter-info-div ice])]) (when @run [:h4 (tr [:game.current-phase "Current phase"]) ":" [:br] (get phase->title phase)]) From 9ef62e3e6d0b3723470078736c1117da6f8cb505 Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sun, 13 Oct 2024 17:37:48 +1300 Subject: [PATCH 4/4] in-game setting for displaying encounter info div --- src/cljs/nr/gameboard/settings.cljs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cljs/nr/gameboard/settings.cljs b/src/cljs/nr/gameboard/settings.cljs index 99c00b3741..ce68ca5e76 100644 --- a/src/cljs/nr/gameboard/settings.cljs +++ b/src/cljs/nr/gameboard/settings.cljs @@ -32,7 +32,13 @@ :value true :checked (get-in @app-state [:options :ghost-trojans]) :on-change #(swap! app-state assoc-in [:options :ghost-trojans] (.. % -target -checked))}] - (tr [:ingame-settings.ghost-trojans "Display hosted trojans in rig"])]]] + (tr [:ingame-settings.ghost-trojans "Display hosted trojans in rig"])]] + [:div + [:label [:input {:type "checkbox" + :value true + :checked (get-in @app-state [:options :display-encounter-info]) + :on-change #(swap! app-state assoc-in [:options :display-encounter-info] (.. % -target -checked))}] + (tr [:ingame-settings.display-encounter-info "Always display encounter info"])]]] [:section [:h4 (tr [:ingame-settings.card-sorting "Sorting"])]