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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Defs {
pub layers: Vec<Layer>,
pub entities: Vec<Entity>,
pub tilesets: Vec<TileSet>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Layer {
#[serde(rename = "__type")]
pub __type: String,
pub identifier: String,
#[serde(rename = "type")]
pub layer_type: String,
pub uid: i32,
pub grid_size: i32,
pub display_opacity: f32,
pub px_offset_x: i32,
pub px_offset_y: i32,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Entity {
pub identifier: String,
pub uid: i32,
pub width: i32,
pub height: i32,
pub color: String,
pub render_mode: String,
pub show_name: bool,
pub tileset_id: Option<i32>,
pub tile_id: Option<i32>,
pub tile_render_mode: String,
pub max_per_level: i32,
pub limit_behavior: String,
pub pivot_x: f32,
pub pivot_y: f32,
pub field_defs: Vec<FieldDefs>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TileSet {
pub identifier: String,
pub uid: i32,
pub rel_path: String,
pub px_wid: i32,
pub px_hei: i32,
pub tile_grid_size: i32,
pub spacing: i32,
pub padding: i32,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct FieldDefs {
pub identifier: String,
#[serde(rename = "__type")]
pub __type: String,
pub uid: i32,
pub is_array: bool,
pub can_be_null: bool,
pub array_min_length: Option<i32>,
pub array_max_length: Option<i32>,
}