You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
911 B
39 lines
911 B
|
|
use super::{action::Action, User, LobbyId, MatchId};
|
|
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),
|
|
}
|
|
|