aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-core/src/wire/req.rs
blob: be5c905795a9893afa624b13f78585e6f7b13472 (plain)
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
use super::{game::Action, LobbyId, MatchId, User};
use serde::{Deserialize, Serialize};

/// A message sent from the game client to the server
#[derive(Serialize, Deserialize)]
pub enum Request {
    /// Register yourself with the game server
    Register(String, String),

    /// Login to your user session
    ///
    /// This user can't log into the system from another computer
    Login(String, String),

    /// Close your user session
    Logout(User),

    /// Start an anonymous session
    Anonymous(String),

    /// A user joins a game lobby
    Join(User, LobbyId),

    /// A user leaves a game lobby
    Leave(User, LobbyId),

    /// Mark a user as ready
    Ready(User, LobbyId, bool),

    /// Try to start the match
    StartReq(User, LobbyId),

    /// Send a move in the game
    GameAction(User, MatchId, Action),

    /// Leave the match (forfeit)
    LeaveGame(User, MatchId),
}