use crate::shared::activation::*; use crate::shared::area_of_effect::*; use crate::shared::champion::*; use crate::shared::cooldown::*; use crate::shared::health::*; use crate::shared::health_event::*; use crate::shared::imperative::*; use crate::shared::player::*; use crate::shared::projectile::*; use crate::shared::stats::*; use bevy::prelude::*; use lightyear::prelude::*; use serde::Deserialize; use serde::Serialize; #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub enum Inputs { Imperative(Imperative), Activation(Activation), None, } impl UserAction for Inputs {} #[derive(Message, Serialize, Deserialize, Clone, Debug, PartialEq)] pub struct SelectChampion(pub Champion); #[derive(Message, Serialize, Deserialize, Clone, Debug, PartialEq)] pub struct HealthChanged(pub HealthEvent); #[message_protocol(protocol = "MyProtocol")] pub enum Messages { SelectChampion(SelectChampion), HealthChanged(HealthChanged), } #[component_protocol(protocol = "MyProtocol")] pub enum Components { PlayerId(PlayerId), PlayerPosition(PlayerPosition), PlayerColor(PlayerColor), Projectile(Projectile), Cooldown(Cooldown), Health(Health), Champion(Champion), EffectiveStats(EffectiveStats), AreaOfEffect(AreaOfEffect), } #[derive(Channel)] pub struct Channel1; protocolize! { Self = MyProtocol, Message = Messages, Component = Components, Input = Inputs, } pub fn protocol() -> MyProtocol { let mut protocol = MyProtocol::default(); protocol.add_channel::(ChannelSettings { mode: ChannelMode::UnorderedReliable(Default::default()), ..Default::default() }); protocol }