From dcccd6654f5cee09b8483d859511e16f9898c9e6 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Fri, 3 Mar 2023 09:40:03 +0200 Subject: [PATCH] feat(shared): add auth message --- shared/src/server/messages/auth.rs | 24 ++++++++++++++++++++++++ shared/src/server/messages/mod.rs | 7 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 shared/src/server/messages/auth.rs diff --git a/shared/src/server/messages/auth.rs b/shared/src/server/messages/auth.rs new file mode 100644 index 0000000..b81aac3 --- /dev/null +++ b/shared/src/server/messages/auth.rs @@ -0,0 +1,24 @@ +/* + * This file is part of laurelin/shared + * Copyright (C) 2023 Jonni Liljamo + * + * Licensed under GPL-3.0-only. + * See LICENSE for licensing information. + */ + +use naia_bevy_shared::Message; + +#[derive(Message)] +pub struct Auth { + pub email: String, + pub password: String, +} + +impl Auth { + pub fn new(email: &str, password: &str) -> Self { + Self { + email: email.to_string(), + password: password.to_string(), + } + } +} diff --git a/shared/src/server/messages/mod.rs b/shared/src/server/messages/mod.rs index 73d7061..bd9d99c 100644 --- a/shared/src/server/messages/mod.rs +++ b/shared/src/server/messages/mod.rs @@ -8,8 +8,13 @@ use naia_bevy_shared::{Protocol, ProtocolPlugin}; +mod auth; +pub use auth::Auth; + pub struct MessagesPlugin; impl ProtocolPlugin for MessagesPlugin { - fn build(&self, protocol: &mut Protocol) {} + fn build(&self, protocol: &mut Protocol) { + protocol.add_message::(); + } } -- 2.44.1