···11//! Events that animations unique to each environment.
22+//!
33+//! Unlike the other V3 group event types, FX events use a template-like JSON syntax.
44+//! In order to have standardized structure across all V3 events, custom serialization has been written in [`FxEventContainer`].
55+//! Because of this, neither [`FxEventBox`] nor [`FxEventGroup`] implement [`Serialize`] nor [`Deserialize`].
2637use crate::difficulty::lightshow::DistributionType;
48use crate::difficulty::lightshow::easing::Easing;
···812use serde::ser::SerializeStruct;
913use serde::{Deserialize, Deserializer, Serialize, Serializer};
10141515+/// Contains a list of [`FxEventBox`] as well as the [`Serialize`] and [`Deserialize`] implementations for FX events.
1116#[derive(Debug, Clone, PartialEq, Default)]
1217#[cfg_attr(
1318 feature = "bevy_reflect",
···140145}
141146142147/// A collection of [`FxEventGroup`]s that share the same group ID and beat.
148148+///
149149+/// Does not implement [`Serialize`] nor [`Deserialize`]. For more info, see the [module docs](super::fx).
143150#[derive(Debug, Clone, PartialEq)]
144151#[cfg_attr(
145152 feature = "bevy_reflect",
···154161 pub groups: Vec<FxEventGroup>,
155162}
156163164164+/// The raw JSON structure that uses [data IDs](self::data_ids) rather than actual [event data](FxEventData).
157165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
158158-pub struct FxEventBoxRaw {
166166+struct FxEventBoxRaw {
159167 #[serde(rename = "b")]
160160- pub beat: f32,
168168+ beat: f32,
161169 #[serde(rename = "g")]
162162- pub group_id: i32,
170170+ group_id: i32,
163171 #[serde(rename = "e")]
164164- pub groups: Vec<FxEventGroupRaw>,
172172+ groups: Vec<FxEventGroupRaw>,
165173}
166174167175impl Default for FxEventBox {
···178186impl_event_box!(FxEventBox, FxEventGroup, FxEventData);
179187180188/// A collection of [`FxEventData`] that share the same [`Filter`] and distribution.
189189+///
190190+/// Does not implement [`Serialize`] nor [`Deserialize`]. For more info, see the [module docs](super::fx).
181191#[derive(Debug, Clone, PartialEq)]
182192#[cfg_attr(
183193 feature = "bevy_reflect",
···199209 /// Whether the first [`FxEventData`] of the group will be effected by brightness distribution.
200210 pub fx_dist_effect_first: LooseBool,
201211 pub fx_dist_easing: Option<Easing>,
212212+ /// In the actual JSON structure, this is a list of indexes to a separate list of event data.
213213+ /// For consistency, this is merged during parsing.
202214 pub data: Vec<FxEventData>,
203215}
204216217217+/// The raw JSON structure that uses [data IDs](self::data_ids) rather than actual [event data](FxEventData).
205218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
206206-pub struct FxEventGroupRaw {
219219+struct FxEventGroupRaw {
207220 #[serde(rename = "f")]
208208- pub filter: Filter,
221221+ filter: Filter,
209222 #[serde(rename = "d")]
210210- pub beat_dist_type: DistributionType,
223223+ beat_dist_type: DistributionType,
211224 #[serde(rename = "w")]
212212- pub beat_dist_value: f32,
225225+ beat_dist_value: f32,
213226 #[serde(rename = "t")]
214214- pub fx_dist_type: DistributionType,
227227+ fx_dist_type: DistributionType,
215228 #[serde(rename = "s")]
216216- pub fx_dist_value: f32,
229229+ fx_dist_value: f32,
217230 #[serde(rename = "b")]
218218- pub fx_dist_effect_first: LooseBool,
231231+ fx_dist_effect_first: LooseBool,
219232 #[serde(rename = "i")]
220220- pub fx_dist_easing: Option<Easing>,
233233+ fx_dist_easing: Option<Easing>,
221234 #[serde(rename = "l")]
222222- pub data_ids: Vec<usize>,
235235+ data_ids: Vec<usize>,
223236}
224237225238impl Default for FxEventGroup {
···257270 }
258271}
259272260260-/// The lowest-level group event type, which determines the color of the event.
273273+/// The lowest-level group event type, which determines the base value of the event.
261274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
262275#[cfg_attr(
263276 feature = "bevy_reflect",
···446459447460 assert_eq!(container, roundtrip, "Round-trip did not match");
448461449449- println!("Round-trip serialization succeeded:\n{}", out_json);
462462+ println!("Round-trip serialization succeeded.");
450463 }
451464}