diff options
Diffstat (limited to 'src/client/games/manager.rs')
| -rw-r--r-- | src/client/games/manager.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/client/games/manager.rs b/src/client/games/manager.rs index b20ff44..bb2a8b5 100644 --- a/src/client/games/manager.rs +++ b/src/client/games/manager.rs | |||
| @@ -55,7 +55,7 @@ impl GameManager { | |||
| 55 | ); | 55 | ); |
| 56 | data.insert("chip".to_string(), "10".to_string()); | 56 | data.insert("chip".to_string(), "10".to_string()); |
| 57 | data.insert("status".to_string(), "place".to_string()); | 57 | data.insert("status".to_string(), "place".to_string()); |
| 58 | data.insert("number_input".to_string(), String::new()); | 58 | data.insert("cursor".to_string(), "lattice:0:3".to_string()); |
| 59 | 0 | 59 | 0 |
| 60 | } else if game_type == "blackjack" { | 60 | } else if game_type == "blackjack" { |
| 61 | data.insert("status".to_string(), "ready".to_string()); | 61 | data.insert("status".to_string(), "ready".to_string()); |
| @@ -234,11 +234,19 @@ impl GameManager { | |||
| 234 | } | 234 | } |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | pub fn set_roulette_number_input(&mut self, value: &str) { | 237 | pub fn roulette_cursor(&self) -> crate::client::games::roulette::Cursor { |
| 238 | self.current_session | ||
| 239 | .as_ref() | ||
| 240 | .and_then(|session| session.data.get("cursor")) | ||
| 241 | .map(|raw| crate::client::games::roulette::Cursor::parse(raw)) | ||
| 242 | .unwrap_or_default() | ||
| 243 | } | ||
| 244 | |||
| 245 | pub fn set_roulette_cursor(&mut self, cursor: &crate::client::games::roulette::Cursor) { | ||
| 238 | if let Some(session) = self.current_session.as_mut() { | 246 | if let Some(session) = self.current_session.as_mut() { |
| 239 | session | 247 | session |
| 240 | .data | 248 | .data |
| 241 | .insert("number_input".to_string(), value.to_string()); | 249 | .insert("cursor".to_string(), cursor.encoded()); |
| 242 | } | 250 | } |
| 243 | } | 251 | } |
| 244 | 252 | ||
| @@ -274,9 +282,6 @@ impl GameManager { | |||
| 274 | session | 282 | session |
| 275 | .data | 283 | .data |
| 276 | .insert("status".to_string(), "result".to_string()); | 284 | .insert("status".to_string(), "result".to_string()); |
| 277 | session | ||
| 278 | .data | ||
| 279 | .insert("number_input".to_string(), String::new()); | ||
| 280 | } | 285 | } |
| 281 | 286 | ||
| 282 | pub fn apply_blackjack_state(&mut self, state: BlackjackState) { | 287 | pub fn apply_blackjack_state(&mut self, state: BlackjackState) { |
