1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use crate::*;
use mem6_common::*;
use dodrio::{
builder::text,
bumpalo::{self, Bump},
Node,
};
use typed_html::dodrio;
pub fn div_player_actions_from_game_status<'a>(
rrc: &RootRenderingComponent,
bump: &'a Bump,
) -> Node<'a> {
if let GameStatus::Status1stCard = rrc.game_data.game_status {
status1stcardmod::div_on_1st_card(rrc, bump)
} else if let GameStatus::Status2ndCard = rrc.game_data.game_status {
status2ndcardmod::div_click_2nd_card(rrc, bump)
} else if let GameStatus::StatusGameOver = rrc.game_data.game_status {
statusgameovermod::div_game_over(rrc, bump)
} else if let GameStatus::StatusWaitingAckMsg = rrc.game_data.game_status {
statuswaitingackmsgmod::div_waiting_ack_msg(rrc, bump)
} else {
div_unpredicted(rrc, bump)
}
}
fn div_unpredicted<'a>(rrc: &RootRenderingComponent, bump: &'a Bump) -> Node<'a> {
dodrio!(bump,
<h2 >
{vec![text(bumpalo::format!(in bump, "gamestatus: {} player {}", rrc.game_data.game_status.as_ref(),rrc.game_data.my_player_number).into_bump_str())]}
</h2>
)
}