DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

dcccd6654f5cee09b8483d859511e16f9898c9e6 — Jonni Liljamo 1 year, 9 months ago 7cd43d4
feat(shared): add auth message
2 files changed, 30 insertions(+), 1 deletions(-)

A shared/src/server/messages/auth.rs
M shared/src/server/messages/mod.rs
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>();
    }
}