shared/domain/module/body/legacy/
activity.rs

1use crate::domain::module::body::_groups::design::{TraceShape, YoutubeUrl};
2use serde::{Deserialize, Serialize};
3use serde_with::skip_serializing_none;
4
5#[derive(Serialize, Deserialize, Debug, Clone)]
6#[serde(rename_all = "snake_case")]
7pub enum Activity {
8    AskQuestions(AskQuestions),
9    SaySomething(SaySomething),
10    Soundboard(Soundboard),
11    Video(Video),
12    Puzzle(Puzzle),
13    TalkType(TalkType),
14}
15
16#[derive(Serialize, Deserialize, Debug, Clone)]
17pub struct AskQuestions {
18    pub items: Vec<QuestionItem>,
19}
20
21#[derive(Serialize, Deserialize, Debug, Clone)]
22pub struct QuestionItem {
23    pub question_filename: Option<String>,
24    pub answer_filename: Option<String>,
25    pub wrong_filename: Option<String>,
26    pub hotspot: Hotspot,
27}
28
29#[skip_serializing_none]
30#[derive(Serialize, Deserialize, Debug, Clone)]
31pub struct SaySomething {
32    pub advance_trigger: AdvanceTrigger,
33
34    pub audio_filename: Option<String>,
35
36    pub advance_index: Option<usize>,
37}
38
39#[skip_serializing_none]
40#[derive(Serialize, Deserialize, Debug, Clone)]
41pub struct Soundboard {
42    pub audio_filename: Option<String>,
43    pub bg_audio_filename: Option<String>,
44    /// this isn't actually used for anything
45    pub highlight_color: Option<String>,
46    /// this isn't actually used for anything
47    pub one_at_a_time: bool,
48    pub show_hints: bool,
49    pub items: Vec<SoundboardItem>,
50}
51
52#[skip_serializing_none]
53#[derive(Serialize, Deserialize, Debug, Clone)]
54pub struct SoundboardItem {
55    pub audio_filename: Option<String>,
56    pub text: Option<String>,
57    pub jump_index: Option<usize>,
58    pub hotspot: Hotspot,
59}
60
61#[skip_serializing_none]
62#[derive(Serialize, Deserialize, Debug, Clone)]
63pub struct Video {
64    pub transform_matrix: Option<[f64; 16]>,
65    pub src: VideoSource,
66    pub range: Option<(f64, f64)>,
67}
68#[derive(Serialize, Deserialize, Debug, Clone)]
69#[serde(rename_all = "snake_case")]
70pub enum VideoSource {
71    Youtube(YoutubeUrl),
72    Direct(String),
73}
74
75#[skip_serializing_none]
76#[derive(Serialize, Deserialize, Debug, Clone)]
77pub struct Puzzle {
78    pub audio_filename: Option<String>,
79    pub jump_index: Option<usize>,
80    pub fly_back_to_origin: bool,
81    pub show_preview: bool,
82    // doesn't seem to have any effect anywhere...
83    pub show_hints: bool,
84    // on ipad it's 3d bevel, but on web app nothing, so nothing..
85    pub theme: PuzzleTheme,
86    pub items: Vec<PuzzleItem>,
87}
88#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
89#[serde(rename_all = "snake_case")]
90pub enum PuzzleTheme {
91    Regular,
92    Extrude,
93}
94
95#[skip_serializing_none]
96#[derive(Serialize, Deserialize, Debug, Clone)]
97pub struct PuzzleItem {
98    pub audio_filename: Option<String>,
99    pub hotspot: Hotspot,
100}
101
102#[skip_serializing_none]
103#[derive(Serialize, Deserialize, Debug, Clone)]
104pub struct TalkType {
105    pub audio_filename: Option<String>,
106    pub jump_index: Option<usize>,
107    pub show_hints: bool,
108    pub items: Vec<TalkTypeItem>,
109}
110
111#[skip_serializing_none]
112#[derive(Serialize, Deserialize, Debug, Clone)]
113pub struct TalkTypeItem {
114    pub texts: Option<Vec<String>>,
115    pub audio_filename: Option<String>,
116    pub answer_kind: TalkTypeAnswerKind,
117    pub input_language: Option<String>,
118    pub hotspot: Hotspot,
119}
120#[derive(Serialize, Deserialize, Debug, Clone)]
121#[serde(rename_all = "snake_case")]
122pub enum TalkTypeAnswerKind {
123    Text,
124    Audio,
125}
126
127////////// used in multiple activities
128#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
129#[serde(rename_all = "snake_case")]
130pub enum AdvanceTrigger {
131    AudioEnd,
132    Tap,
133}
134
135#[skip_serializing_none]
136#[derive(Serialize, Deserialize, Debug, Clone)]
137pub struct Hotspot {
138    pub shape: TraceShape,
139    pub transform_matrix: Option<[f64; 16]>,
140}