1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::BlendMode;
use crate::ColorTransformWithAlpha;
use crate::Filter;
use crate::Matrix;

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub struct ButtonRecord {
  pub state_hit_test: bool,
  pub state_down: bool,
  pub state_over: bool,
  pub state_up: bool,
  pub character_id: u16,
  pub depth: u16,
  pub matrix: Matrix,
  #[serde(skip_serializing_if = "Option::is_none")]
  pub color_transform: Option<ColorTransformWithAlpha>,
  pub filters: Vec<Filter>,
  pub blend_mode: BlendMode,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub struct ButtonCondAction {
  #[serde(skip_serializing_if = "Option::is_none")]
  pub conditions: Option<ButtonCond>,
  pub actions: Vec<u8>,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub struct ButtonCond {
  pub idle_to_over_down: bool,
  pub out_down_to_idle: bool,
  pub out_down_to_over_down: bool,
  pub over_down_to_out_down: bool,
  pub over_down_to_over_up: bool,
  pub over_up_to_over_down: bool,
  pub over_up_to_idle: bool,
  pub idle_to_over_up: bool,
  pub over_down_to_idle: bool,
  #[serde(skip_serializing_if = "Option::is_none")]
  pub key_press: Option<u32>,
}