-
Notifications
You must be signed in to change notification settings - Fork 0
/
elementsModel.go
251 lines (212 loc) · 6.21 KB
/
elementsModel.go
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
package sonolusgo
type SonolusCategory int
const (
CategoryPostItem SonolusCategory = iota
CategoryPlaylist
CategoryLevels
CategorySkins
CategoryBackgrounds
CategoryEffect
CategoryParticle
CategoryEngine
CategoryReplayItem
TotalCategoryCnt
)
type SonolusItem interface {
Post | Playlist | Level | Skin | Background | Effect | Particle | Engine | Replay
GetName() string
GetCategory() SonolusCategory
}
type SRL struct {
Hash string `json:"hash"`
Url string `json:"url"`
}
type Tag struct {
Title string `json:"title"`
Icon string `json:"icon,omitempty"`
}
type SonolusItemBase struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
}
type Skin struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Texture SRL `json:"texture"`
}
func (item Skin) GetName() string {
return item.Name
}
func (item Skin) GetCategory() SonolusCategory {
return CategorySkins
}
type Background struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Image SRL `json:"image"`
Configuration SRL `json:"configuration"`
}
func (item Background) GetName() string {
return item.Name
}
func (item Background) GetCategory() SonolusCategory {
return CategoryBackgrounds
}
type Effect struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Audio SRL `json:"audio"`
}
func (item Effect) GetName() string {
return item.Name
}
func (item Effect) GetCategory() SonolusCategory {
return CategoryEffect
}
type Particle struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Texture SRL `json:"texture"`
}
func (item Particle) GetName() string {
return item.Name
}
func (item Particle) GetCategory() SonolusCategory {
return CategoryParticle
}
type Engine struct {
SonolusItemBase
Skin Skin `json:"skin"`
Background Background `json:"background"`
Effect Effect `json:"effect"`
Particle Particle `json:"particle"`
Thumbnail SRL `json:"thumbnail"`
PlayData SRL `json:"playData"`
WatchData SRL `json:"watchData"`
PreviewData SRL `json:"previewData"`
TutorialData SRL `json:"tutorialData"`
Rom *SRL `json:"rom,omitempty"`
Configuration SRL `json:"configuration"`
}
func (item Engine) GetName() string {
return item.Name
}
func (item Engine) GetCategory() SonolusCategory {
return CategoryEngine
}
type UseItem[ItemType Skin | Background | Effect | Particle] struct {
UseDefault bool `json:"useDefault"`
Item *ItemType `json:"item"`
}
type Level struct {
Name string `json:"name"`
Source string `json:"source"`
Version int `json:"version"`
Rating int `json:"rating"`
Title string `json:"title"`
Artists string `json:"artists"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Engine Engine `json:"engine"`
UseSkin UseItem[Skin] `json:"useSkin"`
UseBackground UseItem[Background] `json:"useBackground"`
UseEffect UseItem[Effect] `json:"useEffect"`
UseParticle UseItem[Particle] `json:"useParticle"`
Cover SRL `json:"cover"`
Bgm SRL `json:"bgm"`
Preview *SRL `json:"preview,omitempty"`
Data SRL `json:"data"`
}
func (item Level) GetName() string {
return item.Name
}
func (item Level) GetCategory() SonolusCategory {
return CategoryLevels
}
type Playlist struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Levels []Level `json:"levels"`
Thumbnail SRL `json:"thumbnail"`
}
func (item Playlist) GetName() string {
return item.Name
}
func (item Playlist) GetCategory() SonolusCategory {
return CategoryPlaylist
}
type Post struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
Time string `json:"time"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Thumbnail SRL `json:"thumbnail"`
}
func (item Post) GetName() string {
return item.Name
}
func (item Post) GetCategory() SonolusCategory {
return CategoryPostItem
}
type Replay struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Levels []Level `json:"levels"`
Data SRL `json:"data"`
Thumbnail SRL `json:"thumbnail"`
}
func (item Replay) GetName() string {
return item.Name
}
func (item Replay) GetCategory() SonolusCategory {
return CategoryReplayItem
}
type ItemList[ItemType SonolusItem] struct {
PageCount int `json:"pageCount"`
Items []ItemType `json:"items"`
Searches ServerOptionSection `json:"searches"`
}
type ItemSection[ItemType SonolusItem] struct {
Title string `json:"title"`
Items []ItemType `json:"items"`
Icon string `json:"icon"`
}
type ItemDetail[ItemType SonolusItem] struct {
Item ItemType `json:"item"`
Description string `json:"description"`
Sections []ItemSection[ItemType] `json:"sections"`
}
type ItemInfo[ItemType SonolusItem] struct {
Banner SRL `json:"banner"`
Sections []ItemSection[ItemType] `json:"sections"`
Searches []ServerOptionSection `json:"searches"`
}
type ServerInfo struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
HasAuthentication bool `json:"hasAuthentication"`
HasMultiplayer bool `json:"hasMultiplayer"`
Banner SRL `json:"banner"`
}