From eaaf0ab2b7fa008f0645fa6f36e6200fdf11387f Mon Sep 17 00:00:00 2001 From: emilis Date: Tue, 14 Oct 2025 17:51:25 +0100 Subject: [PATCH] seer false positives, player list styling --- werewolves-proto/src/role.rs | 28 ++++ werewolves/index.scss | 135 +++++++++++++----- werewolves/src/clients/host/host.rs | 18 ++- werewolves/src/components/action/wolves.rs | 6 +- .../src/components/attributes/align_span.rs | 26 +++- werewolves/src/components/icon.rs | 2 + werewolves/src/components/lobby.rs | 2 +- werewolves/src/pages/role_page/seer.rs | 46 ++++-- 8 files changed, 208 insertions(+), 55 deletions(-) diff --git a/werewolves-proto/src/role.rs b/werewolves-proto/src/role.rs index 754e5cc..c782286 100644 --- a/werewolves-proto/src/role.rs +++ b/werewolves-proto/src/role.rs @@ -404,12 +404,40 @@ impl Role { } } +impl RoleTitle { + pub fn falsely_appear_village() -> Box<[RoleTitle]> { + Self::ALL + .iter() + .copied() + .filter(|r| r.wolf() && r.alignment().village()) + .collect() + } + + pub fn falsely_appear_wolf() -> Box<[RoleTitle]> { + Self::ALL + .iter() + .copied() + .filter(|r| !r.wolf() && r.alignment().wolves()) + .collect() + } +} + #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] pub enum Alignment { Village, Wolves, } +impl Alignment { + pub const fn village(&self) -> bool { + matches!(self, Alignment::Village) + } + + pub const fn wolves(&self) -> bool { + matches!(self, Alignment::Wolves) + } +} + impl Display for Alignment { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/werewolves/index.scss b/werewolves/index.scss index 3774bf3..e5709e1 100644 --- a/werewolves/index.scss +++ b/werewolves/index.scss @@ -143,6 +143,32 @@ nav.debug-nav { } .player-list { + padding-bottom: 20px; + display: flex; + + gap: 10px; + justify-items: center; + justify-content: space-evenly; +} + +.targets { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; + align-content: center; + gap: 10px; + justify-content: space-evenly; + + &>* { + // min-width: 15vw; + // min-height: 12vh; + // font-size: 3em; + flex-grow: 1; + } +} + +.lobby-player-list { padding-bottom: 80px; display: flex; flex-direction: row; @@ -341,22 +367,28 @@ button { } .wolves-intro { - @extend .column-list; - align-content: center; - width: 100%; - - .wolves-list { - flex-wrap: wrap; - flex-direction: row; - justify-content: space-evenly; - flex: 1 1 0; - } - & button { align-self: center; } } +.wolves-list { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-evenly; + min-height: 70vh; + align-items: center; + + &>* { + height: max-content; + } + + .identity { + font-size: 1.5em; + } +} + .character { text-align: center; border: 3px solid rgba(0, 0, 0, 0.4); @@ -386,7 +418,8 @@ button { h1, h2, h3, -h4 { +h4, +h5 { text-align: center; } @@ -702,19 +735,26 @@ clients { padding-bottom: 5px; } -.box { - border: solid 3px; - border-color: #432054; +@media only screen and (max-width : 1899px) { + .content { + margin-left: 5vw; + margin-right: 5vw; + display: flex; + flex-basis: content; + } } -.content { - margin-left: 5vw; - margin-right: 5vw; - margin-top: 30px; - display: flex; - flex-basis: content; +@media only screen and (min-width : 1900px) { + .content { + margin-left: 5vw; + margin-right: 5vw; + display: flex; + flex-basis: content; + min-height: 100vh; + } } + .sp-ace { margin: 10px; } @@ -948,22 +988,13 @@ input { width: 100%; align-items: center; color: white; - height: 90vh; + height: 100%; + justify-content: center; $marked_bg: color.change($wolves_color, $alpha: 0.3); $marked_border: color.change($wolves_color, $alpha: 1.0); $village_bg: color.change($village_color, $alpha: 0.3); $village_border: color.change($village_color, $alpha: 1.0); - .targets { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: space-evenly; - align-items: center; - flex-grow: 1; - align-content: center; - } - .character { padding: 0.5cm; @@ -1688,3 +1719,43 @@ input { font-size: 2em; } } + +.two-column { + display: grid; + grid-template-columns: 3fr 2fr; +} + +.role-title-span { + display: grid; + grid-template-columns: 1fr 100fr; + max-height: 2rem; + width: fit-content; + + + padding-top: 5px; + padding-bottom: 5px; + padding-left: 5px; + padding-right: 10px; + + img { + vertical-align: text-bottom; + max-height: 2rem; + padding-left: 10px; + } + + text-align: center; +} + +.false-positives { + display: flex; + flex-direction: column; + flex-wrap: nowrap; + + gap: 10px; +} + +.bottom-bound { + display: flex; + flex-direction: column; + justify-content: center; +} diff --git a/werewolves/src/clients/host/host.rs b/werewolves/src/clients/host/host.rs index 166efea..86a3ea5 100644 --- a/werewolves/src/clients/host/host.rs +++ b/werewolves/src/clients/host/host.rs @@ -472,13 +472,17 @@ impl Component for Host { } }; - let s = _ctx.link().clone(); - let story_on_click = Callback::from(move |_| { - s.send_message(HostEvent::SetState(HostState::Story { - story: crate::clients::host::story_test::test_story(), - page: 0, - })); - }); + let story_on_click = if let HostState::Story { .. } = &self.state { + crate::callback::send_message(HostMessage::GetState, self.send.clone()) + } else { + let s = _ctx.link().clone(); + Callback::from(move |_| { + s.send_message(HostEvent::SetState(HostState::Story { + story: crate::clients::host::story_test::test_story(), + page: 0, + })); + }) + }; html! {