A shared/src/server/messages/auth.rs => shared/src/server/messages/auth.rs +24 -0
@@ 0,0 1,24 @@
+/*
+ * This file is part of laurelin/shared
+ * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
+ *
+ * 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(),
+ }
+ }
+}
M shared/src/server/messages/mod.rs => shared/src/server/messages/mod.rs +6 -1
@@ 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::<Auth>();
+ }
}