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

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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
use crate::domain::module::body::_groups::design::{TraceShape, YoutubeUrl};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
pub enum Activity {
    AskQuestions(AskQuestions),
    SaySomething(SaySomething),
    Soundboard(Soundboard),
    Video(Video),
    Puzzle(Puzzle),
    TalkType(TalkType),
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AskQuestions {
    pub items: Vec<QuestionItem>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct QuestionItem {
    pub question_filename: Option<String>,
    pub answer_filename: Option<String>,
    pub wrong_filename: Option<String>,
    pub hotspot: Hotspot,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SaySomething {
    pub advance_trigger: AdvanceTrigger,

    pub audio_filename: Option<String>,

    pub advance_index: Option<usize>,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Soundboard {
    pub audio_filename: Option<String>,
    pub bg_audio_filename: Option<String>,
    /// this isn't actually used for anything
    pub highlight_color: Option<String>,
    /// this isn't actually used for anything
    pub one_at_a_time: bool,
    pub show_hints: bool,
    pub items: Vec<SoundboardItem>,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SoundboardItem {
    pub audio_filename: Option<String>,
    pub text: Option<String>,
    pub jump_index: Option<usize>,
    pub hotspot: Hotspot,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Video {
    pub transform_matrix: Option<[f64; 16]>,
    pub src: VideoSource,
    pub range: Option<(f64, f64)>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
pub enum VideoSource {
    Youtube(YoutubeUrl),
    Direct(String),
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Puzzle {
    pub audio_filename: Option<String>,
    pub jump_index: Option<usize>,
    pub fly_back_to_origin: bool,
    pub show_preview: bool,
    // doesn't seem to have any effect anywhere...
    pub show_hints: bool,
    // on ipad it's 3d bevel, but on web app nothing, so nothing..
    pub theme: PuzzleTheme,
    pub items: Vec<PuzzleItem>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum PuzzleTheme {
    Regular,
    Extrude,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PuzzleItem {
    pub audio_filename: Option<String>,
    pub hotspot: Hotspot,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TalkType {
    pub audio_filename: Option<String>,
    pub jump_index: Option<usize>,
    pub show_hints: bool,
    pub items: Vec<TalkTypeItem>,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TalkTypeItem {
    pub texts: Option<Vec<String>>,
    pub audio_filename: Option<String>,
    pub answer_kind: TalkTypeAnswerKind,
    pub input_language: Option<String>,
    pub hotspot: Hotspot,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
pub enum TalkTypeAnswerKind {
    Text,
    Audio,
}

////////// used in multiple activities
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum AdvanceTrigger {
    AudioEnd,
    Tap,
}

#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Hotspot {
    pub shape: TraceShape,
    pub transform_matrix: Option<[f64; 16]>,
}