-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgui.sk
More file actions
300 lines (282 loc) · 16.1 KB
/
gui.sk
File metadata and controls
300 lines (282 loc) · 16.1 KB
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
every ticks:
if {process} is set:
add 1 to {loadingTime}
set {_dots} to round({process} / 2)
set {_bar} to "&a"
loop {_dots} times:
set {_bar} to "%{_bar}%·"
set {_bar} to "%{_bar}%&7"
loop (50 - {_dots}) times:
set {_bar} to "%{_bar}%·"
send title "" with subtitle "&8%ceiling({loadingTime}/20)% %{_bar}%&8 %ceiling({loadingTime}/20)%" to all players for 1 second with fade in 0 seconds and fade out 0 seconds
else if {loadingTime} is set:
delete {loadingTime}
on load:
set {loaded} to true
function playChart(id: text):
set {noteID} to 0
set {process} to 0
delete {editorSave::*} if {editMode} is true
create section stored in {_sync}:
loop enabled scripts:
loop-value start with "charts"
if loop-value contains "_properties":
set {_null} to ""
else:
disable script loop-value
quitGame() if {editMode} is not true
run section {_sync} sync and wait
wait 1 tick
set {process} to 10
create section stored in {_async}:
enable script "charts\-%{_id}%"
run section {_async} async and wait
wait 1 tick
if {editMode} is true:
set {editor::bpm} to {bpm::%{_id}%}
set {editor::tick} to 0
set {editor::preTime} to 0
addTick({actor}, 0)
delete {process}
send title "" with subtitle "&a谱面已读取完毕" to all players for 1 second with fade in 0 seconds and fade out 0 seconds
else:
set {process} to 25
set {playing} to {_id}
wait 0.5 seconds
execute {actor} command "start"
delete {actor} if {editMode} is true
function refresh(p: player):
delete {loadedCharts::*}
delete {length::*}
delete {chartOffset::*}
loop enabled scripts:
loop-value start with "charts"
if loop-value contains "_properties":
disable script loop-value
wait 1 tick
loop disabled scripts:
loop-value start with "charts"
if loop-value contains "_properties":
enable script loop-value
wait 5 ticks
infoGUI({_p})
function registerChart(id: text, name: text, level: text, artist: text, author: text, length: number, offset: number):
add {_id} to {loadedCharts::id::*}
add {_name} to {loadedCharts::name::*}
add {_level} to {loadedCharts::level::*}
add {_artist} to {loadedCharts::artist::*}
add {_author} to {loadedCharts::author::*}
set {length::%{_id}%} to {_length}
set {chartOffset::%{_id}%} to {_offset}
function setBPM(id: text, bpm: number):
set {bpm::%{_id}%} to {_bpm}
command /play:
trigger:
player's gamemode is not spectator
if {loaded} is set:
delete {loaded}
refresh(player)
else:
infoGUI(player)
function infoGUI(p: player):
if {actor} is not set:
set {_infoGUI} to chest inventory with 6 rows named "选择谱面"
loop integers from 47 to 51:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
set slot 45 of {_infoGUI} to oak sign named "&f喜欢 &eCube Rhythm&f 吗?" with lore "&7加入我们的QQ群聊%nl%&b300846184%nl%&7和大家一起分享谱面!"
set slot 46 of {_infoGUI} to book named "&a◆ &f如何导入谱面?" with lore "%nl%&e1. &7打开目录 &f服务端\plugins\Skript\scripts\charts%nl%&e2. &7把谱面文件&f(谱面.sk 和 谱面_properties.sk)&7扔进去%nl%&e3. &7输入 &b/sk reload \charts\ &7稍等片刻即可导入%nl% &c(需要管理员权限 后台输入op %name of {_p}%)%nl%%nl%&a◆ &f如何写谱?%nl%%nl%&7请浏览:%nl%&7https://github.com/EroslonDusk/CubeRhythm/wiki%nl%&a"
set slot 52 of {_infoGUI} to comparator named "&f设置" with lore "%nl%&7包括调速、偏移等更多选项%nl%%nl%&e点击查看"
set slot 53 of {_infoGUI} to slime ball named "&a刷新列表" with lore "%nl%&7重载所有谱面配置文件并刷新列表%nl%&f如果你想导入新谱面,这个按钮并不能帮你%nl%%nl%&e点击刷新"
loop indices of {loadedCharts::id::*}:
set {_slot} to (loop-value parsed as integer) - 1
{_slot} is set
set {_best} to {best::%uuid of {_p}%::%{loadedCharts::id::%loop-value%}%}
set {_best} to 0 if {_best} is not set
set {_t} to "%{length::%{loadedCharts::id::%loop-value%}%}% seconds" parsed as timespan
set {_dura} to ({_t} from (unix date of 0)) formatted as "m:ss"
set {_bpm} to {bpm::%{loadedCharts::id::%loop-value%}%}
set {_bpm} to "&7未知" if {_bpm} is not set
delete {_char::*}
set {_tempnumber} to ""
set {_char::*} to (uncolored {loadedCharts::level::%loop-value%}) split at ""
loop {_char::*}:
set {_tempnumber} to "%{_tempnumber}%%loop-value-2%" if loop-value-2 is "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9"
set {_tempnumber} to {_tempnumber} parsed as number
set {_item} to music disc cat named "&f%{loadedCharts::name::%loop-value%}%" with lore "%nl%&8· &7难度: &f%{loadedCharts::level::%loop-value%}%%nl%&8· &7作曲: &f%{loadedCharts::artist::%loop-value%}%%nl%&8· &7谱师: &f%{loadedCharts::author::%loop-value%}%%nl%&8· &7时长: &f%{_dura}%%nl%&8· &7BPM: &f%{_bpm}%%nl%&8· &7最好成绩: &f%{_best}% &7%getRank({_best})%%nl%%nl%&7输入 /reset 离开游戏%nl%%nl%&8[&a左键&8] &f开始游玩%nl%&8[&d右键&8] &c删除成绩%nl%&f"
set item amount of {_item} to {_tempnumber} if {_tempnumber} > 0
set slot {_slot} of {_infoGUI} to {_item}
open {_infoGUI} to {_p}
else:
send "&c游戏期间不可打开面板!如果要退出游玩,请输入 /reset !%nl%&7如果游戏尚未开始,请输入 /sk reload main" to {_p}
function getRank(score: number) :: text:
return "&eSSS+" if {_score} >= 1000000
return "&eSSS" if {_score} is between 999999 and 990000
return "&eSS" if {_score} is between 989999 and 980000
return "&eS" if {_score} is between 979999 and 960000
return "&aAAA" if {_score} is between 959999 and 950000
return "&aAA" if {_score} is between 949999 and 940000
return "&aA" if {_score} is between 939999 and 930000
return "&bBBB" if {_score} is between 929999 and 920000
return "&bBB" if {_score} is between 919999 and 910000
return "&bB" if {_score} is between 909999 and 900000
return "&2C" if {_score} is between 899999 and 850000
return "&7D" if {_score} <= 849999
function deleteScoreGUI(id: text, p: player):
set metadata value "prepareToDelete" of {_p} to {_id}
set {_infoGUI} to chest inventory with 5 rows named "清除该曲成绩?"
loop integers from 0 to 7:
set slot loop-value of {_infoGUI} to red stained glass pane named ""
loop integers from 8 to 9:
set slot loop-value of {_infoGUI} to red stained glass pane named ""
loop integers from 17 to 18:
set slot loop-value of {_infoGUI} to red stained glass pane named ""
loop integers from 26 to 27:
set slot loop-value of {_infoGUI} to red stained glass pane named ""
loop integers from 35 to 44:
set slot loop-value of {_infoGUI} to red stained glass pane named ""
set slot 20 of {_infoGUI} to lime wool named "&a清除成绩" with lore "&c此操作无法撤销!"
set slot 24 of {_infoGUI} to red wool named "&c返回" with lore "&f选歌界面"
open {_infoGUI} to {_p}
function settingsGUI(p: player):
set {_infoGUI} to chest inventory with 6 rows named "设置"
loop integers from 0 to 7:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
loop integers from 8 to 9:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
loop integers from 17 to 18:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
loop integers from 26 to 27:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
loop integers from 35 to 36:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
loop integers from 44 to 52:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
set slot 20 of {_infoGUI} to feather named "&f音符流速: &e%{speed::%uuid of {_p}%}%" with lore "%nl%&7音符每Tick(1/20秒)移动的距离(米)%nl%&7推荐范围: 1~2.5%nl%&f过高或过低的流速会严重影响游戏体验%nl%%nl%&e点击修改"
set slot 21 of {_infoGUI} to clock named "&f偏移: &e%{offset::%uuid of {_p}%}%ms" with lore "%nl%&7单位: 毫秒(ms)%nl%&7偏移越高,音符生成越滞后,反之提前%nl%&7如果你遇到了音画不同步,请调整此项%nl%&f注意:第一次播放音画不同步属正常现象%nl%%nl%&e点击修改"
set slot 22 of {_infoGUI} to note block named "&f打击音效: %{hitSound::%uuid of {_p}%}%" with lore "%nl%&7击中音符时播放打击音效%nl%%nl%&e点击开启/关闭"
set slot 23 of {_infoGUI} to gold block named "&fFull Combo/Perfect指示器: %{indicator::%uuid of {_p}%}%" with lore "%nl%&7将连击数和分数区域%nl%&7根据您的游戏表现显示不同颜色%nl%%nl%&e点击开启/关闭"
set slot 24 of {_infoGUI} to piston named "&f自动演奏: %{autoPlay::%uuid of {_p}%}%" with lore "%nl%&7自动演奏歌曲,无需操作%nl%&f该模式下游玩成绩无效%nl%%nl%&e点击开启/关闭"
set slot 29 of {_infoGUI} to redstone named "&f在判定提示中显示偏移: %{showOffset::%uuid of {_p}%}%" with lore "%nl%&7替换打击特效中的Exact/Just字样为%nl%&7音符到达判定面时间与被击打时间的差值%nl%%nl%&e点击开启/关闭"
set slot 30 of {_infoGUI} to white concrete named "&f小节提示线: %{showLine::%uuid of {_p}%}%" with lore "%nl%&7在轨道两侧生成提示节拍的细线%nl%%nl%&e点击开启/关闭"
set slot 53 of {_infoGUI} to music disc cat named "&a选择谱面" with lore "%nl%&e点击返回"
open {_infoGUI} to {_p}
on inventory click:
"%current inventory of player%" is "inventory of <none>"
cancel event
if name of event-inventory is "选择谱面":
if index of event-slot < 45:
set {_slot} to index of event-slot + 1
if {loadedCharts::id::%{_slot}%} is set:
if inventory action is pickup half:
deleteScoreGUI({loadedCharts::id::%{_slot}%}, player)
else:
close player's inventory
playChart({loadedCharts::id::%{_slot}%})
set {actor} to player
else:
settingsGUI(player) if index of event-slot = 52
refresh(player) if event-slot is slime ball
set event-slot to barrier named "&c请稍等……" if index of event-slot = 53
if name of event-inventory is "设置":
setSpeedGUI(player) if index of event-slot = 20
setOffsetGUI(player) if index of event-slot = 21
setHitSound(player) if index of event-slot = 22
setIndicator(player) if index of event-slot = 23
setAutoPlay(player) if index of event-slot = 24
setShowOffset(player) if index of event-slot = 29
setLine(player) if index of event-slot = 30
infoGUI(player) if index of event-slot = 53
if name of event-inventory is "调速":
settingsGUI(player) if index of event-slot = 53
remove 0.5 from {speed::%uuid of player%} if index of event-slot = 19
setSpeedGUI(player) if index of event-slot = 19
remove 0.1 from {speed::%uuid of player%} if index of event-slot = 20
setSpeedGUI(player) if index of event-slot = 20
remove 0.01 from {speed::%uuid of player%} if index of event-slot = 21
setSpeedGUI(player) if index of event-slot = 21
add 0.5 to {speed::%uuid of player%} if index of event-slot = 25
setSpeedGUI(player) if index of event-slot = 25
add 0.1 to {speed::%uuid of player%} if index of event-slot = 24
setSpeedGUI(player) if index of event-slot = 24
add 0.01 to {speed::%uuid of player%} if index of event-slot = 23
setSpeedGUI(player) if index of event-slot = 23
if name of event-inventory is "偏移调整":
settingsGUI(player) if index of event-slot = 53
remove 50 from {offset::%uuid of player%} if index of event-slot = 19
setOffsetGUI(player) if index of event-slot = 19
remove 10 from {offset::%uuid of player%} if index of event-slot = 20
setOffsetGUI(player) if index of event-slot = 20
remove 1 from {offset::%uuid of player%} if index of event-slot = 21
setOffsetGUI(player) if index of event-slot = 21
add 50 to {offset::%uuid of player%} if index of event-slot = 25
setOffsetGUI(player) if index of event-slot = 25
add 10 to {offset::%uuid of player%} if index of event-slot = 24
setOffsetGUI(player) if index of event-slot = 24
add 1 to {offset::%uuid of player%} if index of event-slot = 23
setOffsetGUI(player) if index of event-slot = 23
if name of event-inventory is "清除该曲成绩?":
set {_id} to metadata value "prepareToDelete" of player
if index of event-slot = 20:
delete {best::%uuid of player%::%{_id}%}
delete metadata value "prepareToDelete" of player
close player's inventory
send "&a清除成绩成功" to player
if index of event-slot = 24:
infoGUI(player)
delete metadata value "prepareToDelete" of player
function setSpeedGUI(p: player):
set {_infoGUI} to chest inventory with 6 rows named "调速"
loop integers from 45 to 52:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
set slot 53 of {_infoGUI} to comparator named "&a设置" with lore "%nl%&e点击返回"
set slot 19 of {_infoGUI} to 50 orange stained glass panes named "&6-0.5" with lore "&7当前: %{speed::%uuid of {_p}%}%"
set slot 20 of {_infoGUI} to 10 orange stained glass panes named "&6-0.1" with lore "&7当前: %{speed::%uuid of {_p}%}%"
set slot 21 of {_infoGUI} to 1 orange stained glass pane named "&6-0.01" with lore "&7当前: %{speed::%uuid of {_p}%}%"
set slot 22 of {_infoGUI} to feather named "&f音符流速: &e%{speed::%uuid of {_p}%}%" with lore "%nl%&7音符每Tick(1/20秒)移动的距离(米)%nl%&7推荐范围: 1~2.5%nl%&f过高或过低的流速会严重影响游戏体验"
set slot 25 of {_infoGUI} to 50 light blue stained glass panes named "&b+0.5" with lore "&7当前: %{speed::%uuid of {_p}%}%"
set slot 24 of {_infoGUI} to 10 light blue stained glass panes named "&b+0.1" with lore "&7当前: %{speed::%uuid of {_p}%}%"
set slot 23 of {_infoGUI} to 1 light blue stained glass pane named "&b+0.01" with lore "&7当前: %{speed::%uuid of {_p}%}%"
open {_infoGUI} to {_p}
function setOffsetGUI(p: player):
set {_infoGUI} to chest inventory with 6 rows named "偏移调整"
loop integers from 45 to 52:
set slot loop-value of {_infoGUI} to gray stained glass pane named ""
set slot 53 of {_infoGUI} to comparator named "&a设置" with lore "%nl%&e点击返回"
set slot 19 of {_infoGUI} to 50 orange stained glass panes named "&6-50" with lore "&7当前: %{offset::%uuid of {_p}%}%ms"
set slot 20 of {_infoGUI} to 10 orange stained glass panes named "&6-10" with lore "&7当前: %{offset::%uuid of {_p}%}%ms"
set slot 21 of {_infoGUI} to 1 orange stained glass pane named "&6-1" with lore "&7当前: %{offset::%uuid of {_p}%}%ms"
set slot 22 of {_infoGUI} to clock named "&f偏移: &e%{offset::%uuid of {_p}%}%ms" with lore "%nl%&7单位: 毫秒(ms)%nl%&7偏移越高,音符生成越滞后,反之提前%nl%&7如果你遇到了音画不同步,请调整此项%nl%&f注意:第一次播放音画不同步属正常现象"
set slot 25 of {_infoGUI} to 50 light blue stained glass panes named "&b+50" with lore "&7当前: %{offset::%uuid of {_p}%}%ms"
set slot 24 of {_infoGUI} to 10 light blue stained glass panes named "&b+10" with lore "&7当前: %{offset::%uuid of {_p}%}%ms"
set slot 23 of {_infoGUI} to 1 light blue stained glass pane named "&b+1" with lore "&7当前: %{offset::%uuid of {_p}%}%ms"
open {_infoGUI} to {_p}
function setHitSound(p: player):
if {hitSound::%uuid of {_p}%} is "&a开":
set {hitSound::%uuid of {_p}%} to "&c关"
else:
set {hitSound::%uuid of {_p}%} to "&a开"
settingsGUI({_p})
function setIndicator(p: player):
if {indicator::%uuid of {_p}%} is "&a开":
set {indicator::%uuid of {_p}%} to "&c关"
else:
set {indicator::%uuid of {_p}%} to "&a开"
settingsGUI({_p})
function setShowOffset(p: player):
if {showOffset::%uuid of {_p}%} is "&a开":
set {showOffset::%uuid of {_p}%} to "&c关"
else:
set {showOffset::%uuid of {_p}%} to "&a开"
settingsGUI({_p})
function setAutoPlay(p: player):
if {autoPlay::%uuid of {_p}%} is "&a开":
set {autoPlay::%uuid of {_p}%} to "&c关"
else:
set {autoPlay::%uuid of {_p}%} to "&a开"
settingsGUI({_p})
function setLine(p: player):
if {showLine::%uuid of {_p}%} is "&a开":
set {showLine::%uuid of {_p}%} to "&c关"
else:
set {showLine::%uuid of {_p}%} to "&a开"
settingsGUI({_p})