mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-27 19:20:44 +01:00
feat: add messages enums
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
mod board;
|
pub mod board;
|
||||||
pub mod game_master;
|
pub mod game_master;
|
||||||
mod math;
|
pub mod math;
|
||||||
mod player;
|
mod player;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
mod logic;
|
mod logic;
|
||||||
|
mod network;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
|
|||||||
0
src/network/client.rs
Normal file
0
src/network/client.rs
Normal file
0
src/network/connection.rs
Normal file
0
src/network/connection.rs
Normal file
31
src/network/message.rs
Normal file
31
src/network/message.rs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::logic::{
|
||||||
|
board::{
|
||||||
|
board::Board,
|
||||||
|
pawn::{CapturePath, MovePath},
|
||||||
|
},
|
||||||
|
game_master::GameResult,
|
||||||
|
math::position::Position,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub enum ServerMessage {
|
||||||
|
RequestHandshake,
|
||||||
|
AcceptHandshake { player_id: Uuid },
|
||||||
|
DeclineHandshake { reason: String },
|
||||||
|
|
||||||
|
AvailableCaptures { captures: Vec<CapturePath> },
|
||||||
|
AvailableMoves { moves: Vec<MovePath> },
|
||||||
|
|
||||||
|
BroadcastBoardState { board: Board },
|
||||||
|
BroadcastCurrentTurn { active_player: Uuid },
|
||||||
|
|
||||||
|
GameEnd { result: GameResult },
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum ClientMessage {
|
||||||
|
AnswerHandshake { player_name: String },
|
||||||
|
|
||||||
|
RequestCapture { capture_path: CapturePath },
|
||||||
|
RequestMove { from: Position, to: Position },
|
||||||
|
}
|
||||||
4
src/network/mod.rs
Normal file
4
src/network/mod.rs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
mod client;
|
||||||
|
mod connection;
|
||||||
|
mod message;
|
||||||
|
mod server;
|
||||||
0
src/network/server.rs
Normal file
0
src/network/server.rs
Normal file
Reference in New Issue
Block a user