Compare commits
7
Commits
main
..
c2c50ab28b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2c50ab28b | ||
|
|
fa5b88e984 | ||
|
|
f34be4d8db | ||
|
|
5097181f42 | ||
|
|
407267951d | ||
|
|
542964daa5 | ||
|
|
1bca058bf5 |
@@ -30,9 +30,9 @@
|
||||
如果成功安装,那么以下内容的 markdown 预览应当是一个事件栏。
|
||||
|
||||
```rdview 7 5 1
|
||||
PlaySong 0 0[];
|
||||
SetCrotchetsPerBar 0 1[crotchetsPerBar=4];
|
||||
AddClassicBeat 0 2[tick=6];
|
||||
es.PlaySong 0 0[];
|
||||
es.SetCrotchetsPerBar_4 0 1[];
|
||||
eb.AddClassicBeat 0 2[tick=6];
|
||||
```
|
||||
|
||||
### RhythmBase.View
|
||||
|
||||
+81
-4
@@ -15,15 +15,93 @@
|
||||
<link rel="stylesheet" href="/style/dark.css">
|
||||
<link rel="stylesheet" href="/style/color.css">
|
||||
<link rel="stylesheet" href="/style/rdview.css">
|
||||
<link rel="stylesheet" href="/style/rdview-rdtk.css">
|
||||
<link rel="stylesheet" href="/style/otto.css">
|
||||
<link rel="stylesheet" href="/style/special.css">
|
||||
<script src="/script/config.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">加载中...</div>
|
||||
<script type="module" src="./script/rdview-init.js"></script>
|
||||
<script>
|
||||
$docsify = {
|
||||
name: "节奏医生编辑器教程",
|
||||
notFoundPage: "/404.md",
|
||||
homepage: "/pages/intro.md",
|
||||
loadSidebar: true,
|
||||
loadNavbar: true,
|
||||
coverpage: false,
|
||||
maxLevel: 5,
|
||||
subMaxLevel: 4,
|
||||
mergeNavbar: true,
|
||||
};
|
||||
</script>
|
||||
<script type="module">
|
||||
import "./script/rdview.js";
|
||||
import {render} from "./script/rdtkview_render.js";
|
||||
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
loadRDView();
|
||||
const originalCodeRenderer = $docsify.markdown
|
||||
?.renderer?.code;
|
||||
function codeblockRender(code, lang) {
|
||||
if (lang.trim().startsWith("rdview")) {
|
||||
return RDViewRender(lang, code);
|
||||
}
|
||||
// else if (lang.trim().startsWith("rdtkview")) {
|
||||
// const args = lang.slice(8).trim().split(" ");
|
||||
// const width = parseInt(args[0]) || 8;
|
||||
// const height = parseInt(args[1]) || 4;
|
||||
// const scale = parseFloat(args[2]) || 2.0;
|
||||
// const result = render(code, width, height, scale);
|
||||
// result.toString = () => result;
|
||||
// return result;
|
||||
// }
|
||||
return originalCodeRenderer
|
||||
? originalCodeRenderer(code, lang)
|
||||
: `<pre data-lang="${lang}"><code>${
|
||||
escapeHtml(code)
|
||||
}</code></pre>`;
|
||||
}
|
||||
$docsify = {
|
||||
...$docsify,
|
||||
...{
|
||||
markdown: {
|
||||
renderer: {
|
||||
code: (code, lang) => {
|
||||
return codeblockRender(code, lang);
|
||||
},
|
||||
image: function (src, title, alt) {
|
||||
return `<div class="image-tip"><img class="medium-zoom-image" src="${src}" alt="${alt}">${
|
||||
alt ? `<p>${alt}</p>` : ""
|
||||
}</div>`;
|
||||
},
|
||||
},
|
||||
},
|
||||
switchLightDarkMode: {
|
||||
useSwitchMode: true,
|
||||
top: 130,
|
||||
right: 26,
|
||||
svgColor: "#7d7b75",
|
||||
},
|
||||
search: {
|
||||
noData: {
|
||||
"/": "没有找到结果!",
|
||||
},
|
||||
paths: "auto",
|
||||
placeholder: {
|
||||
"/": "搜索",
|
||||
},
|
||||
hideOtherSidebarContent: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<script type="module" src="./script/special.js"></script>
|
||||
<!-- <script src="/script/docsify.min.js"></script> -->
|
||||
<script src="/script/zoom-image.min.js"></script>
|
||||
@@ -32,7 +110,6 @@
|
||||
<!-- <script src="/script/docsify-copy-code.min.js"></script> -->
|
||||
<script src="/script/switchLightDarkMode.js"></script>
|
||||
<script src="/script/otto.js"></script>
|
||||
<script src="/script/custommethod-data.js"></script>
|
||||
<script src="/script/custommethod-search.js"></script>
|
||||
<!-- <script
|
||||
src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-yaml.js"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# RDView Playground
|
||||
<div class="rdview"><div class="canvas"></div><div class="editor"><div class="number"></div><textarea class="area" spellcheck="false" placeholder="Enter code here">
|
||||
rdview 8 5
|
||||
Comment 2[tab=Sounds,if=true];
|
||||
es.Comment 2[if=true];
|
||||
g 1 1 5 4 #0ff{
|
||||
SetRowXs[rowxs=--x-xx];
|
||||
AddClassicBeat 2[tick=0.5,swing=0.333,grayscale=100];
|
||||
AddOneshotBeat 2 1[
|
||||
eb.SetRowXs[rowxs=--x-xx];
|
||||
eb.AddClassicBeat 2[tick=3,swing=0.333,grayscale=100];
|
||||
eb.AddOneshotBeat 2 1[
|
||||
type=freezeshot subdivision,
|
||||
interval=2,
|
||||
delay=0.25,
|
||||
@@ -13,10 +13,10 @@ g 1 1 5 4 #0ff{
|
||||
loop=2,
|
||||
offset_grayscale=100
|
||||
];
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 1 2[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 2 2[phraseToSay=JustSayGo];
|
||||
SayReadyGetSetGo 0 3[phraseToSay=SayGetSetGo];
|
||||
es.SayReadyGetSetGo_Get 0 2;
|
||||
es.SayReadyGetSetGo_Set 1 2;
|
||||
es.SayReadyGetSetGo_Go 2 2;
|
||||
es.SayReadyGetSetGo_GetSetGo 0 3;
|
||||
};
|
||||
</textarea></div></div>
|
||||
|
||||
|
||||
+18
-18
@@ -39,12 +39,12 @@
|
||||
**心爆 3** :三次及以上累计的按拍 / 三个及以上重叠的按拍产生的心爆。
|
||||
|
||||
```rdview 3 5
|
||||
AddFreeTimeBeat 1 1[pulse=6];
|
||||
AddFreeTimeBeat 1 2[pulse=6];
|
||||
AddFreeTimeBeat 1 2[pulse=6];
|
||||
AddFreeTimeBeat 1 3[pulse=6];
|
||||
AddFreeTimeBeat 1 3[pulse=6];
|
||||
AddFreeTimeBeat 1 3[pulse=6];
|
||||
eb.AddFreeTimeBeat 1 1[pulse=7];
|
||||
eb.AddFreeTimeBeat 1 2[pulse=7];
|
||||
eb.AddFreeTimeBeat 1 2[pulse=7];
|
||||
eb.AddFreeTimeBeat 1 3[pulse=7];
|
||||
eb.AddFreeTimeBeat 1 3[pulse=7];
|
||||
eb.AddFreeTimeBeat 1 3[pulse=7];
|
||||
```
|
||||
|
||||
### 设置心跳音量
|
||||
@@ -73,19 +73,19 @@ AddFreeTimeBeat 1 3[pulse=6];
|
||||
```rdview 4 9
|
||||
g 1 1{
|
||||
g 1 0 0 1 #08f{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 1.25 3 1.75 1 #08f{
|
||||
g{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 1.5 5 1.5 1 #08f{
|
||||
g{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 1.75 7 1.25 1 #08f{
|
||||
g{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
```
|
||||
|
||||
@@ -97,35 +97,35 @@ g 1.75 7 1.25 1 #08f{
|
||||
```rdview 7 9
|
||||
g 1 1 0.75 1 #08f{
|
||||
g 0 0 0.25{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 1 3 1.25 1 #08f{
|
||||
g 0 0 0.75{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 1 5 1.25{
|
||||
g 1.25 0 0 1 #08f{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 1 7 1.75 {
|
||||
g 1.75 0 0 1 #08f{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 4 1 1 1 #08f{
|
||||
g 0 0 0.5{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 4 3 1.5 1 #08f{
|
||||
g{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 4 5 1.5{
|
||||
g 1.5 0 0 1 #08f{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
g 4 7 2 {
|
||||
g 2 0 0 1 #08f{};
|
||||
AddFreeTimeBeat [pulse=6];
|
||||
eb.AddFreeTimeBeat [pulse=7];
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
+25
-25
@@ -47,15 +47,15 @@
|
||||
首先,剧情模式出现两次五拍子机制,它们出现的位置在节奏上都是连续附点的,即两个心跳之间的间隔都是1.5拍,这样五拍子的有声拍长也是6,和普通的普通拍子是完全一致的。在这种连续附点的压迫感之下设置五拍,与音乐非常契合。
|
||||
|
||||
```rdview 14 4
|
||||
AddClassicBeat 6 1[tick=6];
|
||||
SetRowXs 1 2[rowxs=xx----];
|
||||
AddFreeTimeBeat 3 2[pulse=1];
|
||||
PulseFreeTimeBeat 4.5 2[pulse=9];
|
||||
PulseFreeTimeBeat 6 2[pulse=9];
|
||||
PulseFreeTimeBeat 7.5 2[pulse=9];
|
||||
PulseFreeTimeBeat 9 2[pulse=9];
|
||||
PulseFreeTimeBeat 10.5 2[pulse=9];
|
||||
PulseFreeTimeBeat 12 2[pulse=9];
|
||||
eb.AddClassicBeat 6 1[tick=6];
|
||||
eb.SetRowXs 1 2[rowxs=xx----];
|
||||
eb.AddFreeTimeBeat 3 2[pulse=1];
|
||||
eb.PulseFreeTimeBeat 4.5 2[pulse=9];
|
||||
eb.PulseFreeTimeBeat 6 2[pulse=9];
|
||||
eb.PulseFreeTimeBeat 7.5 2[pulse=9];
|
||||
eb.PulseFreeTimeBeat 9 2[pulse=9];
|
||||
eb.PulseFreeTimeBeat 10.5 2[pulse=9];
|
||||
eb.PulseFreeTimeBeat 12 2[pulse=9];
|
||||
```
|
||||
|
||||
而我们自选音乐时很多时候遇到的情况都是连续五个采音点,但间隔都是1拍,这种情况与其精准采音`xx----`反而不如额外增加一个不存在的采音变成`-x----`或者`-----x`,这样既不损失与音乐的契合,又能把节奏归化简单。
|
||||
@@ -89,22 +89,22 @@ PulseFreeTimeBeat 12 2[pulse=9];
|
||||
**三、**每一条轨道的**节奏功能做出严格的区分**,如果场上本身就有多轨,不要给一条轨道设计过多差距太大的节奏类型。同时,非必要尽量不要增添太多轨道。让很多轨道展现出花里胡哨的节奏但却在同一拍按键也会让人感觉很牵强。
|
||||
|
||||
```rdview 14 4
|
||||
AddClassicBeat 0 0[tick=1.5,swing=0.25];
|
||||
AddClassicBeat 2 0[tick=3,swing=0.5];
|
||||
AddClassicBeat 6 0[tick=3,hold=0.5,swing=0.5];
|
||||
AddFreeTimeBeat 10 0[pulse=1];
|
||||
PulseFreeTimeBeat 10.25[pulse=9];
|
||||
PulseFreeTimeBeat 11[pulse=9];
|
||||
PulseFreeTimeBeat 11.25[pulse=9];
|
||||
PulseFreeTimeBeat 12[pulse=9];
|
||||
PulseFreeTimeBeat 12.25[pulse=9];
|
||||
PulseFreeTimeBeat 13[pulse=9];
|
||||
AddClassicBeat 0 1[tick=6];
|
||||
AddClassicBeat 7 1[tick=1.5,swing=0.25];
|
||||
AddClassicBeat 9 1[tick=1.5,swing=0.25];
|
||||
AddClassicBeat 0 2[tick=3,hold=0.5,swing=0.5];
|
||||
AddClassicBeat 4 2[tick=3,swing=0.5];
|
||||
AddClassicBeat 7 2[tick=6];
|
||||
eb.AddClassicBeat 0 0[tick=1.5,swing=0.25];
|
||||
eb.AddClassicBeat 2 0[tick=3,swing=0.5];
|
||||
eb.AddClassicBeat 6 0[tick=3,hold=0.5,swing=0.5];
|
||||
eb.AddFreeTimeBeat 10 0[pulse=1];
|
||||
eb.PulseFreeTimeBeat 10.25[pulse=9];
|
||||
eb.PulseFreeTimeBeat 11[pulse=9];
|
||||
eb.PulseFreeTimeBeat 11.25[pulse=9];
|
||||
eb.PulseFreeTimeBeat 12[pulse=9];
|
||||
eb.PulseFreeTimeBeat 12.25[pulse=9];
|
||||
eb.PulseFreeTimeBeat 13[pulse=9];
|
||||
eb.AddClassicBeat 0 1[tick=6];
|
||||
eb.AddClassicBeat 7 1[tick=1.5,swing=0.25];
|
||||
eb.AddClassicBeat 9 1[tick=1.5,swing=0.25];
|
||||
eb.AddClassicBeat 0 2[tick=3,hold=0.5,swing=0.5];
|
||||
eb.AddClassicBeat 4 2[tick=3,swing=0.5];
|
||||
eb.AddClassicBeat 7 2[tick=6];
|
||||
```
|
||||
|
||||
**四、**不要过度采音。更不要为了精准采音做出种类繁多,重复次数又少的自由拍子。节奏医生的游戏机制是和一般的音乐游戏不同的。音乐游戏是可以给每一个节奏点都设计按键(Note)的,但节奏医生却不能这样。节奏医生的本质是“提示拍 + 按键拍”的组合,**所有的提示拍全都应该按照没有按键的节奏点来设计**。如果像其他音乐游戏一样来设计节奏医生的谱面,得到的一定是塞爆谱。
|
||||
|
||||
+10
-10
@@ -39,25 +39,25 @@
|
||||
**创建文本递进**:如果想要把一整句歌词按歌词节奏一个一个地显示出来,就需要在文本中使用“`/`”将它们隔开。如果想要一个一个地覆盖掉之前显示的内容,就需要在文本中使用`回车键`将他们隔开。之后点击下面的“创建文本递进”,在工作区里面可以拖动右箭头事件来调整时机。如果你做好了又不想要了,那么再把下面的开启改成关闭即可,无需手动删除。如果你又反悔了,还是想要,再改成开启,又会恢复记录。
|
||||
|
||||
```rdview 8 3
|
||||
FloatingText 1 1;
|
||||
AdvanceText 2 1;
|
||||
AdvanceText 3 1;
|
||||
AdvanceText 4 1;
|
||||
AdvanceText 5 1;
|
||||
AdvanceText 6 1;
|
||||
AdvanceText 7 1;
|
||||
ea.FloatingText 1 1;
|
||||
ea.AdvanceText 2 1;
|
||||
ea.AdvanceText 3 1;
|
||||
ea.AdvanceText 4 1;
|
||||
ea.AdvanceText 5 1;
|
||||
ea.AdvanceText 6 1;
|
||||
ea.AdvanceText 7 1;
|
||||
```
|
||||
|
||||
音节的消失方式选择**淡出**就是慢慢消失,**立即**就是瞬间消失,音节显示的时长是按创建文本递进的最后一个事件往后数拍子的。
|
||||
|
||||
```rdview 13 3
|
||||
FloatingText 1 1;
|
||||
ea.FloatingText 1 1;
|
||||
g 3 1 4 1;
|
||||
g 7 1 0 1 #f80;
|
||||
AdvanceText 3 1;
|
||||
ea.AdvanceText 3 1;
|
||||
g 8 1 4 1;
|
||||
g 12 1 0 1 #f80;
|
||||
AdvanceText 8 1;
|
||||
ea.AdvanceText 8 1;
|
||||
```
|
||||
|
||||
## 更丰富的效果和技巧
|
||||
|
||||
@@ -93,20 +93,6 @@
|
||||
## 快捷查询
|
||||
|
||||
<div class="custommethods-search">
|
||||
<div class="cm-search">
|
||||
<input class="cm-query" type="text" placeholder="输入自定义方法名,如 ChangeCharacter" autocomplete="off">
|
||||
<ul class="cm-suggest"></ul>
|
||||
</div>
|
||||
<div class="cm-options"></div>
|
||||
<div class="cm-selected" hidden>
|
||||
<div class="cm-head">
|
||||
<span class="cm-name"></span>
|
||||
<span class="cm-short"></span>
|
||||
</div>
|
||||
<div class="cm-call"></div>
|
||||
<code class="cm-preview"></code>
|
||||
<div class="cm-desc"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
## 我知道你还想问什么
|
||||
|
||||
+20
-20
@@ -9,8 +9,8 @@
|
||||
如果不对其添加任何其他设置,那么轨道会延续上一个“切换为修饰拍子设置”的模式,当然你可以在“设置X标记”这个项目里面选择跳过节拍的形式,默认有三种情况,比如选`—x—x—x`轨道就会自动变成 `—x—x—x————♥` 的模式,像`4-1`这关的矿工一样,也就是在1,3,5,7拍有按压的动画效果。
|
||||
|
||||
```rdview 7 3
|
||||
AddClassicBeat 3 1[tick=0.5,hold=0.3,swing=0.5];
|
||||
SetRowXs 1 1[rowxs=---x--];
|
||||
eb.AddClassicBeat 3 1[tick=3,hold=0.3,swing=0.5];
|
||||
eb.SetRowXs 1 1[rowxs=---x--];
|
||||
```
|
||||
|
||||
另外长按拍子在编辑器里面也可以分解为自由节拍,使用自由节拍时,需将脉冲出现与脉冲消失分别构成两个合法的普通拍,也即所有脉冲出现的相隔时长相同,且所有脉冲消失的相隔时长相同。
|
||||
@@ -24,12 +24,12 @@ g 5 2 0 5 #f00{};
|
||||
g 5.5 3 0 4 #d20{};
|
||||
g 6 4 0 3 #b40{};
|
||||
g 6.5 5 0 2 #960{};
|
||||
AddFreeTimeBeat 1 1[pulse=0,offset=0 1,hold=4];
|
||||
PulseFreeTimeBeat 2 1[offset=0 2,hold=3.5,action=Custom,customPulse=2];
|
||||
PulseFreeTimeBeat 3 1[offset=0 3,hold=3,action=Custom,customPulse=4];
|
||||
PulseFreeTimeBeat 4 1[offset=0 4,hold=2.5,action=Custom,customPulse=6];
|
||||
AddClassicBeat 1 6[tick=0.5,swing=2];
|
||||
AddClassicBeat 5 6[tick=0.25,swing=2];
|
||||
eb.AddFreeTimeBeat 1 1[offset=0 1,hold=4];
|
||||
eb.PulseFreeTimeBeat 2 1[offset=0 2,hold=3.5,pulse=3];
|
||||
eb.PulseFreeTimeBeat 3 1[offset=0 3,hold=3,pulse=5];
|
||||
eb.PulseFreeTimeBeat 4 1[offset=0 4,hold=2.5,pulse=7];
|
||||
eb.AddClassicBeat 1 6[tick=3,swing=0.5];
|
||||
eb.AddClassicBeat 5 6[tick=1.5,swing=0.25];
|
||||
```
|
||||
|
||||
## 演示关卡
|
||||
@@ -41,23 +41,23 @@ AddClassicBeat 5 6[tick=0.25,swing=2];
|
||||
**1、**在长按拍松手的时刻可以有其他的按拍。这在曾经的编辑器版本里是不允许的,目前官方修正了这一机制。
|
||||
|
||||
```rdview 9 4
|
||||
AddClassicBeat 1 1[tick=1,hold=1];
|
||||
AddClassicBeat 2 2[tick=1];
|
||||
eb.AddClassicBeat 1 1[tick=6,hold=1];
|
||||
eb.AddClassicBeat 2 2[tick=6];
|
||||
```
|
||||
|
||||
**2、**当同时存在多个长按拍子时,这些长按拍的长按时间段必须完全一致。也就是说,长按时间段之间不能是包含、交叉或首尾相连的关系。
|
||||
|
||||
```rdview 16 7
|
||||
AddClassicBeat 1 1[tick=0.5,hold=1,swing=0.5];
|
||||
AddClassicBeat 1 2[tick=0.5,hold=0.5,swing=0.5];
|
||||
AddClassicBeat 6 1[tick=0.5,hold=1,swing=0.5];
|
||||
AddClassicBeat 6.25 2[tick=0.5,hold=0.5,swing=0.5];
|
||||
AddClassicBeat 11 1[tick=0.5,hold=1,swing=0.5];
|
||||
AddClassicBeat 11.5 2[tick=0.5,hold=1,swing=0.5];
|
||||
AddClassicBeat 1.5 4[tick=0.5,hold=1,swing=0.25];
|
||||
AddClassicBeat 1 5[tick=0.5,hold=0.5,swing=0.5];
|
||||
AddClassicBeat 6 4[tick=0.5,hold=1,swing=0.5];
|
||||
AddClassicBeat 6.5 5[tick=0.5,hold=0.5,swing=0.5];
|
||||
eb.AddClassicBeat 1 1[tick=3,hold=1,swing=0.5];
|
||||
eb.AddClassicBeat 1 2[tick=3,hold=0.5,swing=0.5];
|
||||
eb.AddClassicBeat 6 1[tick=3,hold=1,swing=0.5];
|
||||
eb.AddClassicBeat 6.25 2[tick=3,hold=0.5,swing=0.5];
|
||||
eb.AddClassicBeat 11 1[tick=3,hold=1,swing=0.5];
|
||||
eb.AddClassicBeat 11.5 2[tick=3,hold=1,swing=0.5];
|
||||
eb.AddClassicBeat 1.5 4[tick=1.5,hold=1,swing=0.25];
|
||||
eb.AddClassicBeat 1 5[tick=3,hold=0.5,swing=0.5];
|
||||
eb.AddClassicBeat 6 4[tick=3,hold=1,swing=0.5];
|
||||
eb.AddClassicBeat 6.5 5[tick=3,hold=0.5,swing=0.5];
|
||||
```
|
||||
|
||||
**3、**凹兔的自动演示对于长按拍的处理十分诡异,可能会提前松掉长按拍子,但不必惊慌,这不是你的问题。
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
接下来在左下角点击紫色星星图标进入紫色的版块,在能看到波形结束的地方点一下,然后往下翻到**结束关卡**按钮,这样的按钮一共必须放三个。
|
||||
|
||||
```rdview 5 5
|
||||
FinishLevel 1 1;
|
||||
FinishLevel 2 2;
|
||||
FinishLevel 3 3;
|
||||
ea.FinishLevel 1 1;
|
||||
ea.FinishLevel 2 2;
|
||||
ea.FinishLevel 3 3;
|
||||
```
|
||||
|
||||
最后我们回到红色的版块,点击**关卡设置**,选择上方的导出,有几个空栏是必须要填写的:
|
||||
|
||||
+67
-67
@@ -7,13 +7,13 @@
|
||||
我们把一个普通的普通拍子分解为自由时长节拍后,可以看到它变成了一个大的`1`和六个小的`>` 。
|
||||
|
||||
```rdview 8 2
|
||||
AddFreeTimeBeat 1 0[pulse=0];
|
||||
PulseFreeTimeBeat 2 0[action=Increment];
|
||||
PulseFreeTimeBeat 3 0[action=Increment];
|
||||
PulseFreeTimeBeat 4 0[action=Increment];
|
||||
PulseFreeTimeBeat 5 0[action=Increment];
|
||||
PulseFreeTimeBeat 6 0[action=Increment];
|
||||
PulseFreeTimeBeat 7 0[action=Increment];
|
||||
eb.AddFreeTimeBeat 1 0[pulse=1];
|
||||
eb.PulseFreeTimeBeat 2 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 3 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 5 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 6 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 7 0[pulse=9];
|
||||
```
|
||||
|
||||
我们选中数字1对应的节拍,发现这个是设置起始脉冲位置的。你甚至可以将它改为第七拍,然后把六个小的`>`删掉,这样就没有任何节拍提示。如果你设计的关卡是一个和节奏医生没什么关联的创意谱(梦幻联动?),且按键密度很大,则可以考虑这样使用。相比于工作区里面重叠摆放一大堆普通普通拍子,这样会看上去更清爽。但如果你设计的就是节奏医生,**请不要在完全无节奏提示的情况下直接响起第七拍**。
|
||||
@@ -23,20 +23,20 @@ PulseFreeTimeBeat 7 0[action=Increment];
|
||||
剩下的大于号`>`即意味着心跳向右移动一格,数到7的时候则需要按拍。点选之后,把它改成 `<`,心跳还能向左移动一格;点击自定义,还可以任意指定到第几个节拍。每一组自由拍**必须使用较大的节拍作为开头**,较小的则数量不限,直到数到第七拍为止。
|
||||
|
||||
```rdview 10 2
|
||||
AddFreeTimeBeat 1 0[pulse=0];
|
||||
PulseFreeTimeBeat 2 0[action=Increment];
|
||||
PulseFreeTimeBeat 2.75 0[action=Increment];
|
||||
PulseFreeTimeBeat 3.5 0[action=Increment];
|
||||
PulseFreeTimeBeat 4 0[action=Increment];
|
||||
PulseFreeTimeBeat 4.5 0[action=Increment];
|
||||
PulseFreeTimeBeat 5 0[action=Increment];
|
||||
AddFreeTimeBeat 5 0[pulse=0];
|
||||
PulseFreeTimeBeat 6 0[action=Increment];
|
||||
PulseFreeTimeBeat 6.75 0[action=Increment];
|
||||
PulseFreeTimeBeat 7.5 0[action=Increment];
|
||||
PulseFreeTimeBeat 8 0[action=Increment];
|
||||
PulseFreeTimeBeat 8.5 0[action=Increment];
|
||||
PulseFreeTimeBeat 9 0[action=Increment];
|
||||
eb.AddFreeTimeBeat 1 0[pulse=1];
|
||||
eb.PulseFreeTimeBeat 2 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 2.75 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 3.5 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4.5 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 5 0[pulse=9];
|
||||
eb.AddFreeTimeBeat 5 0[pulse=1];
|
||||
eb.PulseFreeTimeBeat 6 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 6.75 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 7.5 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 8 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 8.5 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 9 0[pulse=9];
|
||||
```
|
||||
|
||||
如果你想让一串自由节拍最后不需要按拍,而是节奏直接消失,就把这一组自由节拍的最后一个点选**垃圾桶**符号。
|
||||
@@ -70,15 +70,15 @@ PulseFreeTimeBeat 9 0[action=Increment];
|
||||
八拍子就更好理解了,我们直接额外增加一个节拍,让按拍的时机在第八拍响起的时候。但是轨道上是只能显示七个拍子的,所以我们依然要依赖**分解成自由拍**,以`2 1 2 3 4 5 6 7`的形式响起节拍。设置的方法如下图所示:
|
||||
|
||||
```rdview 10 3
|
||||
AddClassicBeat 1 0[tick=1];
|
||||
AddFreeTimeBeat 1 1[pulse=1];
|
||||
PulseFreeTimeBeat 2 1[action=Decrement];
|
||||
PulseFreeTimeBeat 3 1[action=Increment];
|
||||
PulseFreeTimeBeat 4 1[action=Increment];
|
||||
PulseFreeTimeBeat 5 1[action=Increment];
|
||||
PulseFreeTimeBeat 6 1[action=Increment];
|
||||
PulseFreeTimeBeat 7 1[action=Increment];
|
||||
PulseFreeTimeBeat 8 1[action=Increment];
|
||||
eb.AddClassicBeat 1 0[tick=6];
|
||||
eb.AddFreeTimeBeat 1 1[pulse=2];
|
||||
eb.PulseFreeTimeBeat 2 1[pulse=8];
|
||||
eb.PulseFreeTimeBeat 3 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 5 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 6 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 7 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 8 1[pulse=9];
|
||||
```
|
||||
|
||||
**如何提示**
|
||||
@@ -91,15 +91,15 @@ PulseFreeTimeBeat 8 1[action=Increment];
|
||||
八拍子也可以是摇摆拍,只需要将所有偶数拍选择并拖动即可变成摇摆拍:
|
||||
|
||||
```rdview 10 3
|
||||
AddClassicBeat 1 0[tick=1,swing=0.5];
|
||||
AddFreeTimeBeat 1 1[pulse=1];
|
||||
PulseFreeTimeBeat 2.5 1[action=Decrement];
|
||||
PulseFreeTimeBeat 3 1[action=Increment];
|
||||
PulseFreeTimeBeat 4.5 1[action=Increment];
|
||||
PulseFreeTimeBeat 5 1[action=Increment];
|
||||
PulseFreeTimeBeat 6.5 1[action=Increment];
|
||||
PulseFreeTimeBeat 7 1[action=Increment];
|
||||
PulseFreeTimeBeat 8.5 1[action=Increment];
|
||||
eb.AddClassicBeat 1 0[tick=6,swing=0.5];
|
||||
eb.AddFreeTimeBeat 1 1[pulse=2];
|
||||
eb.PulseFreeTimeBeat 2.5 1[pulse=8];
|
||||
eb.PulseFreeTimeBeat 3 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4.5 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 5 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 6.5 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 7 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 8.5 1[pulse=9];
|
||||
```
|
||||
|
||||
在八拍子中,**激活拍子**与八拍子的对应关系如下图所示。不要给第1拍和第3拍设置X拍子,这样做它就相当于变回普通拍了。
|
||||
@@ -118,33 +118,33 @@ PulseFreeTimeBeat 8.5 1[action=Increment];
|
||||
整数拍和附点拍是交错排列的,即`0.25<->0.375<->0.5<->0.75<->1<->1.5<->2<->3<->4`。附点变速拍可以将整拍长变成附点拍长,也可以反过来,但只能变化到排列里它**相邻**的拍长上。
|
||||
|
||||
```rdview 9 3
|
||||
AddFreeTimeBeat 1 0;
|
||||
PulseFreeTimeBeat 2 0[action=Increment];
|
||||
PulseFreeTimeBeat 3 0[action=Increment];
|
||||
PulseFreeTimeBeat 4 0[action=Increment];
|
||||
eb.AddFreeTimeBeat 1 0;
|
||||
eb.PulseFreeTimeBeat 2 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 3 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4 0[pulse=9];
|
||||
g 4 0 0.5 1 #08f[offset=0 0 #08f0]{
|
||||
PulseFreeTimeBeat 1 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 1 0[pulse=9];
|
||||
g 1 0 0.5 1 #000[offset=0 0 #0000]{
|
||||
g 0 0 0 0 #0000[offset=0.25]{
|
||||
PulseFreeTimeBeat 0.75 0[action=Increment,offset=0.25];
|
||||
eb.PulseFreeTimeBeat 0.75 0[pulse=9,offset=0.25];
|
||||
g 0.75 0 0.5 1 #0000[offset=0.25]{
|
||||
PulseFreeTimeBeat 0.75 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 0.75 0[pulse=9];
|
||||
g -1.75 0 3 1 #0000{};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
AddFreeTimeBeat 1 1;
|
||||
PulseFreeTimeBeat 2 1[action=Increment];
|
||||
PulseFreeTimeBeat 3 1[action=Increment];
|
||||
PulseFreeTimeBeat 4 1[action=Increment];
|
||||
eb.AddFreeTimeBeat 1 1;
|
||||
eb.PulseFreeTimeBeat 2 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 3 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4 1[pulse=9];
|
||||
g 4 1 0.5 1 #80f[offset=0 0 #08f0]{
|
||||
PulseFreeTimeBeat 1 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 1 0[pulse=9];
|
||||
g 1 0 0.5 1 #000[offset=0 0 #0000]{
|
||||
g 0 0 0 0 #0000[offset=-0.5]{
|
||||
PulseFreeTimeBeat 1.5 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 1.5 0[pulse=9];
|
||||
g 1.5 0 0.5 1 #0000[offset=-0.5]{
|
||||
PulseFreeTimeBeat 1.5 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 1.5 0[pulse=9];
|
||||
g -2.5 0 4.5 1 #0000{};
|
||||
};
|
||||
};
|
||||
@@ -171,33 +171,33 @@ g 4 1 0.5 1 #80f[offset=0 0 #08f0]{
|
||||
变速普通拍的另一种形式是倍速变速拍,变速是拍长翻倍或减半,注意与附点变速拍区分。
|
||||
|
||||
```rdview 11 3
|
||||
AddFreeTimeBeat 1 0;
|
||||
PulseFreeTimeBeat 2 0[action=Increment];
|
||||
PulseFreeTimeBeat 3 0[action=Increment];
|
||||
PulseFreeTimeBeat 4 0[action=Increment];
|
||||
eb.AddFreeTimeBeat 1 0;
|
||||
eb.PulseFreeTimeBeat 2 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 3 0[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4 0[pulse=9];
|
||||
g 4 0 0.5 1 #08f[offset=0 0 #08f0]{
|
||||
PulseFreeTimeBeat 1 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 1 0[pulse=9];
|
||||
g 1 0 0.5 1 #000[offset=0 0 #0000]{
|
||||
g 0 0 0 0 #0000[offset=0.5]{
|
||||
PulseFreeTimeBeat 0.5 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 0.5 0[pulse=9];
|
||||
g 0.5 0 0.5 1 #0000[offset=0.5]{
|
||||
PulseFreeTimeBeat 0.5 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 0.5 0[pulse=9];
|
||||
g -1.75 0 3 1 #0000{};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
AddFreeTimeBeat 1 1;
|
||||
PulseFreeTimeBeat 2 1[action=Increment];
|
||||
PulseFreeTimeBeat 3 1[action=Increment];
|
||||
PulseFreeTimeBeat 4 1[action=Increment];
|
||||
eb.AddFreeTimeBeat 1 1;
|
||||
eb.PulseFreeTimeBeat 2 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 3 1[pulse=9];
|
||||
eb.PulseFreeTimeBeat 4 1[pulse=9];
|
||||
g 4 1 0.5 1 #08f[offset=0 0 #08f0]{
|
||||
PulseFreeTimeBeat 1 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 1 0[pulse=9];
|
||||
g 1 0 0.5 1 #000[offset=0 0 #0000]{
|
||||
g 0 0 0 0 #0000[offset=-1]{
|
||||
PulseFreeTimeBeat 2 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 2 0[pulse=9];
|
||||
g 2 0 0.5 1 #0000[offset=-1]{
|
||||
PulseFreeTimeBeat 2 0[action=Increment];
|
||||
eb.PulseFreeTimeBeat 2 0[pulse=9];
|
||||
g -2.5 0 4.5 1 #0000{};
|
||||
};
|
||||
};
|
||||
|
||||
+119
-119
@@ -7,10 +7,10 @@
|
||||
我们前面说过,护士提示的 Rea 和 Get 对应脉冲,Dy 和 Set 对应按拍,Go 代表单发拍开始,这种规则当然不仅仅适用于普通单发拍。先来看一个简单的摇摆单发拍:
|
||||
|
||||
```rdview 11 3
|
||||
SayReadyGetSetGo 1[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 2.5[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 5[phraseToSay=JustSayGo];
|
||||
AddOneshotBeat 5 1[loop=1,tick=1.5,interval=4];
|
||||
es.SayReadyGetSetGo_Get 1[];
|
||||
es.SayReadyGetSetGo_Set 2.5[];
|
||||
es.SayReadyGetSetGo_Go 5[];
|
||||
eb.AddOneshotBeat 5 1[loop=1,tick=1.5,interval=4];
|
||||
```
|
||||
|
||||
可以看到,虽然 Get-Set 与 Set-Go 之间的间隔不同,但依然保持了上述的对应关系。实际上,这就是`4-4`使用的单发拍。
|
||||
@@ -18,31 +18,31 @@ AddOneshotBeat 5 1[loop=1,tick=1.5,interval=4];
|
||||
在`2-3`中也出现了摇摆单发拍,可以试着自己理解一下这关的单发拍提示:
|
||||
|
||||
```rdview 10 2
|
||||
AddOneshotBeat 1[];
|
||||
AddOneshotBeat 3[];
|
||||
AddOneshotBeat 5[tick=0.75];
|
||||
AddOneshotBeat 6[tick=0.75];
|
||||
AddOneshotBeat 7[tick=0.75];
|
||||
AddOneshotBeat 8[tick=0.75];
|
||||
eb.AddOneshotBeat 1[];
|
||||
eb.AddOneshotBeat 3[];
|
||||
eb.AddOneshotBeat 5[tick=0.75];
|
||||
eb.AddOneshotBeat 6[tick=0.75];
|
||||
eb.AddOneshotBeat 7[tick=0.75];
|
||||
eb.AddOneshotBeat 8[tick=0.75];
|
||||
```
|
||||
|
||||
如果我们在此基础上更进一步,会发生什么呢?来看看`4-4N`中出现过的这段单发拍:
|
||||
|
||||
```rdview 12 4
|
||||
g 1 1 4 2[offset=4]{
|
||||
SayReadyGetSetGo 0 0[phraseToSay=JustSayRea];
|
||||
SayReadyGetSetGo 0.75 1[phraseToSay=JustSayDy];
|
||||
SayReadyGetSetGo 1.5 0[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 2.25 1[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 4 0[phraseToSay=JustSayGo];
|
||||
es.SayReadyGetSetGo_Rea 0 0[];
|
||||
es.SayReadyGetSetGo_Dy 0.75 1[];
|
||||
es.SayReadyGetSetGo_Get 1.5 0[];
|
||||
es.SayReadyGetSetGo_Set 2.25 1[];
|
||||
es.SayReadyGetSetGo_Go 4 0[];
|
||||
g 0 -1 0.75 3 #0f8[]{};
|
||||
g 1.5 -1 0.75 3 #0f8[]{};
|
||||
g 4 -1 0 3 #0f8[]{};
|
||||
};
|
||||
AddOneshotBeat 5[tick=0.75];
|
||||
AddOneshotBeat 6.5[tick=0.75];
|
||||
AddOneshotBeat 9[tick=0.75];
|
||||
AddOneshotBeat 10.5[tick=0.75];
|
||||
eb.AddOneshotBeat 5[tick=0.75];
|
||||
eb.AddOneshotBeat 6.5[tick=0.75];
|
||||
eb.AddOneshotBeat 9[tick=0.75];
|
||||
eb.AddOneshotBeat 10.5[tick=0.75];
|
||||
```
|
||||
|
||||
可以看到,图中的单发拍已不再局限于一个单发拍不断重复了,而是变成了若干个单发拍构成的单发拍组的不断重复,但前面讲过的与护士提示之间的对应关系仍保持不变。由此我们可以得到单发拍的核心规则:
|
||||
@@ -53,24 +53,24 @@ AddOneshotBeat 10.5[tick=0.75];
|
||||
|
||||
```rdview 13 4
|
||||
g 1 1 4 2[offset=4]{
|
||||
SayReadyGetSetGo 0 0[phraseToSay=JustSayRea];
|
||||
SayReadyGetSetGo 1 0[phraseToSay=JustSayDy];
|
||||
SayReadyGetSetGo 2 0[phraseToSay=JustSayRea];
|
||||
SayReadyGetSetGo 2.5 1[phraseToSay=JustSayDy];
|
||||
SayReadyGetSetGo 3 0[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 3.5 1[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 4 0[phraseToSay=JustSayGo];
|
||||
es.SayReadyGetSetGo_Rea 0 0[];
|
||||
es.SayReadyGetSetGo_Dy 1 0[];
|
||||
es.SayReadyGetSetGo_Rea 2 0[];
|
||||
es.SayReadyGetSetGo_Dy 2.5 1[];
|
||||
es.SayReadyGetSetGo_Get 3 0[];
|
||||
es.SayReadyGetSetGo_Set 3.5 1[];
|
||||
es.SayReadyGetSetGo_Go 4 0[];
|
||||
g 0 -1 1 2 #0f8[]{};
|
||||
g 2 -1 0.5 3 #0f8[]{};
|
||||
g 3 -1 0.5 3 #0f8[]{};
|
||||
g 4 -1 0 3 #0f8[]{};
|
||||
};
|
||||
AddOneshotBeat 5[];
|
||||
AddOneshotBeat 7[tick=0.5];
|
||||
AddOneshotBeat 8[tick=0.5];
|
||||
AddOneshotBeat 9[];
|
||||
AddOneshotBeat 11[tick=0.5];
|
||||
AddOneshotBeat 12[tick=0.5];
|
||||
eb.AddOneshotBeat 5[];
|
||||
eb.AddOneshotBeat 7[tick=0.5];
|
||||
eb.AddOneshotBeat 8[tick=0.5];
|
||||
eb.AddOneshotBeat 9[];
|
||||
eb.AddOneshotBeat 11[tick=0.5];
|
||||
eb.AddOneshotBeat 12[tick=0.5];
|
||||
```
|
||||
|
||||
当你不确定一段单发拍提示是否正确时,可以把这段单发拍提示向后复制几份,首尾相连,如果发现所有的 Dy 和 Set 均对齐了按拍时机,就说明单发拍提示是正确的。
|
||||
@@ -84,13 +84,13 @@ AddOneshotBeat 12[tick=0.5];
|
||||
以下单发拍均是合法的:
|
||||
|
||||
```rdview 9 2
|
||||
AddOneshotBeat 1[];
|
||||
AddOneshotBeat 3[];
|
||||
AddOneshotBeat 3.5[tick=0.5];
|
||||
AddOneshotBeat 4.75[tick=1.25];
|
||||
AddOneshotBeat 5[];
|
||||
AddOneshotBeat 5.75[tick=0.25];
|
||||
AddOneshotBeat 7.5[tick=0.5];
|
||||
eb.AddOneshotBeat 1[];
|
||||
eb.AddOneshotBeat 3[];
|
||||
eb.AddOneshotBeat 3.5[tick=0.5];
|
||||
eb.AddOneshotBeat 4.75[tick=1.25];
|
||||
eb.AddOneshotBeat 5[];
|
||||
eb.AddOneshotBeat 5.75[tick=0.25];
|
||||
eb.AddOneshotBeat 7.5[tick=0.5];
|
||||
```
|
||||

|
||||
|
||||
@@ -103,31 +103,31 @@ AddOneshotBeat 7.5[tick=0.5];
|
||||
举个例子:Rea-Dy-Get-Set-Go 与 Rea-Dy--GetSet-Go,尽管两者的按拍时机相同,但不同的 Rea、Get 位置会给人带来不同的游玩体验。
|
||||
|
||||
```rdview 12 6
|
||||
AddOneshotBeat 5[];
|
||||
AddOneshotBeat 7.5[tick=0.5];
|
||||
AddOneshotBeat 9[];
|
||||
AddOneshotBeat 11.5[tick=0.5];
|
||||
eb.AddOneshotBeat 5[];
|
||||
eb.AddOneshotBeat 7.5[tick=0.5];
|
||||
eb.AddOneshotBeat 9[];
|
||||
eb.AddOneshotBeat 11.5[tick=0.5];
|
||||
g 1 1 4 1 [offset=4]{
|
||||
SayReadyGetSetGo 0[phraseToSay=JustSayRea];
|
||||
SayReadyGetSetGo 1[phraseToSay=JustSayDy];
|
||||
SayReadyGetSetGo 2.5[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 3[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 4[phraseToSay=JustSayGo];
|
||||
es.SayReadyGetSetGo_Rea 0[];
|
||||
es.SayReadyGetSetGo_Dy 1[];
|
||||
es.SayReadyGetSetGo_Get 2.5[];
|
||||
es.SayReadyGetSetGo_Set 3[];
|
||||
es.SayReadyGetSetGo_Go 4[];
|
||||
g 0 -1 1 2 #0f8[]{};
|
||||
g 2.5 -1 0.5 2 #0f8[]{};
|
||||
g 4 -1 0 2 #0f8[]{};
|
||||
};
|
||||
|
||||
AddOneshotBeat 5 3[];
|
||||
AddOneshotBeat 7 3[];
|
||||
AddOneshotBeat 9 3[];
|
||||
AddOneshotBeat 11 3[];
|
||||
eb.AddOneshotBeat 5 3[];
|
||||
eb.AddOneshotBeat 7 3[];
|
||||
eb.AddOneshotBeat 9 3[];
|
||||
eb.AddOneshotBeat 11 3[];
|
||||
g 1 4 4 1 [offset=4]{
|
||||
SayReadyGetSetGo 0[phraseToSay=JustSayRea];
|
||||
SayReadyGetSetGo 1[phraseToSay=JustSayDy];
|
||||
SayReadyGetSetGo 2[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 3[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 4[phraseToSay=JustSayGo];
|
||||
es.SayReadyGetSetGo_Rea 0[];
|
||||
es.SayReadyGetSetGo_Dy 1[];
|
||||
es.SayReadyGetSetGo_Get 2[];
|
||||
es.SayReadyGetSetGo_Set 3[];
|
||||
es.SayReadyGetSetGo_Go 4[];
|
||||
g 0 -1 1 2 #0f8[]{};
|
||||
g 2 -1 1 2 #0f8[]{};
|
||||
g 4 -1 0 2 #0f8[]{};
|
||||
@@ -143,13 +143,13 @@ g 1 4 4 1 [offset=4]{
|
||||
需要注意的是,跳过单发拍会跳过下一次**击拍**,而不是下一个循环节。
|
||||
|
||||
```rdview 7 4
|
||||
AddOneshotBeat 1[type=skipshot];
|
||||
AddOneshotBeat 5[];
|
||||
AddOneshotBeat 1 2[type=skipshot];
|
||||
AddOneshotBeat 3 2[tick=3];
|
||||
AddOneshotBeat 3.75 2[tick=2.25];
|
||||
AddOneshotBeat 4.5 2[tick=1.5];
|
||||
AddOneshotBeat 5.25 2[tick=0.75];
|
||||
eb.AddOneshotBeat 1[type=skipshot];
|
||||
eb.AddOneshotBeat 5[];
|
||||
eb.AddOneshotBeat 1 2[type=skipshot];
|
||||
eb.AddOneshotBeat 3 2[tick=3];
|
||||
eb.AddOneshotBeat 3.75 2[tick=2.25];
|
||||
eb.AddOneshotBeat 4.5 2[tick=1.5];
|
||||
eb.AddOneshotBeat 5.25 2[tick=0.75];
|
||||
```
|
||||
|
||||
另外,在剧情关卡中,跳过拍的位置如果按下空格会计算成失误,但编辑器中默认是不会失误的。
|
||||
@@ -167,10 +167,10 @@ AddOneshotBeat 5.25 2[tick=0.75];
|
||||
除此之外,方块单发拍也需要护士提示。这种护士提示与普通单发拍的提示类似,唯一的不同点在于最后的 Go 被替换为了 One。
|
||||
|
||||
```rdview 5 3
|
||||
AddOneshotBeat 3[];
|
||||
SayReadyGetSetGo 1 1[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 2 1[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 3 1[];
|
||||
eb.AddOneshotBeat 3[];
|
||||
es.SayReadyGetSetGo_Get 1 1[];
|
||||
es.SayReadyGetSetGo_Set 2 1[];
|
||||
es.SayReadyGetSetGo_One 3 1[];
|
||||
```
|
||||
|
||||
如果相同拍长的方块单发拍连续出现了多次,无需为每次出现添加完整的护士提示。可以逐步减少护士提示,直到完全没有护士提示,只剩下特殊提示音。
|
||||
@@ -186,32 +186,32 @@ SayReadyGetSetGo 3 1[];
|
||||

|
||||
|
||||
```rdview 4 5
|
||||
AddOneshotBeat 1[type=subdivision,subdivision=2];
|
||||
AddOneshotBeat 1 1[type=subdivision,subdivision=3];
|
||||
AddOneshotBeat 1 2[type=subdivision,subdivision=4];
|
||||
AddOneshotBeat 1 3[type=subdivision,subdivision=5];
|
||||
eb.AddOneshotBeat 1[type=subdivision,subdivision=2];
|
||||
eb.AddOneshotBeat 1 1[type=subdivision,subdivision=3];
|
||||
eb.AddOneshotBeat 1 2[type=subdivision,subdivision=4];
|
||||
eb.AddOneshotBeat 1 3[type=subdivision,subdivision=5];
|
||||
```
|
||||
|
||||
在护士提示方面,不同于方块单发拍,细分拍需要在出拍前的半拍长开始数拍提示。
|
||||
|
||||
```rdview 13
|
||||
AddOneshotBeat 1[type=subdivision,subdivision=2];
|
||||
eb.AddOneshotBeat 1[type=subdivision,subdivision=2];
|
||||
g 1 1 0.5 1 #0f0[]{};
|
||||
g 1 1 1 1 #0f0[]{};
|
||||
g 0.5 1 0.5 1[offset=0.5]{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=Count2];
|
||||
es.SayReadyGetSetGo_2 0 1[];
|
||||
};
|
||||
AddOneshotBeat 4[tick=2,type=subdivision,subdivision=2,interval=4];
|
||||
eb.AddOneshotBeat 4[tick=2,type=subdivision,subdivision=2,interval=4];
|
||||
g 4 1 1 1 #0f0[]{};
|
||||
g 4 1 2 1 #0f0[]{};
|
||||
g 3 1 1 1[offset=1]{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=Count2];
|
||||
es.SayReadyGetSetGo_2 0 1[];
|
||||
};
|
||||
AddOneshotBeat 9[tick=2,type=subdivision,subdivision=3,interval=4];
|
||||
eb.AddOneshotBeat 9[tick=2,type=subdivision,subdivision=3,interval=4];
|
||||
g 9 1 1 1 #0f0[]{};
|
||||
g 9 1 2 1 #0f0[]{};
|
||||
g 8 1 1 1[offset=1]{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=Count3];
|
||||
es.SayReadyGetSetGo_3 0 1[];
|
||||
};
|
||||
```
|
||||
|
||||
@@ -228,14 +228,14 @@ g 8 1 1 1[offset=1]{
|
||||
单独细分的提示**与正常单发拍的提示类似**,Rea Dy 或 Get Set 之间的间隔同样用于提示细分拍的拍长,且数字提示**和 Go! 提示一样不需要提前**。
|
||||
|
||||
```rdview 14 3
|
||||
AddOneshotBeat 3[type=subdivision,subdivision=2];
|
||||
SayReadyGetSetGo 1 1[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 2 1[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 3 1[phraseToSay=Count2];
|
||||
AddOneshotBeat 9[tick=2,type=subdivision,subdivision=4,interval=4];
|
||||
SayReadyGetSetGo 5 1[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 7 1[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 9 1[phraseToSay=Count4];
|
||||
eb.AddOneshotBeat 3[type=subdivision,subdivision=2];
|
||||
es.SayReadyGetSetGo_Get 1 1[];
|
||||
es.SayReadyGetSetGo_Set 2 1[];
|
||||
es.SayReadyGetSetGo_2 3 1[];
|
||||
eb.AddOneshotBeat 9[tick=2,type=subdivision,subdivision=4,interval=4];
|
||||
es.SayReadyGetSetGo_Get 5 1[];
|
||||
es.SayReadyGetSetGo_Set 7 1[];
|
||||
es.SayReadyGetSetGo_4 9 1[];
|
||||
```
|
||||
|
||||
## 冻结拍🧊
|
||||
@@ -249,14 +249,14 @@ SayReadyGetSetGo 9 1[phraseToSay=Count4];
|
||||

|
||||
|
||||
```rdview 8 2
|
||||
AddOneshotBeat 2[type=freezeshot,delay=0.5,interval=2];
|
||||
AddOneshotBeat 5[type=freezeshot,delay=0.5,interval=2,tick=2];
|
||||
eb.AddOneshotBeat 2[type=freezeshot,delay=0.5,interval=2];
|
||||
eb.AddOneshotBeat 5[type=freezeshot,delay=0.5,interval=2,tick=2];
|
||||
```
|
||||
|
||||
对于一个冻结拍而言,一共有五个关键的时间点:左十字,右十字,出拍点(绿线),原按拍点(蓝线),实际按拍点(黄线)。
|
||||
|
||||
```rdview 4 2
|
||||
AddOneshotBeat 2[type=freezeshot,delay=0.5,interval=2];
|
||||
eb.AddOneshotBeat 2[type=freezeshot,delay=0.5,interval=2];
|
||||
```
|
||||
|
||||
- **左十字**和**右十字**会显示两次冰冻特效并分别播放不同的冰冻音效,用于预示拍延长的时间。
|
||||
@@ -274,20 +274,20 @@ AddOneshotBeat 2[type=freezeshot,delay=0.5,interval=2];
|
||||
- **左十字**必须和上一个普通单发拍的按拍位置重合。
|
||||
|
||||
```rdview 5 3
|
||||
AddOneshotBeat 1[];
|
||||
AddOneshotBeat 3[type=freezeshot,delay=0.5,interval=2];
|
||||
AddOneshotBeat 1 1[grayscale=100,offset_grayscale=80];
|
||||
AddOneshotBeat 3 1[grayscale=100,offset_grayscale=80];
|
||||
eb.AddOneshotBeat 1[];
|
||||
eb.AddOneshotBeat 3[type=freezeshot,delay=0.5,interval=2];
|
||||
eb.AddOneshotBeat 1 1[grayscale=100,offset_grayscale=80];
|
||||
eb.AddOneshotBeat 3 1[grayscale=100,offset_grayscale=80];
|
||||
```
|
||||
|
||||
如果需要在冻结拍上叠加多个拍子来凸显鼓点,可以将他们的按拍点放在同一位置。
|
||||
|
||||
```rdview 5 3
|
||||
AddOneshotBeat 2[type=freezeshot,delay=0.5,interval=2];
|
||||
eb.AddOneshotBeat 2[type=freezeshot,delay=0.5,interval=2];
|
||||
g 2 -1 2 2 #0000[offset=0 1]{
|
||||
AddOneshotBeat 0.5 1[];
|
||||
eb.AddOneshotBeat 0.5 1[];
|
||||
g 0 -2 2 3 #0000[offset=0 1]{
|
||||
AddOneshotBeat -1 3[tick=2.5];
|
||||
eb.AddOneshotBeat -1 3[tick=2.5];
|
||||
};
|
||||
};
|
||||
```
|
||||
@@ -305,7 +305,7 @@ g 2 -1 2 2 #0000[offset=0 1]{
|
||||
类似地,对于一个灼热拍,一共有四个关键的时间点:左十字,右十字,出拍点(绿线),按拍点。为作区分且方便表述,将会把按拍点称为红线。
|
||||
|
||||
```rdview 5 2
|
||||
AddOneshotBeat 3[tick=0.5,type=burnshot,interval=2];
|
||||
eb.AddOneshotBeat 3[tick=0.5,type=burnshot,interval=2];
|
||||
```
|
||||
|
||||
- **左十字**和**右十字**会显示两次热浪特效并分别播放不同的灼热音效,用于预示拍实际的时间。
|
||||
@@ -320,20 +320,20 @@ AddOneshotBeat 3[tick=0.5,type=burnshot,interval=2];
|
||||
- **左十字**必须和上一个普通单发拍的原定出拍位置重合。
|
||||
|
||||
```rdview 5 3
|
||||
AddOneshotBeat 1[];
|
||||
AddOneshotBeat 3[tick=0.5,type=burnshot,interval=2];
|
||||
AddOneshotBeat 1 1[grayscale=100,offset_grayscale=80];
|
||||
AddOneshotBeat 3 1[grayscale=100,offset_grayscale=80];
|
||||
eb.AddOneshotBeat 1[];
|
||||
eb.AddOneshotBeat 3[tick=0.5,type=burnshot,interval=2];
|
||||
eb.AddOneshotBeat 1 1[grayscale=100,offset_grayscale=80];
|
||||
eb.AddOneshotBeat 3 1[grayscale=100,offset_grayscale=80];
|
||||
```
|
||||
|
||||
如果需要在灼热拍上叠加多个拍子来凸显鼓点,可以将他们的按拍点放在同一位置。
|
||||
|
||||
```rdview 5 3
|
||||
AddOneshotBeat 2[type=burnshot,delay=0.5,interval=2];
|
||||
eb.AddOneshotBeat 2[type=burnshot,delay=0.5,interval=2];
|
||||
g 0 -1 3 2 #0000[offset=0 1]{
|
||||
AddOneshotBeat 1.5 1[tick=1.5];
|
||||
eb.AddOneshotBeat 1.5 1[tick=1.5];
|
||||
g 0 -1 3 3 #0000[offset=0 1]{
|
||||
AddOneshotBeat 0.5 2[tick=2.5];
|
||||
eb.AddOneshotBeat 0.5 2[tick=2.5];
|
||||
};
|
||||
};
|
||||
```
|
||||
@@ -387,32 +387,32 @@ g 0 -1 3 2 #0000[offset=0 1]{
|
||||
最后我们针对细分拍、冻结拍、灼热拍做一个技术总结:
|
||||
|
||||
```rdview 19 7
|
||||
AddOneshotBeat 1[loop=1];
|
||||
AddOneshotBeat 5[type=freezeshot,delay=0.5,interval=2];
|
||||
AddOneshotBeat 1 1[loop=1];
|
||||
AddOneshotBeat 5 1[];
|
||||
AddOneshotBeat 1 2[loop=1];
|
||||
AddOneshotBeat 5 2[tick=0.5,type=burnshot,interval=2];
|
||||
AddOneshotBeat 1 4[loop=1];
|
||||
AddOneshotBeat 5 4[tick=1,type=subdivision,subdivision=2,interval=2];
|
||||
AddOneshotBeat 7 4[tick=0.5,loop=1,interval=1];
|
||||
AddOneshotBeat 9 4[tick=0.5,type=subdivision,subdivision=2,interval=1];
|
||||
AddOneshotBeat 10 4[tick=2];
|
||||
AddOneshotBeat 14 4[tick=2,type=subdivision,subdivision=3,interval=4];
|
||||
eb.AddOneshotBeat 1[loop=1];
|
||||
eb.AddOneshotBeat 5[type=freezeshot,delay=0.5,interval=2];
|
||||
eb.AddOneshotBeat 1 1[loop=1];
|
||||
eb.AddOneshotBeat 5 1[];
|
||||
eb.AddOneshotBeat 1 2[loop=1];
|
||||
eb.AddOneshotBeat 5 2[tick=0.5,type=burnshot,interval=2];
|
||||
eb.AddOneshotBeat 1 4[loop=1];
|
||||
eb.AddOneshotBeat 5 4[tick=1,type=subdivision,subdivision=2,interval=2];
|
||||
eb.AddOneshotBeat 7 4[tick=0.5,loop=1,interval=1];
|
||||
eb.AddOneshotBeat 9 4[tick=0.5,type=subdivision,subdivision=2,interval=1];
|
||||
eb.AddOneshotBeat 10 4[tick=2];
|
||||
eb.AddOneshotBeat 14 4[tick=2,type=subdivision,subdivision=3,interval=4];
|
||||
g 5 5 0.5 1 #0f0[]{};
|
||||
g 5 5 1 1 #0f0[]{};
|
||||
g 4.5 5 0.5 1[offset=0.5]{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=Count2];
|
||||
es.SayReadyGetSetGo_2 0 1[];
|
||||
};
|
||||
g 9 5 0.25 1 #0f0[]{};
|
||||
g 9 5 0.5 1 #0f0[]{};
|
||||
g 8.75 5 0.25 1[offset=0.25]{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=Count2];
|
||||
es.SayReadyGetSetGo_2 0 1[];
|
||||
};
|
||||
g 14 5 1 1 #0f0[]{};
|
||||
g 14 5 2 1 #0f0[]{};
|
||||
g 13 5 1 1[offset=1]{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=Count2];
|
||||
es.SayReadyGetSetGo_2 0 1[];
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
+68
-68
@@ -15,14 +15,14 @@
|
||||
在“**循环**”的空栏里输入次数,这个单发拍就会被**额外**重复这么多次。当然了,直接输入循环次数的方法并不够方便,因为很多时候不听具体音乐自己也不知道该循环多少次。更方便的方法是,把鼠标移动到工作区的这个单发拍子上,右上角就会出现一个**红色的箭头符号**,按住它并拖动即可。
|
||||
|
||||
```rdview 7 3
|
||||
AddOneshotBeat 1 1[tick=1,loop=2];
|
||||
eb.AddOneshotBeat 1 1[tick=1,loop=2];
|
||||
```
|
||||
|
||||
在循环设置后,左上角又会多出一个“**间隔**”的设置,指的是两个绿线之间的时间长度。大多数时候,我们会将间隔设为拍长的两倍,这也就构成了一个普通单发拍子。但如果你想设计更为复杂的单发拍子节奏型,也可以试着将间隔改为其他数值:例如,把间隔改成`1`,拍长改成`0.75`,就变成了一种摇摆单发拍子。
|
||||
|
||||
```rdview 10 3
|
||||
AddOneshotBeat 1 1[loop=1];
|
||||
AddOneshotBeat 5 1[tick=0.75,loop=3,interval=1];
|
||||
eb.AddOneshotBeat 1 1[loop=1];
|
||||
eb.AddOneshotBeat 5 1[tick=0.75,loop=3,interval=1];
|
||||
```
|
||||
|
||||
配置好带有循环的单发拍之后,按一下“**分解为单发节拍**”,会发现它被拆散成了若干个没有循环的单发拍事件。分解后的单发拍更加便于修改,你可以为它们单独添加修饰符或额外的脉冲。
|
||||
@@ -42,80 +42,80 @@ AddOneshotBeat 5 1[tick=0.75,loop=3,interval=1];
|
||||
将护士语音的拍长与单发拍的拍长保持一致,并将护士**喊出`Go!`的位置**与 **第一个普通单发拍的脉冲位置** 对齐即可,这样就完成了对一个普通单发拍的提示。
|
||||
|
||||
```rdview 16 12
|
||||
AddOneshotBeat 5 1[tick=2];
|
||||
AddOneshotBeat 9 1[tick=2];
|
||||
AddOneshotBeat 13 1[tick=2];
|
||||
eb.AddOneshotBeat 5 1[tick=2];
|
||||
eb.AddOneshotBeat 9 1[tick=2];
|
||||
eb.AddOneshotBeat 13 1[tick=2];
|
||||
g 1 2 4 1[offset=4 0]{
|
||||
g 0 -1 0 2 #0f08{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSayGet];
|
||||
es.SayReadyGetSetGo_Get 0 1;
|
||||
};
|
||||
g 2 -1 0 2 #ff08{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSaySet];
|
||||
es.SayReadyGetSetGo_Set 0 1;
|
||||
};
|
||||
g 4 -1 0 2 #f008{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSayGo];
|
||||
es.SayReadyGetSetGo_Go 0 1;
|
||||
};
|
||||
};
|
||||
AddOneshotBeat 5 4;
|
||||
AddOneshotBeat 7 4;
|
||||
AddOneshotBeat 9 4;
|
||||
AddOneshotBeat 11 4;
|
||||
AddOneshotBeat 13 4;
|
||||
eb.AddOneshotBeat 5 4;
|
||||
eb.AddOneshotBeat 7 4;
|
||||
eb.AddOneshotBeat 9 4;
|
||||
eb.AddOneshotBeat 11 4;
|
||||
eb.AddOneshotBeat 13 4;
|
||||
g 1 5 4 2[offset=4 0]{
|
||||
SayReadyGetSetGo 0 0[phraseToSay=SayReaDyGetSetGoNew];
|
||||
es.SayReadyGetSetGo_ReaDyGetSetGo 0 0;
|
||||
g 0 -1 0 3 #0f08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayRea];
|
||||
es.SayReadyGetSetGo_Rea 0 2;
|
||||
};
|
||||
g 1 -1 0 3 #ff08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayDy];
|
||||
es.SayReadyGetSetGo_Dy 0 2;
|
||||
};
|
||||
g 2 -1 0 3 #0f08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayGet];
|
||||
es.SayReadyGetSetGo_Get 0 2;
|
||||
};
|
||||
g 3 -1 0 3 #ff08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSaySet];
|
||||
es.SayReadyGetSetGo_Set 0 2;
|
||||
};
|
||||
g 4 -1 0 3 #F008{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayGo];
|
||||
es.SayReadyGetSetGo_Go 0 2;
|
||||
};
|
||||
};
|
||||
AddOneshotBeat 5 8[tick=0.5];
|
||||
AddOneshotBeat 6 8[tick=0.5];
|
||||
AddOneshotBeat 7 8[tick=0.5];
|
||||
AddOneshotBeat 8 8[tick=0.5];
|
||||
AddOneshotBeat 9 8[tick=0.5];
|
||||
AddOneshotBeat 10 8[tick=0.5];
|
||||
AddOneshotBeat 11 8[tick=0.5];
|
||||
AddOneshotBeat 12 8[tick=0.5];
|
||||
AddOneshotBeat 13 8[tick=0.5];
|
||||
AddOneshotBeat 14 8[tick=0.5];
|
||||
eb.AddOneshotBeat 5 8[tick=0.5];
|
||||
eb.AddOneshotBeat 6 8[tick=0.5];
|
||||
eb.AddOneshotBeat 7 8[tick=0.5];
|
||||
eb.AddOneshotBeat 8 8[tick=0.5];
|
||||
eb.AddOneshotBeat 9 8[tick=0.5];
|
||||
eb.AddOneshotBeat 10 8[tick=0.5];
|
||||
eb.AddOneshotBeat 11 8[tick=0.5];
|
||||
eb.AddOneshotBeat 12 8[tick=0.5];
|
||||
eb.AddOneshotBeat 13 8[tick=0.5];
|
||||
eb.AddOneshotBeat 14 8[tick=0.5];
|
||||
g 1 9 4 2[offset=4 0]{
|
||||
g 0 -1 0 2 #0f08{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSayRea];
|
||||
es.SayReadyGetSetGo_Rea 0 1;
|
||||
};
|
||||
g 0.5 -1 0 3 #ff08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayDy];
|
||||
es.SayReadyGetSetGo_Dy 0 2;
|
||||
};
|
||||
g 1 -1 0 2 #0f08{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSayRea];
|
||||
es.SayReadyGetSetGo_Rea 0 1;
|
||||
};
|
||||
g 1.5 -1 0 3 #ff08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayDy];
|
||||
es.SayReadyGetSetGo_Dy 0 2;
|
||||
};
|
||||
g 2 -1 0 2 #0f08{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSayRea];
|
||||
es.SayReadyGetSetGo_Rea 0 1;
|
||||
};
|
||||
g 2.5 -1 0 3 #ff08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSayDy];
|
||||
es.SayReadyGetSetGo_Dy 0 2;
|
||||
};
|
||||
g 3 -1 0 2 #0f08{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSayGet];
|
||||
es.SayReadyGetSetGo_Get 0 1;
|
||||
};
|
||||
g 3.5 -1 0 3 #ff08{
|
||||
SayReadyGetSetGo 0 2[phraseToSay=JustSaySet];
|
||||
es.SayReadyGetSetGo_Set 0 2;
|
||||
};
|
||||
g 4 -1 0 2 #F008{
|
||||
SayReadyGetSetGo 0 1[phraseToSay=JustSayGo];
|
||||
es.SayReadyGetSetGo_Go 0 1;
|
||||
};
|
||||
};
|
||||
```
|
||||
@@ -131,30 +131,30 @@ g 1 9 4 2[offset=4 0]{
|
||||
也可以让单发拍子在几种拍速之间来回切换,提示方法与前面所讲的相同。只需要注意一点:单发拍子的节奏型应该在**Go!的瞬间**完成切换,Go之前的护士提示不会影响当前正在进行的单发拍子,而 Go 之后也不应再出现前一种单发拍子的节拍。
|
||||
|
||||
```rdview 20 5
|
||||
AddOneshotBeat 3 1;
|
||||
AddOneshotBeat 5 1;
|
||||
AddOneshotBeat 7 1[tick=0.5];
|
||||
AddOneshotBeat 8 1[tick=0.5];
|
||||
AddOneshotBeat 9 1[tick=0.5];
|
||||
AddOneshotBeat 10 1[tick=0.5];
|
||||
AddOneshotBeat 11 1;
|
||||
AddOneshotBeat 13 1;
|
||||
AddOneshotBeat 15 1[tick=0.75];
|
||||
AddOneshotBeat 16 1[tick=0.75];
|
||||
AddOneshotBeat 17 1[tick=0.75];
|
||||
AddOneshotBeat 18 1[tick=0.75];
|
||||
SayReadyGetSetGo 1 2[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 2 2[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 3 2[phraseToSay=JustSayGo];
|
||||
SayReadyGetSetGo 6 2[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 6.5 3[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 7 2[phraseToSay=JustSayGo];
|
||||
SayReadyGetSetGo 9 2[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 10 2[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 11 2[phraseToSay=JustSayGo];
|
||||
SayReadyGetSetGo 14 2[phraseToSay=JustSayGet];
|
||||
SayReadyGetSetGo 14.75 3[phraseToSay=JustSaySet];
|
||||
SayReadyGetSetGo 15 2[phraseToSay=JustSayGo];
|
||||
eb.AddOneshotBeat 3 1;
|
||||
eb.AddOneshotBeat 5 1;
|
||||
eb.AddOneshotBeat 7 1[tick=0.5];
|
||||
eb.AddOneshotBeat 8 1[tick=0.5];
|
||||
eb.AddOneshotBeat 9 1[tick=0.5];
|
||||
eb.AddOneshotBeat 10 1[tick=0.5];
|
||||
eb.AddOneshotBeat 11 1;
|
||||
eb.AddOneshotBeat 13 1;
|
||||
eb.AddOneshotBeat 15 1[tick=0.75];
|
||||
eb.AddOneshotBeat 16 1[tick=0.75];
|
||||
eb.AddOneshotBeat 17 1[tick=0.75];
|
||||
eb.AddOneshotBeat 18 1[tick=0.75];
|
||||
es.SayReadyGetSetGo_Get 1 2;
|
||||
es.SayReadyGetSetGo_Set 2 2;
|
||||
es.SayReadyGetSetGo_Go 3 2;
|
||||
es.SayReadyGetSetGo_Get 6 2;
|
||||
es.SayReadyGetSetGo_Set 6.5 3;
|
||||
es.SayReadyGetSetGo_Go 7 2;
|
||||
es.SayReadyGetSetGo_Get 9 2;
|
||||
es.SayReadyGetSetGo_Set 10 2;
|
||||
es.SayReadyGetSetGo_Go 11 2;
|
||||
es.SayReadyGetSetGo_Get 14 2;
|
||||
es.SayReadyGetSetGo_Set 14.75 3;
|
||||
es.SayReadyGetSetGo_Go 15 2;
|
||||
```
|
||||
|
||||
一个单发拍子不可能无限循环下去,总会有停下来的时候,可以使用护士提示中的`Stop`告知玩家单发拍子的结束。通常情况下,应使`Stop`对齐单发拍子的**最后一次击拍位置**。
|
||||
@@ -164,12 +164,12 @@ SayReadyGetSetGo 15 2[phraseToSay=JustSayGo];
|
||||
如果单发拍子的停止时机足够符合直觉,可以省略单发拍子的Stop,但必须保证玩家下意识多打出的拍子不会判Miss。最稳妥的方法永远是为所有单发拍子的停止都添加 Stop 提示。
|
||||
|
||||
```rdview 10 3
|
||||
AddClassicBeat 2.5[tick=1];
|
||||
AddOneshotBeat 1 1[];
|
||||
AddOneshotBeat 3 1[];
|
||||
AddOneshotBeat 5 1[];
|
||||
eb.AddClassicBeat 2.5[tick=6];
|
||||
eb.AddOneshotBeat 1 1[];
|
||||
eb.AddOneshotBeat 3 1[];
|
||||
eb.AddOneshotBeat 5 1[];
|
||||
g 7 1 1 1{
|
||||
AddOneshotBeat[grayscale=100];
|
||||
eb.AddOneshotBeat[grayscale=100];
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
+190
-190
@@ -9,58 +9,58 @@
|
||||
```rdview 18 3
|
||||
g 1 0 4 2 #ff0{
|
||||
g 0 -1 0 3 #08f[]{};
|
||||
MoveRow [tag=action];
|
||||
MoveRow 1[tag=action];
|
||||
MoveCamera 2[tag=action];
|
||||
Flash 2.5[tag=action];
|
||||
HideRow 0 1[tag=action];
|
||||
SetVFXPreset 1.5 1[tag=action];
|
||||
SetVFXPreset 2 1[tag=action];
|
||||
HideRow 3 1[tag=action];
|
||||
ea.MoveRow [tag=true];
|
||||
ea.MoveRow 1[tag=true];
|
||||
ea.MoveCamera 2[tag=true];
|
||||
ea.Flash 2.5[tag=true];
|
||||
ea.HideRow 0 1[tag=true];
|
||||
ea.SetVFXPreset 1.5 1[tag=true];
|
||||
ea.SetVFXPreset 2 1[tag=true];
|
||||
ea.HideRow 3 1[tag=true];
|
||||
|
||||
g 5 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[offset_opacity=0,Tag=action];
|
||||
ea.TagAction[offset_opacity=0];
|
||||
g 0 1 4 2 #ff0[opacity=0,offset_opacity=100]{
|
||||
g 0 -1 0 3 #08f[]{};
|
||||
g 0 -1 1 1 #0000[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
MoveCamera 2[];
|
||||
Flash 2.5[];
|
||||
HideRow 0 1[];
|
||||
SetVFXPreset 1.5 1[];
|
||||
SetVFXPreset 2 1[];
|
||||
HideRow 3 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
ea.MoveCamera 2[];
|
||||
ea.Flash 2.5[];
|
||||
ea.HideRow 0 1[];
|
||||
ea.SetVFXPreset 1.5 1[];
|
||||
ea.SetVFXPreset 2 1[];
|
||||
ea.HideRow 3 1[];
|
||||
};
|
||||
};
|
||||
g 9 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[offset_opacity=0,Tag=action];
|
||||
ea.TagAction[];
|
||||
g 0 1 4 2 #ff0[opacity=0,offset_opacity=100]{
|
||||
g 0 -1 0 3 #08f[]{};
|
||||
g 0 -1 1 1 #0000[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
MoveCamera 2[];
|
||||
Flash 2.5[];
|
||||
HideRow 0 1[];
|
||||
SetVFXPreset 1.5 1[];
|
||||
SetVFXPreset 2 1[];
|
||||
HideRow 3 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
ea.MoveCamera 2[];
|
||||
ea.Flash 2.5[];
|
||||
ea.HideRow 0 1[];
|
||||
ea.SetVFXPreset 1.5 1[];
|
||||
ea.SetVFXPreset 2 1[];
|
||||
ea.HideRow 3 1[];
|
||||
};
|
||||
};
|
||||
g 13 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[offset_opacity=0,Tag=action];
|
||||
ea.TagAction[];
|
||||
g 0 1 4 2 #ff0[opacity=0,offset_opacity=100]{
|
||||
g 0 -1 0 3 #08f[]{};
|
||||
g 0 -1 1 1 #0000[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
MoveCamera 2[];
|
||||
Flash 2.5[];
|
||||
HideRow 0 1[];
|
||||
SetVFXPreset 1.5 1[];
|
||||
SetVFXPreset 2 1[];
|
||||
HideRow 3 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
ea.MoveCamera 2[];
|
||||
ea.Flash 2.5[];
|
||||
ea.HideRow 0 1[];
|
||||
ea.SetVFXPreset 1.5 1[];
|
||||
ea.SetVFXPreset 2 1[];
|
||||
ea.HideRow 3 1[];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -111,75 +111,75 @@ g 1 0 4 2 #ff0{
|
||||
```rdview 16 5
|
||||
g 1 1 2 1 #df0{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
MoveRow [tag=move];
|
||||
MoveRow 1[tag=move];
|
||||
ea.MoveRow [tag=true];
|
||||
ea.MoveRow 1[tag=true];
|
||||
|
||||
g 4 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[Tag=move];
|
||||
ea.TagAction[];
|
||||
g 0 1 2 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
g 0 -1 1 1 #0000[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
};
|
||||
};
|
||||
g 6 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[Tag=move];
|
||||
ea.TagAction[];
|
||||
g 0 1 2 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
g 0 -1 1 1 #0000[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
};
|
||||
};
|
||||
g 8 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[Tag=move];
|
||||
ea.TagAction[];
|
||||
g 0 1 2 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
g 0 -1 1 1 #0000[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
};
|
||||
};
|
||||
g 10 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[Tag=move];
|
||||
ea.TagAction[];
|
||||
g 0 1 2 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
g 0 -1 1 1 #0000[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
};
|
||||
};
|
||||
};
|
||||
g 1 3 3 1 #df0{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
MoveRow [tag=move];
|
||||
MoveRow 1[tag=move];
|
||||
TagAction 2[tag=move];
|
||||
ea.MoveRow [tag=true];
|
||||
ea.MoveRow 1[tag=true];
|
||||
ea.TagAction 2[tag=true];
|
||||
g 4 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[offset_opacity=0,Tag=move];
|
||||
ea.TagAction[offset_opacity=0];
|
||||
g 0 1 3 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
g 2 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[offset_opacity=0,Tag=move];
|
||||
ea.TagAction[];
|
||||
g 0 1 2 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
g 2 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[offset_opacity=0,Tag=move];
|
||||
ea.TagAction[];
|
||||
g 0 1 2 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
g 2 0 0 0 #0000[offset=0 -1]{
|
||||
TagAction[offset_opacity=0,Tag=move];
|
||||
ea.TagAction[];
|
||||
g 0 1 2 1 #ff0[opacity=20,offset_opacity=100]{
|
||||
g 0 -1 0 2 #08f[]{};
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
g -6 -4 1 5 #0000[]{};
|
||||
};
|
||||
};
|
||||
@@ -189,7 +189,7 @@ g 1 3 3 1 #df0{
|
||||
};
|
||||
};
|
||||
};
|
||||
TagAction 12[];
|
||||
ea.TagAction 12[];
|
||||
};
|
||||
```
|
||||
|
||||
@@ -211,143 +211,143 @@ g 1 3 3 1 #df0{
|
||||
|
||||
```rdview 19 4
|
||||
g 0 0 19 1 #f00[]{
|
||||
Comment [color=ffff00];
|
||||
FloatingText 0.5[outlineColor=000000];
|
||||
FloatingText 1[outlineColor=000000];
|
||||
FloatingText 1.5[outlineColor=000000];
|
||||
FloatingText 2[outlineColor=000000];
|
||||
FloatingText 2.5[outlineColor=000000];
|
||||
FloatingText 3[outlineColor=000000];
|
||||
FloatingText 3.5[outlineColor=000000];
|
||||
FloatingText 4[outlineColor=000000];
|
||||
AdvanceText 4.5[];
|
||||
AdvanceText 5[];
|
||||
AdvanceText 5.5[];
|
||||
AdvanceText 6[];
|
||||
AdvanceText 6.5[];
|
||||
AdvanceText 7[];
|
||||
AdvanceText 7.5[];
|
||||
FloatingText 8[outlineColor=000000];
|
||||
FloatingText 8.75[outlineColor=000000];
|
||||
Comment 9.75[tab=Actions];
|
||||
FloatingText 11.75[outlineColor=000000];
|
||||
FloatingText 12.5[outlineColor=000000];
|
||||
FloatingText 13.5[outlineColor=000000];
|
||||
FloatingText 14[outlineColor=000000];
|
||||
FloatingText 14.5[outlineColor=000000];
|
||||
FloatingText 15[outlineColor=000000];
|
||||
FloatingText 15.5[outlineColor=000000];
|
||||
FloatingText 16[outlineColor=000000];
|
||||
FloatingText 16.5[outlineColor=000000];
|
||||
FloatingText 17[outlineColor=000000];
|
||||
FloatingText 17.5[outlineColor=000000];
|
||||
ea.Comment [];
|
||||
ea.FloatingText 0.5[];
|
||||
ea.FloatingText 1[];
|
||||
ea.FloatingText 1.5[];
|
||||
ea.FloatingText 2[];
|
||||
ea.FloatingText 2.5[];
|
||||
ea.FloatingText 3[];
|
||||
ea.FloatingText 3.5[];
|
||||
ea.FloatingText 4[];
|
||||
ea.AdvanceText 4.5[];
|
||||
ea.AdvanceText 5[];
|
||||
ea.AdvanceText 5.5[];
|
||||
ea.AdvanceText 6[];
|
||||
ea.AdvanceText 6.5[];
|
||||
ea.AdvanceText 7[];
|
||||
ea.AdvanceText 7.5[];
|
||||
ea.FloatingText 8[];
|
||||
ea.FloatingText 8.75[];
|
||||
ea.Comment 9.75[];
|
||||
ea.FloatingText 11.75[];
|
||||
ea.FloatingText 12.5[];
|
||||
ea.FloatingText 13.5[];
|
||||
ea.FloatingText 14[];
|
||||
ea.FloatingText 14.5[];
|
||||
ea.FloatingText 15[];
|
||||
ea.FloatingText 15.5[];
|
||||
ea.FloatingText 16[];
|
||||
ea.FloatingText 16.5[];
|
||||
ea.FloatingText 17[];
|
||||
ea.FloatingText 17.5[];
|
||||
};
|
||||
g 0 1 6.25 1 #08f[]{
|
||||
MoveCamera [];
|
||||
MoveCamera 0.5[];
|
||||
MoveCamera 1[];
|
||||
MoveCamera 1.5[];
|
||||
MoveCamera 2[];
|
||||
MoveCamera 2.5[];
|
||||
MoveCamera 3[];
|
||||
MoveCamera 3.5[];
|
||||
MoveCamera 4[];
|
||||
MoveCamera 5[];
|
||||
SetForeground 5.25[];
|
||||
ea.MoveCamera [];
|
||||
ea.MoveCamera 0.5[];
|
||||
ea.MoveCamera 1[];
|
||||
ea.MoveCamera 1.5[];
|
||||
ea.MoveCamera 2[];
|
||||
ea.MoveCamera 2.5[];
|
||||
ea.MoveCamera 3[];
|
||||
ea.MoveCamera 3.5[];
|
||||
ea.MoveCamera 4[];
|
||||
ea.MoveCamera 5[];
|
||||
ea.SetForeground 5.25[];
|
||||
};
|
||||
Comment 6.25 1[tab=Actions];
|
||||
MoveRow 7.75 1[];
|
||||
MoveRow 8 1[];
|
||||
MoveRow 8.75 1[];
|
||||
MoveCamera 12 1[];
|
||||
SetForeground 12.25 1[];
|
||||
FloatingText 14.5 1[outlineColor=000000];
|
||||
FloatingText 15 1[outlineColor=000000];
|
||||
FloatingText 15.5 1[outlineColor=000000];
|
||||
FloatingText 16 1[outlineColor=000000];
|
||||
FloatingText 16.5 1[outlineColor=000000];
|
||||
SetVFXPreset 18 1[];
|
||||
ea.Comment 6.25 1[];
|
||||
ea.MoveRow 7.75 1[];
|
||||
ea.MoveRow 8 1[];
|
||||
ea.MoveRow 8.75 1[];
|
||||
ea.MoveCamera 12 1[];
|
||||
ea.SetForeground 12.25 1[];
|
||||
ea.FloatingText 14.5 1[];
|
||||
ea.FloatingText 15 1[];
|
||||
ea.FloatingText 15.5 1[];
|
||||
ea.FloatingText 16 1[];
|
||||
ea.FloatingText 16.5 1[];
|
||||
ea.SetVFXPreset 18 1[];
|
||||
g 0 2 13.875 1 #06f[]{
|
||||
MoveRow [];
|
||||
MoveRow [];
|
||||
Comment 1.75[tab=Actions];
|
||||
MoveRow 2.75[];
|
||||
MoveRow 3[];
|
||||
MoveRow 4.5[];
|
||||
MoveRow 4.75[];
|
||||
MoveRow 5[];
|
||||
MoveRow 5.25[];
|
||||
MoveRow 6.75[];
|
||||
MoveRow 7[];
|
||||
MoveRow 7.5[];
|
||||
MoveRow 7.75[];
|
||||
MoveRow 8.5[];
|
||||
MoveRow 10[];
|
||||
MoveRow 10.25[];
|
||||
HideRow 11.5[];
|
||||
HideRow 11.5[];
|
||||
MoveRow 12.5[];
|
||||
MoveRow 12.75[];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow [];
|
||||
ea.Comment 1.75[];
|
||||
ea.MoveRow 2.75[];
|
||||
ea.MoveRow 3[];
|
||||
ea.MoveRow 4.5[];
|
||||
ea.MoveRow 4.75[];
|
||||
ea.MoveRow 5[];
|
||||
ea.MoveRow 5.25[];
|
||||
ea.MoveRow 6.75[];
|
||||
ea.MoveRow 7[];
|
||||
ea.MoveRow 7.5[];
|
||||
ea.MoveRow 7.75[];
|
||||
ea.MoveRow 8.5[];
|
||||
ea.MoveRow 10[];
|
||||
ea.MoveRow 10.25[];
|
||||
ea.HideRow 11.5[];
|
||||
ea.HideRow 11.5[];
|
||||
ea.MoveRow 12.5[];
|
||||
ea.MoveRow 12.75[];
|
||||
};
|
||||
Comment 14 2[tab=Actions];
|
||||
ea.Comment 14 2[];
|
||||
g 0 3 18 1 #f80[]{
|
||||
FloatingText 0.5[outlineColor=000000];
|
||||
AdvanceText 1[];
|
||||
AdvanceText 1.5[];
|
||||
AdvanceText 2.5[];
|
||||
AdvanceText 3[];
|
||||
AdvanceText 4.5[];
|
||||
AdvanceText 5[];
|
||||
AdvanceText 5.5[];
|
||||
AdvanceText 6[];
|
||||
AdvanceText 6.5[];
|
||||
AdvanceText 7[];
|
||||
AdvanceText 8[];
|
||||
AdvanceText 10.5[];
|
||||
AdvanceText 11.5[];
|
||||
AdvanceText 12[];
|
||||
AdvanceText 12.5[];
|
||||
AdvanceText 13[];
|
||||
AdvanceText 13.5[];
|
||||
AdvanceText 14[];
|
||||
AdvanceText 14.5[];
|
||||
AdvanceText 15[];
|
||||
AdvanceText 15.5[];
|
||||
AdvanceText 16[];
|
||||
AdvanceText 16.5[];
|
||||
AdvanceText 17[];
|
||||
AdvanceText 17.5[];
|
||||
ea.FloatingText 0.5[];
|
||||
ea.AdvanceText 1[];
|
||||
ea.AdvanceText 1.5[];
|
||||
ea.AdvanceText 2.5[];
|
||||
ea.AdvanceText 3[];
|
||||
ea.AdvanceText 4.5[];
|
||||
ea.AdvanceText 5[];
|
||||
ea.AdvanceText 5.5[];
|
||||
ea.AdvanceText 6[];
|
||||
ea.AdvanceText 6.5[];
|
||||
ea.AdvanceText 7[];
|
||||
ea.AdvanceText 8[];
|
||||
ea.AdvanceText 10.5[];
|
||||
ea.AdvanceText 11.5[];
|
||||
ea.AdvanceText 12[];
|
||||
ea.AdvanceText 12.5[];
|
||||
ea.AdvanceText 13[];
|
||||
ea.AdvanceText 13.5[];
|
||||
ea.AdvanceText 14[];
|
||||
ea.AdvanceText 14.5[];
|
||||
ea.AdvanceText 15[];
|
||||
ea.AdvanceText 15.5[];
|
||||
ea.AdvanceText 16[];
|
||||
ea.AdvanceText 16.5[];
|
||||
ea.AdvanceText 17[];
|
||||
ea.AdvanceText 17.5[];
|
||||
};
|
||||
```
|
||||
|
||||
2. 如果有一串同类型的事件紧密排布,例如每1/4格或者1/2格放一个,那么可以考虑不放在同一行,而是上下交错排开。
|
||||
|
||||
```rdview 16 4
|
||||
MoveRow [];
|
||||
MoveRow 1[];
|
||||
MoveRow 2[];
|
||||
MoveRow 4[];
|
||||
MoveRow 5[];
|
||||
MoveRow 6[];
|
||||
MoveRow 8[];
|
||||
MoveRow 9[];
|
||||
MoveRow 10[];
|
||||
MoveRow 12[];
|
||||
MoveRow 13[];
|
||||
MoveRow 14[];
|
||||
MoveRow 0.5 1[];
|
||||
MoveRow 1.5 1[];
|
||||
MoveRow 3 1[];
|
||||
MoveRow 4.5 1[];
|
||||
MoveRow 5.5 1[];
|
||||
MoveRow 7 1[];
|
||||
MoveRow 8.5 1[];
|
||||
MoveRow 9.5 1[];
|
||||
MoveRow 11 1[];
|
||||
MoveRow 12.5 1[];
|
||||
MoveRow 13.5 1[];
|
||||
MoveRow 15 1[];
|
||||
Comment 4 3[tab=Actions];
|
||||
ea.MoveRow [];
|
||||
ea.MoveRow 1[];
|
||||
ea.MoveRow 2[];
|
||||
ea.MoveRow 4[];
|
||||
ea.MoveRow 5[];
|
||||
ea.MoveRow 6[];
|
||||
ea.MoveRow 8[];
|
||||
ea.MoveRow 9[];
|
||||
ea.MoveRow 10[];
|
||||
ea.MoveRow 12[];
|
||||
ea.MoveRow 13[];
|
||||
ea.MoveRow 14[];
|
||||
ea.MoveRow 0.5 1[];
|
||||
ea.MoveRow 1.5 1[];
|
||||
ea.MoveRow 3 1[];
|
||||
ea.MoveRow 4.5 1[];
|
||||
ea.MoveRow 5.5 1[];
|
||||
ea.MoveRow 7 1[];
|
||||
ea.MoveRow 8.5 1[];
|
||||
ea.MoveRow 9.5 1[];
|
||||
ea.MoveRow 11 1[];
|
||||
ea.MoveRow 12.5 1[];
|
||||
ea.MoveRow 13.5 1[];
|
||||
ea.MoveRow 15 1[];
|
||||
ea.Comment 4 3[];
|
||||
```
|
||||
|
||||
3. 对于事件总体数量不太高的情况,如果有操作房间和轨道类型的特效,可以考虑把他们放在对应数量的行里,找起来会更加方便。
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.5 KiB |
@@ -1,36 +0,0 @@
|
||||
window.$docsify = {
|
||||
name: "节奏医生编辑器教程",
|
||||
notFoundPage: "/404.md",
|
||||
homepage: "/pages/intro.md",
|
||||
loadSidebar: true,
|
||||
loadNavbar: true,
|
||||
coverpage: false,
|
||||
maxLevel: 5,
|
||||
subMaxLevel: 4,
|
||||
mergeNavbar: true,
|
||||
markdown: {
|
||||
renderer: {
|
||||
image: function (src, title, alt) {
|
||||
return `<div class="image-tip"><img class="medium-zoom-image" src="${src}" alt="${alt}">${
|
||||
alt ? `<p>${alt}</p>` : ""
|
||||
}</div>`;
|
||||
},
|
||||
},
|
||||
},
|
||||
switchLightDarkMode: {
|
||||
useSwitchMode: true,
|
||||
top: 130,
|
||||
right: 26,
|
||||
svgColor: "#7d7b75",
|
||||
},
|
||||
search: {
|
||||
noData: {
|
||||
"/": "没有找到结果!",
|
||||
},
|
||||
paths: "auto",
|
||||
placeholder: {
|
||||
"/": "搜索",
|
||||
},
|
||||
hideOtherSidebarContent: true,
|
||||
},
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
+16
-696
@@ -1,112 +1,13 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
(function () {
|
||||
"use strict";
|
||||
let ParameterType;
|
||||
(function (ParameterType) {
|
||||
ParameterType["String"] = "string";
|
||||
ParameterType["Number"] = "number";
|
||||
ParameterType["Boolean"] = "boolean";
|
||||
ParameterType["Enum"] = "enum";
|
||||
})(ParameterType || (ParameterType = {}));
|
||||
let MethodType;
|
||||
(function (MethodType) {
|
||||
MethodType["Mod"] = "mod";
|
||||
MethodType["Surgery"] = "surgery";
|
||||
MethodType["Comment"] = "comment";
|
||||
MethodType["CustomMethod"] = "custom_method";
|
||||
MethodType["Ink"] = "ink";
|
||||
MethodType["Variable"] = "variable";
|
||||
MethodType["Condition"] = "condition";
|
||||
MethodType["CustomClass"] = "custom_class";
|
||||
})(MethodType || (MethodType = {}));
|
||||
const enumTypeMap = {
|
||||
Characters: ["Logan", "Green", "Blue", "Yellow", "Purple", "Orange"],
|
||||
Size: ["Small", "Medium", "Large"],
|
||||
Shape: ["Circle", "Square", "Triangle"],
|
||||
};
|
||||
class NumericRange {
|
||||
constructor(min, max, isInteger = false) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.isInteger = isInteger;
|
||||
}
|
||||
}
|
||||
class Parameter {
|
||||
constructor(name, type, description, enumType, numericRange) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.description = description;
|
||||
this.enumType = enumType;
|
||||
this.numericRange = numericRange;
|
||||
}
|
||||
}
|
||||
class Method {
|
||||
constructor(name, type, shortDescription, description) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.shortDescription = shortDescription;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
class Mod extends Method {
|
||||
constructor(name, shortDescription, description) {
|
||||
super(name, MethodType.Mod, shortDescription, description);
|
||||
}
|
||||
}
|
||||
class Surgery extends Method {
|
||||
constructor(name, shortDescription, description) {
|
||||
super(name, MethodType.Surgery, shortDescription, description);
|
||||
}
|
||||
}
|
||||
class CommentMethod extends Method {
|
||||
constructor(name, shortDescription, description, parameters) {
|
||||
super(name, MethodType.Comment, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class InkMethod extends Method {
|
||||
constructor(name, shortDescription, description, parameters) {
|
||||
super(name, MethodType.Ink, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class CustomMethods extends Method {
|
||||
constructor(name, shortDescription, description, parameters) {
|
||||
super(name, MethodType.CustomMethod, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class VariableMethod extends Method {
|
||||
constructor(name, shortDescription, description, parameters) {
|
||||
super(name, MethodType.Variable, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class ConditionMethod extends Method {
|
||||
constructor(name, shortDescription, description, parameters) {
|
||||
super(name, MethodType.Condition, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class CustomClassMethod extends Method {
|
||||
constructor(name, shortDescription, description) {
|
||||
super(name, MethodType.CustomClass, shortDescription, description);
|
||||
}
|
||||
}
|
||||
function editDistance(a, b, caseSensitive = true) {
|
||||
if (a.length === 0)
|
||||
return b.length;
|
||||
if (b.length === 0)
|
||||
return a.length;
|
||||
|
||||
|
||||
|
||||
const customMethods = [
|
||||
{ type: 'mod',}
|
||||
]
|
||||
|
||||
const editDistance = (a, b) => {
|
||||
if (a.length === 0) return b.length;
|
||||
if (b.length === 0) return a.length;
|
||||
const matrix = [];
|
||||
for (let i = 0; i <= b.length; i++) {
|
||||
matrix[i] = [i];
|
||||
@@ -116,596 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
}
|
||||
for (let i = 1; i <= b.length; i++) {
|
||||
for (let j = 1; j <= a.length; j++) {
|
||||
const ac = a.charAt(j - 1);
|
||||
const bc = b.charAt(i - 1);
|
||||
if (caseSensitive ? bc === ac : bc.toLowerCase() === ac.toLowerCase()) {
|
||||
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1];
|
||||
}
|
||||
else {
|
||||
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1));
|
||||
} else {
|
||||
matrix[i][j] = Math.min(
|
||||
matrix[i - 1][j - 1] + 1,
|
||||
Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return matrix[b.length][a.length];
|
||||
}
|
||||
function parametersOf(method) {
|
||||
var _a;
|
||||
return (_a = method.parameters) !== null && _a !== void 0 ? _a : [];
|
||||
}
|
||||
// 全局策略:字符串写法、数字/布尔默认的常量/表达式状态
|
||||
const strategies = {
|
||||
string: "prefix",
|
||||
number: "constant",
|
||||
boolean: "constant",
|
||||
};
|
||||
// ---------------------------------------------------------------------
|
||||
// 外置数据 hydrate(script/custommethod-data.js)
|
||||
// ---------------------------------------------------------------------
|
||||
function hydrateMethod(raw) {
|
||||
var _a, _b, _c, _d;
|
||||
const shortDescription = (_b = (_a = raw.shortDescription) !== null && _a !== void 0 ? _a : raw.description) !== null && _b !== void 0 ? _b : "";
|
||||
const description = (_d = (_c = raw.description) !== null && _c !== void 0 ? _c : raw.shortDescription) !== null && _d !== void 0 ? _d : "";
|
||||
const parameters = Array.isArray(raw.parameters)
|
||||
? raw.parameters.map((item) => {
|
||||
var _a, _b;
|
||||
return new Parameter(item.name, (_a = item.type) !== null && _a !== void 0 ? _a : ParameterType.String, (_b = item.description) !== null && _b !== void 0 ? _b : "", item.enumType, item.numericRange
|
||||
? new NumericRange(item.numericRange.min, item.numericRange.max, item.numericRange.isInteger)
|
||||
: undefined);
|
||||
})
|
||||
: [];
|
||||
switch (raw.type) {
|
||||
case MethodType.Mod: return new Mod(raw.name, shortDescription, description);
|
||||
case MethodType.Surgery: return new Surgery(raw.name, shortDescription, description);
|
||||
case MethodType.Comment: return new CommentMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.Ink: return new InkMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.Variable: return new VariableMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.Condition: return new ConditionMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.CustomClass: return new CustomClassMethod(raw.name, shortDescription, description);
|
||||
default: return new CustomMethods(raw.name, shortDescription, description, parameters);
|
||||
}
|
||||
}
|
||||
let methods = [];
|
||||
function loadExternalData() {
|
||||
const data = window.CustomMethodSearchData;
|
||||
if (!data)
|
||||
return;
|
||||
if (data.enumTypes) {
|
||||
for (const key of Object.keys(data.enumTypes)) {
|
||||
enumTypeMap[key] = data.enumTypes[key];
|
||||
}
|
||||
}
|
||||
if (Array.isArray(data.methods)) {
|
||||
const index = new Map();
|
||||
methods.forEach((method, i) => index.set(method.name.toLowerCase(), i));
|
||||
for (const raw of data.methods) {
|
||||
if (!raw || !raw.name)
|
||||
continue;
|
||||
const name = String(raw.name).toLowerCase();
|
||||
const hydrated = hydrateMethod(raw);
|
||||
if (index.has(name)) {
|
||||
methods[index.get(name)] = hydrated;
|
||||
}
|
||||
else {
|
||||
index.set(name, methods.length);
|
||||
methods.push(hydrated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
loadExternalData();
|
||||
// ---------------------------------------------------------------------
|
||||
// 匹配
|
||||
// ---------------------------------------------------------------------
|
||||
function searchMethods(query) {
|
||||
const q = query.trim();
|
||||
if (!q)
|
||||
return [];
|
||||
const ql = q.toLowerCase();
|
||||
const maxDistance = Math.max(2, Math.floor(q.length / 2));
|
||||
return methods
|
||||
.map((method) => {
|
||||
const name = method.name;
|
||||
const lower = name.toLowerCase();
|
||||
let score;
|
||||
if (name === q) {
|
||||
score = 0;
|
||||
}
|
||||
else if (lower.startsWith(ql)) {
|
||||
score = 1;
|
||||
}
|
||||
else if (lower.indexOf(ql) >= 0) {
|
||||
score = 2;
|
||||
}
|
||||
else {
|
||||
score = 3 + editDistance(name, q, false);
|
||||
}
|
||||
return { method, score };
|
||||
})
|
||||
.filter((item) => item.score <= 2 || item.score <= 3 + maxDistance)
|
||||
.sort((a, b) => a.score - b.score || a.method.name.localeCompare(b.method.name))
|
||||
.slice(0, 8)
|
||||
.map((item) => item.method);
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// DOM 工具
|
||||
// ---------------------------------------------------------------------
|
||||
function el(tag, className) {
|
||||
const node = document.createElement(tag);
|
||||
if (className)
|
||||
node.className = className;
|
||||
return node;
|
||||
}
|
||||
function resolveEnumOptions(parameter) {
|
||||
if (parameter.enumType && enumTypeMap[parameter.enumType])
|
||||
return enumTypeMap[parameter.enumType];
|
||||
if (enumTypeMap[parameter.description])
|
||||
return enumTypeMap[parameter.description];
|
||||
if (enumTypeMap[parameter.name])
|
||||
return enumTypeMap[parameter.name];
|
||||
return [];
|
||||
}
|
||||
// 布尔可用 true/false,或布尔变量 b0~b9
|
||||
const BOOLEAN_OPTIONS = ["true", "false"];
|
||||
for (let i = 0; i < 10; i++) {
|
||||
BOOLEAN_OPTIONS.push("b" + i);
|
||||
}
|
||||
function makeCombo(parameter, options, onChange) {
|
||||
const combo = el("span", "cm-combo");
|
||||
const input = el("input", "cm-input cm-combo-input");
|
||||
input.type = "text";
|
||||
input.placeholder = parameter.name;
|
||||
input.autocomplete = "off";
|
||||
const list = el("ul", "cm-combo-list");
|
||||
list.hidden = true;
|
||||
function populate() {
|
||||
list.textContent = "";
|
||||
if (options.length === 0) {
|
||||
list.hidden = true;
|
||||
return;
|
||||
}
|
||||
const query = input.value.trim();
|
||||
const ql = query.toLowerCase();
|
||||
const maxDistance = Math.max(1, Math.floor(query.length / 2));
|
||||
const shown = (query
|
||||
? options.filter((option) => option.toLowerCase().indexOf(ql) >= 0 ||
|
||||
editDistance(option, query, false) <= maxDistance)
|
||||
: options).slice(0, 10);
|
||||
if (shown.length === 0) {
|
||||
list.hidden = true;
|
||||
return;
|
||||
}
|
||||
for (const option of shown) {
|
||||
const item = el("li", "cm-combo-item");
|
||||
item.textContent = option;
|
||||
item.title = option;
|
||||
item.addEventListener("mousedown", (event) => {
|
||||
event.preventDefault();
|
||||
input.value = option;
|
||||
list.hidden = true;
|
||||
onChange();
|
||||
});
|
||||
list.appendChild(item);
|
||||
}
|
||||
list.hidden = false;
|
||||
}
|
||||
input.addEventListener("input", () => { populate(); onChange(); });
|
||||
input.addEventListener("focus", populate);
|
||||
input.addEventListener("blur", () => { window.setTimeout(() => { list.hidden = true; }, 120); });
|
||||
combo.appendChild(input);
|
||||
combo.appendChild(list);
|
||||
return combo;
|
||||
}
|
||||
function makeModeToggle(initial, onChange) {
|
||||
const button = el("button", "cm-mode");
|
||||
button.type = "button";
|
||||
let mode = initial;
|
||||
const render = () => {
|
||||
button.textContent = mode === "expression" ? "表达式" : "常量";
|
||||
button.title = "切换 常量 / 表达式";
|
||||
button.classList.toggle("is-expression", mode === "expression");
|
||||
};
|
||||
render();
|
||||
button.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
mode = mode === "expression" ? "constant" : "expression";
|
||||
render();
|
||||
onChange();
|
||||
});
|
||||
return { el: button, get: () => mode };
|
||||
}
|
||||
function stringValue(value) {
|
||||
if (value.length === 0)
|
||||
return "<文本>";
|
||||
return strategies.string === "quote" ? `"${value}"` : `str:${value}`;
|
||||
}
|
||||
function makeField(parameter, onChange) {
|
||||
switch (parameter.type) {
|
||||
case ParameterType.Boolean: {
|
||||
const wrap = el("span", "cm-field");
|
||||
const checkbox = el("input", "cm-input cm-check");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.addEventListener("change", onChange);
|
||||
const combo = makeCombo(parameter, BOOLEAN_OPTIONS, onChange);
|
||||
const comboInput = combo.querySelector("input");
|
||||
let mode = strategies.boolean;
|
||||
const toggle = makeModeToggle(strategies.boolean, () => {
|
||||
mode = toggle.get();
|
||||
applyMode();
|
||||
onChange();
|
||||
});
|
||||
function applyMode() {
|
||||
const expression = mode === "expression";
|
||||
checkbox.hidden = expression;
|
||||
combo.hidden = !expression;
|
||||
}
|
||||
applyMode();
|
||||
wrap.appendChild(toggle.el);
|
||||
wrap.appendChild(checkbox);
|
||||
wrap.appendChild(combo);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
if (mode === "constant") {
|
||||
return { text: checkbox.checked ? "true" : "false", valid: true, invalid: false };
|
||||
}
|
||||
const value = comboInput.value.trim();
|
||||
return value.length > 0
|
||||
? { text: value, valid: true, invalid: false }
|
||||
: { text: "<布尔>", valid: false, invalid: true };
|
||||
},
|
||||
};
|
||||
}
|
||||
case ParameterType.Number: {
|
||||
const wrap = el("span", "cm-field");
|
||||
const input = el("input", "cm-input");
|
||||
input.type = "text";
|
||||
input.inputMode = "decimal";
|
||||
input.placeholder = parameter.name;
|
||||
input.addEventListener("input", onChange);
|
||||
const mode = makeModeToggle(strategies.number, onChange);
|
||||
wrap.appendChild(mode.el);
|
||||
wrap.appendChild(input);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
const value = input.value.trim();
|
||||
if (value.length === 0)
|
||||
return { text: "<数字>", valid: false, invalid: true };
|
||||
if (mode.get() === "expression")
|
||||
return { text: value, valid: true, invalid: false };
|
||||
const number = Number(value);
|
||||
let valid = isFinite(number);
|
||||
const range = parameter.numericRange;
|
||||
if (valid && range) {
|
||||
if (range.isInteger && !Number.isInteger(number))
|
||||
valid = false;
|
||||
if (range.min !== undefined && number < range.min)
|
||||
valid = false;
|
||||
if (range.max !== undefined && number > range.max)
|
||||
valid = false;
|
||||
}
|
||||
return { text: value, valid, invalid: !valid };
|
||||
},
|
||||
};
|
||||
}
|
||||
case ParameterType.Enum: {
|
||||
const wrap = el("span", "cm-field cm-field-string");
|
||||
const open = el("span", "cm-lit");
|
||||
const close = el("span", "cm-lit");
|
||||
open.textContent = strategies.string === "quote" ? "\"" : "str:";
|
||||
close.textContent = strategies.string === "quote" ? "\"" : "";
|
||||
const combo = makeCombo(parameter, resolveEnumOptions(parameter), onChange);
|
||||
const input = combo.querySelector("input");
|
||||
wrap.appendChild(open);
|
||||
wrap.appendChild(combo);
|
||||
wrap.appendChild(close);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
const value = input.value.trim();
|
||||
const options = resolveEnumOptions(parameter);
|
||||
const valid = options.length > 0
|
||||
? options.some((option) => option.toLowerCase() === value.toLowerCase())
|
||||
: value.length > 0;
|
||||
return { text: stringValue(value), valid, invalid: !valid };
|
||||
},
|
||||
};
|
||||
}
|
||||
default: {
|
||||
const wrap = el("span", "cm-field cm-field-string");
|
||||
const open = el("span", "cm-lit");
|
||||
const close = el("span", "cm-lit");
|
||||
open.textContent = strategies.string === "quote" ? "\"" : "str:";
|
||||
close.textContent = strategies.string === "quote" ? "\"" : "";
|
||||
const input = el("input", "cm-input");
|
||||
input.type = "text";
|
||||
input.placeholder = parameter.name;
|
||||
input.addEventListener("input", onChange);
|
||||
wrap.appendChild(open);
|
||||
wrap.appendChild(input);
|
||||
wrap.appendChild(close);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
const value = input.value.trim();
|
||||
return { text: stringValue(value), valid: value.length > 0, invalid: value.length === 0 };
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
function methodSkeleton(method, hasParams) {
|
||||
switch (method.type) {
|
||||
case MethodType.Comment: return { prefix: `()=>${method.name}(`, suffix: ")" };
|
||||
case MethodType.Ink: return { prefix: `DOTHIS{${method.name}(`, suffix: ")}" };
|
||||
case MethodType.Variable: return { prefix: `${method.name} = `, suffix: "" };
|
||||
case MethodType.Mod: return { prefix: `"mods": [..., "`, suffix: `"]` };
|
||||
case MethodType.CustomClass: return { prefix: `"customClass": "`, suffix: `"` };
|
||||
case MethodType.Condition:
|
||||
return hasParams ? { prefix: `${method.name}(`, suffix: ")" } : { prefix: method.name, suffix: "" };
|
||||
case MethodType.Surgery: return { prefix: method.name, suffix: "" };
|
||||
default:
|
||||
return hasParams ? { prefix: `${method.name}(`, suffix: ")" } : { prefix: method.name, suffix: "" };
|
||||
}
|
||||
}
|
||||
function formatMethod(method, states) {
|
||||
const args = states.map((state) => state.text).join(", ");
|
||||
switch (method.type) {
|
||||
case MethodType.Comment: return `()=>${method.name}(${args})`;
|
||||
case MethodType.Ink: return `DOTHIS{${method.name}(${args})}`;
|
||||
case MethodType.Variable: return `${method.name} = ${states.length ? states[0].text : ""}`;
|
||||
case MethodType.Mod: return `"mods": [..., "${method.name}"]`;
|
||||
case MethodType.CustomClass: return `"customClass": "${method.name}"`;
|
||||
case MethodType.Condition: return states.length ? `${method.name}(${args})` : method.name;
|
||||
case MethodType.Surgery: return method.name;
|
||||
default: return states.length ? `${method.name}(${args})` : method.name;
|
||||
}
|
||||
}
|
||||
function copyText(text) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
yield navigator.clipboard.writeText(text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
// fall through
|
||||
}
|
||||
try {
|
||||
const area = document.createElement("textarea");
|
||||
area.value = text;
|
||||
area.style.position = "fixed";
|
||||
area.style.opacity = "0";
|
||||
document.body.appendChild(area);
|
||||
area.select();
|
||||
const ok = document.execCommand("copy");
|
||||
document.body.removeChild(area);
|
||||
return ok;
|
||||
}
|
||||
catch (error) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// 渲染
|
||||
// ---------------------------------------------------------------------
|
||||
function renderContainer(container) {
|
||||
if (container.dataset.cmReady === "1")
|
||||
return;
|
||||
container.dataset.cmReady = "1";
|
||||
let currentMethod = null;
|
||||
let query = container.querySelector(".cm-query");
|
||||
let suggest = container.querySelector(".cm-suggest");
|
||||
let selected = container.querySelector(".cm-selected");
|
||||
let nameEl = container.querySelector(".cm-name");
|
||||
let shortEl = container.querySelector(".cm-short");
|
||||
let call = container.querySelector(".cm-call");
|
||||
let preview = container.querySelector(".cm-preview");
|
||||
let desc = container.querySelector(".cm-desc");
|
||||
let options = container.querySelector(".cm-options");
|
||||
if (!query || !suggest || !selected || !nameEl || !shortEl || !call || !preview || !desc) {
|
||||
container.textContent = "";
|
||||
const searchBar = el("div", "cm-search");
|
||||
query = el("input", "cm-query");
|
||||
query.type = "text";
|
||||
query.placeholder = "输入自定义方法名,如 ChangeCharacter";
|
||||
query.autocomplete = "off";
|
||||
suggest = el("ul", "cm-suggest");
|
||||
searchBar.appendChild(query);
|
||||
searchBar.appendChild(suggest);
|
||||
selected = el("div", "cm-selected");
|
||||
selected.hidden = true;
|
||||
const head = el("div", "cm-head");
|
||||
nameEl = el("span", "cm-name");
|
||||
shortEl = el("span", "cm-short");
|
||||
head.appendChild(nameEl);
|
||||
head.appendChild(shortEl);
|
||||
call = el("div", "cm-call");
|
||||
preview = el("code", "cm-preview");
|
||||
desc = el("div", "cm-desc");
|
||||
selected.appendChild(head);
|
||||
selected.appendChild(call);
|
||||
selected.appendChild(preview);
|
||||
selected.appendChild(desc);
|
||||
container.appendChild(searchBar);
|
||||
container.appendChild(selected);
|
||||
}
|
||||
// 搜索框下的策略选项
|
||||
options = container.querySelector(".cm-options");
|
||||
if (!options) {
|
||||
options = el("div", "cm-options");
|
||||
query.parentElement.insertAdjacentElement("afterend", options);
|
||||
}
|
||||
if (!options.querySelector(".cm-option-select")) {
|
||||
const optionsBox = options;
|
||||
function addOption(label, key, values, current) {
|
||||
const wrap = el("label", "cm-option");
|
||||
const text = el("span", "cm-option-label");
|
||||
text.textContent = label;
|
||||
const select = el("select", "cm-option-select");
|
||||
for (const [value, caption] of values) {
|
||||
const opt = el("option");
|
||||
opt.value = value;
|
||||
opt.textContent = caption;
|
||||
select.appendChild(opt);
|
||||
}
|
||||
select.value = current;
|
||||
select.addEventListener("change", () => {
|
||||
strategies[key] = select.value;
|
||||
if (currentMethod) {
|
||||
selectMethod(currentMethod);
|
||||
}
|
||||
});
|
||||
wrap.appendChild(text);
|
||||
wrap.appendChild(select);
|
||||
optionsBox.appendChild(wrap);
|
||||
}
|
||||
addOption("字符串", "string", [["prefix", "str: 前缀"], ["quote", "引号 \"…\""]], strategies.string);
|
||||
}
|
||||
const queryEl = query;
|
||||
const suggestEl = suggest;
|
||||
const selectedEl = selected;
|
||||
const nameNode = nameEl;
|
||||
const shortNode = shortEl;
|
||||
const callEl = call;
|
||||
const previewEl = preview;
|
||||
const descNode = desc;
|
||||
const copyBtn = el("button", "cm-copy");
|
||||
copyBtn.type = "button";
|
||||
copyBtn.textContent = "复制";
|
||||
copyBtn.hidden = true;
|
||||
copyBtn.title = "复制生成的代码";
|
||||
selectedEl.appendChild(copyBtn);
|
||||
copyBtn.addEventListener("click", () => {
|
||||
var _a;
|
||||
copyText((_a = previewEl.textContent) !== null && _a !== void 0 ? _a : "").then((ok) => {
|
||||
copyBtn.textContent = ok ? "已复制" : "复制失败";
|
||||
window.setTimeout(() => { copyBtn.textContent = "复制"; }, 1200);
|
||||
});
|
||||
});
|
||||
function clearSuggest() {
|
||||
suggestEl.textContent = "";
|
||||
}
|
||||
function selectMethod(method) {
|
||||
currentMethod = method;
|
||||
clearSuggest();
|
||||
queryEl.value = method.name;
|
||||
selectedEl.hidden = false;
|
||||
nameNode.textContent = method.name;
|
||||
shortNode.textContent = method.shortDescription || "";
|
||||
descNode.textContent = method.description || "";
|
||||
callEl.textContent = "";
|
||||
previewEl.textContent = "";
|
||||
copyBtn.hidden = true;
|
||||
const parameters = parametersOf(method);
|
||||
const fields = [];
|
||||
function updatePreview() {
|
||||
const states = fields.map((field) => field.read());
|
||||
fields.forEach((field, i) => field.el.classList.toggle("cm-invalid", states[i].invalid));
|
||||
previewEl.textContent = formatMethod(method, states);
|
||||
copyBtn.hidden = !states.every((state) => state.valid);
|
||||
}
|
||||
const skeleton = methodSkeleton(method, parameters.length > 0);
|
||||
const code = el("code", "cm-code");
|
||||
const prefix = el("span", "cm-lit");
|
||||
prefix.textContent = skeleton.prefix;
|
||||
code.appendChild(prefix);
|
||||
parameters.forEach((parameter, index) => {
|
||||
if (index > 0) {
|
||||
const sep = el("span", "cm-lit");
|
||||
sep.textContent = ", ";
|
||||
code.appendChild(sep);
|
||||
}
|
||||
const field = makeField(parameter, updatePreview);
|
||||
field.el.title = parameter.description;
|
||||
code.appendChild(field.el);
|
||||
fields.push(field);
|
||||
});
|
||||
if (skeleton.suffix) {
|
||||
const suffix = el("span", "cm-lit");
|
||||
suffix.textContent = skeleton.suffix;
|
||||
code.appendChild(suffix);
|
||||
}
|
||||
callEl.appendChild(code);
|
||||
if (parameters.length === 0) {
|
||||
const empty = el("span", "cm-empty");
|
||||
empty.textContent = "(无参数)";
|
||||
callEl.appendChild(empty);
|
||||
}
|
||||
updatePreview();
|
||||
}
|
||||
function updateSuggestions() {
|
||||
clearSuggest();
|
||||
for (const method of searchMethods(queryEl.value)) {
|
||||
const item = el("li", "cm-suggest-item");
|
||||
const nameSpan = el("span", "cm-suggest-name");
|
||||
nameSpan.textContent = method.name;
|
||||
const descSpan = el("span", "cm-suggest-desc");
|
||||
descSpan.textContent = method.shortDescription || method.description;
|
||||
item.appendChild(nameSpan);
|
||||
item.appendChild(descSpan);
|
||||
item.addEventListener("mousedown", (event) => {
|
||||
event.preventDefault();
|
||||
selectMethod(method);
|
||||
});
|
||||
suggestEl.appendChild(item);
|
||||
}
|
||||
}
|
||||
queryEl.addEventListener("input", () => {
|
||||
updateSuggestions();
|
||||
selectedEl.hidden = true;
|
||||
});
|
||||
queryEl.addEventListener("focus", updateSuggestions);
|
||||
queryEl.addEventListener("blur", () => {
|
||||
window.setTimeout(clearSuggest, 120);
|
||||
});
|
||||
if (queryEl.value) {
|
||||
updateSuggestions();
|
||||
}
|
||||
}
|
||||
function initAll() {
|
||||
document.querySelectorAll(".custommethods-search").forEach((container) => renderContainer(container));
|
||||
}
|
||||
function register() {
|
||||
const docsify = window.$docsify;
|
||||
if (docsify) {
|
||||
docsify.plugins = [].concat(docsify.plugins, (hook) => {
|
||||
hook.doneEach(() => initAll());
|
||||
});
|
||||
}
|
||||
else if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", () => initAll());
|
||||
}
|
||||
else {
|
||||
initAll();
|
||||
}
|
||||
}
|
||||
window.CustomMethodSearch = {
|
||||
search: searchMethods,
|
||||
editDistance,
|
||||
renderAll: initAll,
|
||||
strategies,
|
||||
getMethods: () => methods,
|
||||
setMethods: (list) => { methods = list; initAll(); },
|
||||
Parameter,
|
||||
ParameterType,
|
||||
Method,
|
||||
MethodType,
|
||||
Mod,
|
||||
Surgery,
|
||||
CommentMethod,
|
||||
InkMethod,
|
||||
CustomMethods,
|
||||
VariableMethod,
|
||||
ConditionMethod,
|
||||
CustomClassMethod,
|
||||
};
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", register);
|
||||
}
|
||||
else {
|
||||
register();
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,119 +1,8 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
enum ParameterType {
|
||||
String = "string",
|
||||
Number = "number",
|
||||
Boolean = "boolean",
|
||||
Enum = "enum",
|
||||
}
|
||||
enum MethodType {
|
||||
Mod = "mod",
|
||||
Surgery = "surgery",
|
||||
Comment = "comment",
|
||||
CustomMethod = "custom_method",
|
||||
Ink = "ink",
|
||||
Variable = "variable",
|
||||
Condition = "condition",
|
||||
CustomClass = "custom_class",
|
||||
}
|
||||
type ValueMode = "constant" | "expression";
|
||||
type StringStrategy = "prefix" | "quote";
|
||||
|
||||
const enumTypeMap: Record<string, string[]> = {
|
||||
Characters: ["Logan", "Green", "Blue", "Yellow", "Purple", "Orange"],
|
||||
Size: ["Small", "Medium", "Large"],
|
||||
Shape: ["Circle", "Square", "Triangle"],
|
||||
};
|
||||
|
||||
class NumericRange {
|
||||
min?: number;
|
||||
max?: number;
|
||||
isInteger: boolean;
|
||||
public constructor(min?: number, max?: number, isInteger: boolean = false) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.isInteger = isInteger;
|
||||
}
|
||||
}
|
||||
class Parameter {
|
||||
name: string;
|
||||
type: ParameterType;
|
||||
enumType?: string;
|
||||
numericRange?: NumericRange;
|
||||
description: string;
|
||||
public constructor(name: string, type: ParameterType, description: string, enumType?: string, numericRange?: NumericRange) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.description = description;
|
||||
this.enumType = enumType;
|
||||
this.numericRange = numericRange;
|
||||
}
|
||||
}
|
||||
class Method {
|
||||
name: string;
|
||||
type: MethodType;
|
||||
shortDescription: string;
|
||||
description: string;
|
||||
public constructor(name: string, type: MethodType, shortDescription: string, description: string) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.shortDescription = shortDescription;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
class Mod extends Method {
|
||||
public constructor(name: string, shortDescription: string, description: string) {
|
||||
super(name, MethodType.Mod, shortDescription, description);
|
||||
}
|
||||
}
|
||||
class Surgery extends Method {
|
||||
public constructor(name: string, shortDescription: string, description: string) {
|
||||
super(name, MethodType.Surgery, shortDescription, description);
|
||||
}
|
||||
}
|
||||
class CommentMethod extends Method {
|
||||
parameters: Parameter[];
|
||||
public constructor(name: string, shortDescription: string, description: string, parameters: Parameter[]) {
|
||||
super(name, MethodType.Comment, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class InkMethod extends Method {
|
||||
parameters: Parameter[];
|
||||
public constructor(name: string, shortDescription: string, description: string, parameters: Parameter[]) {
|
||||
super(name, MethodType.Ink, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class CustomMethods extends Method {
|
||||
parameters: Parameter[];
|
||||
public constructor(name: string, shortDescription: string, description: string, parameters: Parameter[]) {
|
||||
super(name, MethodType.CustomMethod, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class VariableMethod extends Method {
|
||||
parameters: Parameter[];
|
||||
public constructor(name: string, shortDescription: string, description: string, parameters: Parameter[]) {
|
||||
super(name, MethodType.Variable, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class ConditionMethod extends Method {
|
||||
parameters: Parameter[];
|
||||
public constructor(name: string, shortDescription: string, description: string, parameters: Parameter[]) {
|
||||
super(name, MethodType.Condition, shortDescription, description);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
class CustomClassMethod extends Method {
|
||||
public constructor(name: string, shortDescription: string, description: string) {
|
||||
super(name, MethodType.CustomClass, shortDescription, description);
|
||||
}
|
||||
class CustomMethods{
|
||||
type: "mod"|"surgery"|"comment"|"custom_method";
|
||||
}
|
||||
|
||||
function editDistance(a: string, b: string, caseSensitive: boolean = true): number {
|
||||
function editDistance(a: String, b: String): number {
|
||||
if (a.length === 0) return b.length;
|
||||
if (b.length === 0) return a.length;
|
||||
const matrix: number[][] = [];
|
||||
@@ -125,9 +14,7 @@
|
||||
}
|
||||
for (let i = 1; i <= b.length; i++) {
|
||||
for (let j = 1; j <= a.length; j++) {
|
||||
const ac = a.charAt(j - 1);
|
||||
const bc = b.charAt(i - 1);
|
||||
if (caseSensitive ? bc === ac : bc.toLowerCase() === ac.toLowerCase()) {
|
||||
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1];
|
||||
} else {
|
||||
matrix[i][j] = Math.min(
|
||||
@@ -140,608 +27,6 @@
|
||||
return matrix[b.length][a.length];
|
||||
}
|
||||
|
||||
function parametersOf(method: Method): Parameter[] {
|
||||
return (method as CommentMethod | InkMethod | CustomMethods | VariableMethod | ConditionMethod).parameters ?? [];
|
||||
}
|
||||
|
||||
// 全局策略:字符串写法、数字/布尔默认的常量/表达式状态
|
||||
const strategies: { string: StringStrategy; number: ValueMode; boolean: ValueMode } = {
|
||||
string: "prefix",
|
||||
number: "constant",
|
||||
boolean: "constant",
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// 外置数据 hydrate(script/custommethod-data.js)
|
||||
// ---------------------------------------------------------------------
|
||||
function hydrateMethod(raw: any): Method {
|
||||
const shortDescription = raw.shortDescription ?? raw.description ?? "";
|
||||
const description = raw.description ?? raw.shortDescription ?? "";
|
||||
const parameters: Parameter[] = Array.isArray(raw.parameters)
|
||||
? raw.parameters.map((item: any) => new Parameter(
|
||||
item.name,
|
||||
item.type ?? ParameterType.String,
|
||||
item.description ?? "",
|
||||
item.enumType,
|
||||
item.numericRange
|
||||
? new NumericRange(item.numericRange.min, item.numericRange.max, item.numericRange.isInteger)
|
||||
: undefined,
|
||||
))
|
||||
: [];
|
||||
switch (raw.type) {
|
||||
case MethodType.Mod: return new Mod(raw.name, shortDescription, description);
|
||||
case MethodType.Surgery: return new Surgery(raw.name, shortDescription, description);
|
||||
case MethodType.Comment: return new CommentMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.Ink: return new InkMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.Variable: return new VariableMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.Condition: return new ConditionMethod(raw.name, shortDescription, description, parameters);
|
||||
case MethodType.CustomClass: return new CustomClassMethod(raw.name, shortDescription, description);
|
||||
default: return new CustomMethods(raw.name, shortDescription, description, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
let methods: Method[] = [];
|
||||
|
||||
function loadExternalData(): void {
|
||||
const data = (window as any).CustomMethodSearchData;
|
||||
if (!data) return;
|
||||
if (data.enumTypes) {
|
||||
for (const key of Object.keys(data.enumTypes)) {
|
||||
enumTypeMap[key] = data.enumTypes[key];
|
||||
}
|
||||
}
|
||||
if (Array.isArray(data.methods)) {
|
||||
const index = new Map<string, number>();
|
||||
methods.forEach((method, i) => index.set(method.name.toLowerCase(), i));
|
||||
for (const raw of data.methods) {
|
||||
if (!raw || !raw.name) continue;
|
||||
const name = String(raw.name).toLowerCase();
|
||||
const hydrated = hydrateMethod(raw);
|
||||
if (index.has(name)) {
|
||||
methods[index.get(name)!] = hydrated;
|
||||
} else {
|
||||
index.set(name, methods.length);
|
||||
methods.push(hydrated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
loadExternalData();
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// 匹配
|
||||
// ---------------------------------------------------------------------
|
||||
function searchMethods(query: string): Method[] {
|
||||
const q = query.trim();
|
||||
if (!q) return [];
|
||||
const ql = q.toLowerCase();
|
||||
const maxDistance = Math.max(2, Math.floor(q.length / 2));
|
||||
return methods
|
||||
.map((method) => {
|
||||
const name = method.name;
|
||||
const lower = name.toLowerCase();
|
||||
let score: number;
|
||||
if (name === q) {
|
||||
score = 0;
|
||||
} else if (lower.startsWith(ql)) {
|
||||
score = 1;
|
||||
} else if (lower.indexOf(ql) >= 0) {
|
||||
score = 2;
|
||||
} else {
|
||||
score = 3 + editDistance(name, q, false);
|
||||
}
|
||||
return { method, score };
|
||||
})
|
||||
.filter((item) => item.score <= 2 || item.score <= 3 + maxDistance)
|
||||
.sort((a, b) => a.score - b.score || a.method.name.localeCompare(b.method.name))
|
||||
.slice(0, 8)
|
||||
.map((item) => item.method);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// DOM 工具
|
||||
// ---------------------------------------------------------------------
|
||||
function el<K extends keyof HTMLElementTagNameMap>(tag: K, className?: string): HTMLElementTagNameMap[K] {
|
||||
const node = document.createElement(tag);
|
||||
if (className) node.className = className;
|
||||
return node;
|
||||
}
|
||||
|
||||
function resolveEnumOptions(parameter: Parameter): string[] {
|
||||
if (parameter.enumType && enumTypeMap[parameter.enumType]) return enumTypeMap[parameter.enumType];
|
||||
if (enumTypeMap[parameter.description]) return enumTypeMap[parameter.description];
|
||||
if (enumTypeMap[parameter.name]) return enumTypeMap[parameter.name];
|
||||
return [];
|
||||
}
|
||||
|
||||
// 布尔可用 true/false,或布尔变量 b0~b9
|
||||
const BOOLEAN_OPTIONS: string[] = ["true", "false"];
|
||||
for (let i = 0; i < 10; i++) {
|
||||
BOOLEAN_OPTIONS.push("b" + i);
|
||||
}
|
||||
|
||||
function makeCombo(parameter: Parameter, options: string[], onChange: () => void): HTMLElement {
|
||||
const combo = el("span", "cm-combo");
|
||||
const input = el("input", "cm-input cm-combo-input") as HTMLInputElement;
|
||||
input.type = "text";
|
||||
input.placeholder = parameter.name;
|
||||
input.autocomplete = "off";
|
||||
const list = el("ul", "cm-combo-list");
|
||||
list.hidden = true;
|
||||
|
||||
function populate(): void {
|
||||
list.textContent = "";
|
||||
if (options.length === 0) { list.hidden = true; return; }
|
||||
const query = input.value.trim();
|
||||
const ql = query.toLowerCase();
|
||||
const maxDistance = Math.max(1, Math.floor(query.length / 2));
|
||||
const shown = (query
|
||||
? options.filter((option) =>
|
||||
option.toLowerCase().indexOf(ql) >= 0 ||
|
||||
editDistance(option, query, false) <= maxDistance)
|
||||
: options
|
||||
).slice(0, 10);
|
||||
if (shown.length === 0) { list.hidden = true; return; }
|
||||
for (const option of shown) {
|
||||
const item = el("li", "cm-combo-item");
|
||||
item.textContent = option;
|
||||
item.title = option;
|
||||
item.addEventListener("mousedown", (event) => {
|
||||
event.preventDefault();
|
||||
input.value = option;
|
||||
list.hidden = true;
|
||||
onChange();
|
||||
});
|
||||
list.appendChild(item);
|
||||
}
|
||||
list.hidden = false;
|
||||
}
|
||||
|
||||
input.addEventListener("input", () => { populate(); onChange(); });
|
||||
input.addEventListener("focus", populate);
|
||||
input.addEventListener("blur", () => { window.setTimeout(() => { list.hidden = true; }, 120); });
|
||||
combo.appendChild(input);
|
||||
combo.appendChild(list);
|
||||
return combo;
|
||||
}
|
||||
|
||||
function makeModeToggle(initial: ValueMode, onChange: () => void): { el: HTMLButtonElement; get: () => ValueMode } {
|
||||
const button = el("button", "cm-mode") as HTMLButtonElement;
|
||||
button.type = "button";
|
||||
let mode = initial;
|
||||
const render = (): void => {
|
||||
button.textContent = mode === "expression" ? "表达式" : "常量";
|
||||
button.title = "切换 常量 / 表达式";
|
||||
button.classList.toggle("is-expression", mode === "expression");
|
||||
};
|
||||
render();
|
||||
button.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
mode = mode === "expression" ? "constant" : "expression";
|
||||
render();
|
||||
onChange();
|
||||
});
|
||||
return { el: button, get: () => mode };
|
||||
}
|
||||
|
||||
interface ParamState {
|
||||
text: string;
|
||||
valid: boolean;
|
||||
invalid: boolean;
|
||||
}
|
||||
interface Field {
|
||||
el: HTMLElement;
|
||||
read: () => ParamState;
|
||||
}
|
||||
|
||||
function stringValue(value: string): string {
|
||||
if (value.length === 0) return "<文本>";
|
||||
return strategies.string === "quote" ? `"${value}"` : `str:${value}`;
|
||||
}
|
||||
|
||||
function makeField(parameter: Parameter, onChange: () => void): Field {
|
||||
switch (parameter.type) {
|
||||
case ParameterType.Boolean: {
|
||||
const wrap = el("span", "cm-field");
|
||||
const checkbox = el("input", "cm-input cm-check") as HTMLInputElement;
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.addEventListener("change", onChange);
|
||||
const combo = makeCombo(parameter, BOOLEAN_OPTIONS, onChange);
|
||||
const comboInput = combo.querySelector("input") as HTMLInputElement;
|
||||
let mode: ValueMode = strategies.boolean;
|
||||
const toggle = makeModeToggle(strategies.boolean, () => {
|
||||
mode = toggle.get();
|
||||
applyMode();
|
||||
onChange();
|
||||
});
|
||||
function applyMode(): void {
|
||||
const expression = mode === "expression";
|
||||
checkbox.hidden = expression;
|
||||
combo.hidden = !expression;
|
||||
}
|
||||
applyMode();
|
||||
wrap.appendChild(toggle.el);
|
||||
wrap.appendChild(checkbox);
|
||||
wrap.appendChild(combo);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
if (mode === "constant") {
|
||||
return { text: checkbox.checked ? "true" : "false", valid: true, invalid: false };
|
||||
}
|
||||
const value = comboInput.value.trim();
|
||||
return value.length > 0
|
||||
? { text: value, valid: true, invalid: false }
|
||||
: { text: "<布尔>", valid: false, invalid: true };
|
||||
},
|
||||
};
|
||||
}
|
||||
case ParameterType.Number: {
|
||||
const wrap = el("span", "cm-field");
|
||||
const input = el("input", "cm-input") as HTMLInputElement;
|
||||
input.type = "text";
|
||||
input.inputMode = "decimal";
|
||||
input.placeholder = parameter.name;
|
||||
input.addEventListener("input", onChange);
|
||||
const mode = makeModeToggle(strategies.number, onChange);
|
||||
wrap.appendChild(mode.el);
|
||||
wrap.appendChild(input);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
const value = input.value.trim();
|
||||
if (value.length === 0) return { text: "<数字>", valid: false, invalid: true };
|
||||
if (mode.get() === "expression") return { text: value, valid: true, invalid: false };
|
||||
const number = Number(value);
|
||||
let valid = isFinite(number);
|
||||
const range = parameter.numericRange;
|
||||
if (valid && range) {
|
||||
if (range.isInteger && !Number.isInteger(number)) valid = false;
|
||||
if (range.min !== undefined && number < range.min) valid = false;
|
||||
if (range.max !== undefined && number > range.max) valid = false;
|
||||
}
|
||||
return { text: value, valid, invalid: !valid };
|
||||
},
|
||||
};
|
||||
}
|
||||
case ParameterType.Enum: {
|
||||
const wrap = el("span", "cm-field cm-field-string");
|
||||
const open = el("span", "cm-lit");
|
||||
const close = el("span", "cm-lit");
|
||||
open.textContent = strategies.string === "quote" ? "\"" : "str:";
|
||||
close.textContent = strategies.string === "quote" ? "\"" : "";
|
||||
const combo = makeCombo(parameter, resolveEnumOptions(parameter), onChange);
|
||||
const input = combo.querySelector("input") as HTMLInputElement;
|
||||
wrap.appendChild(open);
|
||||
wrap.appendChild(combo);
|
||||
wrap.appendChild(close);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
const value = input.value.trim();
|
||||
const options = resolveEnumOptions(parameter);
|
||||
const valid = options.length > 0
|
||||
? options.some((option) => option.toLowerCase() === value.toLowerCase())
|
||||
: value.length > 0;
|
||||
return { text: stringValue(value), valid, invalid: !valid };
|
||||
},
|
||||
};
|
||||
}
|
||||
default: {
|
||||
const wrap = el("span", "cm-field cm-field-string");
|
||||
const open = el("span", "cm-lit");
|
||||
const close = el("span", "cm-lit");
|
||||
open.textContent = strategies.string === "quote" ? "\"" : "str:";
|
||||
close.textContent = strategies.string === "quote" ? "\"" : "";
|
||||
const input = el("input", "cm-input") as HTMLInputElement;
|
||||
input.type = "text";
|
||||
input.placeholder = parameter.name;
|
||||
input.addEventListener("input", onChange);
|
||||
wrap.appendChild(open);
|
||||
wrap.appendChild(input);
|
||||
wrap.appendChild(close);
|
||||
return {
|
||||
el: wrap,
|
||||
read: () => {
|
||||
const value = input.value.trim();
|
||||
return { text: stringValue(value), valid: value.length > 0, invalid: value.length === 0 };
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Skeleton {
|
||||
prefix: string;
|
||||
suffix: string;
|
||||
}
|
||||
|
||||
function methodSkeleton(method: Method, hasParams: boolean): Skeleton {
|
||||
switch (method.type) {
|
||||
case MethodType.Comment: return { prefix: `()=>${method.name}(`, suffix: ")" };
|
||||
case MethodType.Ink: return { prefix: `DOTHIS{${method.name}(`, suffix: ")}" };
|
||||
case MethodType.Variable: return { prefix: `${method.name} = `, suffix: "" };
|
||||
case MethodType.Mod: return { prefix: `"mods": [..., "`, suffix: `"]` };
|
||||
case MethodType.CustomClass: return { prefix: `"customClass": "`, suffix: `"` };
|
||||
case MethodType.Condition:
|
||||
return hasParams ? { prefix: `${method.name}(`, suffix: ")" } : { prefix: method.name, suffix: "" };
|
||||
case MethodType.Surgery: return { prefix: method.name, suffix: "" };
|
||||
default:
|
||||
return hasParams ? { prefix: `${method.name}(`, suffix: ")" } : { prefix: method.name, suffix: "" };
|
||||
}
|
||||
}
|
||||
|
||||
function formatMethod(method: Method, states: ParamState[]): string {
|
||||
const args = states.map((state) => state.text).join(", ");
|
||||
switch (method.type) {
|
||||
case MethodType.Comment: return `()=>${method.name}(${args})`;
|
||||
case MethodType.Ink: return `DOTHIS{${method.name}(${args})}`;
|
||||
case MethodType.Variable: return `${method.name} = ${states.length ? states[0].text : ""}`;
|
||||
case MethodType.Mod: return `"mods": [..., "${method.name}"]`;
|
||||
case MethodType.CustomClass: return `"customClass": "${method.name}"`;
|
||||
case MethodType.Condition: return states.length ? `${method.name}(${args})` : method.name;
|
||||
case MethodType.Surgery: return method.name;
|
||||
default: return states.length ? `${method.name}(${args})` : method.name;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyText(text: string): Promise<boolean> {
|
||||
try {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
await navigator.clipboard.writeText(text);
|
||||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
// fall through
|
||||
}
|
||||
try {
|
||||
const area = document.createElement("textarea");
|
||||
area.value = text;
|
||||
area.style.position = "fixed";
|
||||
area.style.opacity = "0";
|
||||
document.body.appendChild(area);
|
||||
area.select();
|
||||
const ok = document.execCommand("copy");
|
||||
document.body.removeChild(area);
|
||||
return ok;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// 渲染
|
||||
// ---------------------------------------------------------------------
|
||||
function renderContainer(container: HTMLElement): void {
|
||||
if (container.dataset.cmReady === "1") return;
|
||||
container.dataset.cmReady = "1";
|
||||
|
||||
let currentMethod: Method | null = null;
|
||||
|
||||
let query = container.querySelector<HTMLInputElement>(".cm-query");
|
||||
let suggest = container.querySelector<HTMLUListElement>(".cm-suggest");
|
||||
let selected = container.querySelector<HTMLElement>(".cm-selected");
|
||||
let nameEl = container.querySelector<HTMLElement>(".cm-name");
|
||||
let shortEl = container.querySelector<HTMLElement>(".cm-short");
|
||||
let call = container.querySelector<HTMLElement>(".cm-call");
|
||||
let preview = container.querySelector<HTMLElement>(".cm-preview");
|
||||
let desc = container.querySelector<HTMLElement>(".cm-desc");
|
||||
let options = container.querySelector<HTMLElement>(".cm-options");
|
||||
|
||||
if (!query || !suggest || !selected || !nameEl || !shortEl || !call || !preview || !desc) {
|
||||
container.textContent = "";
|
||||
const searchBar = el("div", "cm-search");
|
||||
query = el("input", "cm-query") as HTMLInputElement;
|
||||
query.type = "text";
|
||||
query.placeholder = "输入自定义方法名,如 ChangeCharacter";
|
||||
query.autocomplete = "off";
|
||||
suggest = el("ul", "cm-suggest");
|
||||
searchBar.appendChild(query);
|
||||
searchBar.appendChild(suggest);
|
||||
selected = el("div", "cm-selected");
|
||||
selected.hidden = true;
|
||||
const head = el("div", "cm-head");
|
||||
nameEl = el("span", "cm-name");
|
||||
shortEl = el("span", "cm-short");
|
||||
head.appendChild(nameEl);
|
||||
head.appendChild(shortEl);
|
||||
call = el("div", "cm-call");
|
||||
preview = el("code", "cm-preview");
|
||||
desc = el("div", "cm-desc");
|
||||
selected.appendChild(head);
|
||||
selected.appendChild(call);
|
||||
selected.appendChild(preview);
|
||||
selected.appendChild(desc);
|
||||
container.appendChild(searchBar);
|
||||
container.appendChild(selected);
|
||||
}
|
||||
|
||||
// 搜索框下的策略选项
|
||||
options = container.querySelector<HTMLElement>(".cm-options");
|
||||
if (!options) {
|
||||
options = el("div", "cm-options");
|
||||
(query.parentElement as HTMLElement).insertAdjacentElement("afterend", options);
|
||||
}
|
||||
if (!options.querySelector(".cm-option-select")) {
|
||||
const optionsBox = options;
|
||||
function addOption(label: string, key: "string" | "number" | "boolean", values: [string, string][], current: string): void {
|
||||
const wrap = el("label", "cm-option");
|
||||
const text = el("span", "cm-option-label");
|
||||
text.textContent = label;
|
||||
const select = el("select", "cm-option-select") as HTMLSelectElement;
|
||||
for (const [value, caption] of values) {
|
||||
const opt = el("option");
|
||||
opt.value = value;
|
||||
opt.textContent = caption;
|
||||
select.appendChild(opt);
|
||||
}
|
||||
select.value = current;
|
||||
select.addEventListener("change", () => {
|
||||
(strategies as any)[key] = select.value;
|
||||
if (currentMethod) { selectMethod(currentMethod); }
|
||||
});
|
||||
wrap.appendChild(text);
|
||||
wrap.appendChild(select);
|
||||
optionsBox.appendChild(wrap);
|
||||
}
|
||||
addOption("字符串", "string", [["prefix", "str: 前缀"], ["quote", "引号 \"…\""]], strategies.string);
|
||||
}
|
||||
|
||||
const queryEl = query;
|
||||
const suggestEl = suggest;
|
||||
const selectedEl = selected;
|
||||
const nameNode = nameEl;
|
||||
const shortNode = shortEl;
|
||||
const callEl = call;
|
||||
const previewEl = preview;
|
||||
const descNode = desc;
|
||||
|
||||
const copyBtn = el("button", "cm-copy") as HTMLButtonElement;
|
||||
copyBtn.type = "button";
|
||||
copyBtn.textContent = "复制";
|
||||
copyBtn.hidden = true;
|
||||
copyBtn.title = "复制生成的代码";
|
||||
selectedEl.appendChild(copyBtn);
|
||||
copyBtn.addEventListener("click", () => {
|
||||
copyText(previewEl.textContent ?? "").then((ok) => {
|
||||
copyBtn.textContent = ok ? "已复制" : "复制失败";
|
||||
window.setTimeout(() => { copyBtn.textContent = "复制"; }, 1200);
|
||||
});
|
||||
});
|
||||
|
||||
function clearSuggest(): void {
|
||||
suggestEl.textContent = "";
|
||||
}
|
||||
|
||||
function selectMethod(method: Method): void {
|
||||
currentMethod = method;
|
||||
clearSuggest();
|
||||
queryEl.value = method.name;
|
||||
selectedEl.hidden = false;
|
||||
nameNode.textContent = method.name;
|
||||
shortNode.textContent = method.shortDescription || "";
|
||||
descNode.textContent = method.description || "";
|
||||
callEl.textContent = "";
|
||||
previewEl.textContent = "";
|
||||
copyBtn.hidden = true;
|
||||
|
||||
const parameters = parametersOf(method);
|
||||
const fields: Field[] = [];
|
||||
|
||||
function updatePreview(): void {
|
||||
const states = fields.map((field) => field.read());
|
||||
fields.forEach((field, i) => field.el.classList.toggle("cm-invalid", states[i].invalid));
|
||||
previewEl.textContent = formatMethod(method, states);
|
||||
copyBtn.hidden = !states.every((state) => state.valid);
|
||||
}
|
||||
|
||||
const skeleton = methodSkeleton(method, parameters.length > 0);
|
||||
const code = el("code", "cm-code");
|
||||
const prefix = el("span", "cm-lit");
|
||||
prefix.textContent = skeleton.prefix;
|
||||
code.appendChild(prefix);
|
||||
|
||||
parameters.forEach((parameter, index) => {
|
||||
if (index > 0) {
|
||||
const sep = el("span", "cm-lit");
|
||||
sep.textContent = ", ";
|
||||
code.appendChild(sep);
|
||||
}
|
||||
const field = makeField(parameter, updatePreview);
|
||||
field.el.title = parameter.description;
|
||||
code.appendChild(field.el);
|
||||
fields.push(field);
|
||||
});
|
||||
|
||||
if (skeleton.suffix) {
|
||||
const suffix = el("span", "cm-lit");
|
||||
suffix.textContent = skeleton.suffix;
|
||||
code.appendChild(suffix);
|
||||
}
|
||||
callEl.appendChild(code);
|
||||
|
||||
if (parameters.length === 0) {
|
||||
const empty = el("span", "cm-empty");
|
||||
empty.textContent = "(无参数)";
|
||||
callEl.appendChild(empty);
|
||||
}
|
||||
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
function updateSuggestions(): void {
|
||||
clearSuggest();
|
||||
for (const method of searchMethods(queryEl.value)) {
|
||||
const item = el("li", "cm-suggest-item");
|
||||
const nameSpan = el("span", "cm-suggest-name");
|
||||
nameSpan.textContent = method.name;
|
||||
const descSpan = el("span", "cm-suggest-desc");
|
||||
descSpan.textContent = method.shortDescription || method.description;
|
||||
item.appendChild(nameSpan);
|
||||
item.appendChild(descSpan);
|
||||
item.addEventListener("mousedown", (event) => {
|
||||
event.preventDefault();
|
||||
selectMethod(method);
|
||||
});
|
||||
suggestEl.appendChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
queryEl.addEventListener("input", () => {
|
||||
updateSuggestions();
|
||||
selectedEl.hidden = true;
|
||||
});
|
||||
queryEl.addEventListener("focus", updateSuggestions);
|
||||
queryEl.addEventListener("blur", () => {
|
||||
window.setTimeout(clearSuggest, 120);
|
||||
});
|
||||
|
||||
if (queryEl.value) {
|
||||
updateSuggestions();
|
||||
}
|
||||
}
|
||||
|
||||
function initAll(): void {
|
||||
document.querySelectorAll<HTMLElement>(".custommethods-search").forEach((container) => renderContainer(container));
|
||||
}
|
||||
|
||||
function register(): void {
|
||||
const docsify = (window as any).$docsify;
|
||||
if (docsify) {
|
||||
docsify.plugins = ([] as any[]).concat(docsify.plugins, (hook: any) => {
|
||||
hook.doneEach(() => initAll());
|
||||
});
|
||||
} else if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", () => initAll());
|
||||
} else {
|
||||
initAll();
|
||||
}
|
||||
}
|
||||
|
||||
(window as any).CustomMethodSearch = {
|
||||
search: searchMethods,
|
||||
editDistance,
|
||||
renderAll: initAll,
|
||||
strategies,
|
||||
getMethods: () => methods,
|
||||
setMethods: (list: Method[]) => { methods = list; initAll(); },
|
||||
Parameter,
|
||||
ParameterType,
|
||||
Method,
|
||||
MethodType,
|
||||
Mod,
|
||||
Surgery,
|
||||
CommentMethod,
|
||||
InkMethod,
|
||||
CustomMethods,
|
||||
VariableMethod,
|
||||
ConditionMethod,
|
||||
CustomClassMethod,
|
||||
};
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", register);
|
||||
} else {
|
||||
register();
|
||||
}
|
||||
})();
|
||||
export { editDistance };
|
||||
|
||||
Vendored
-27
@@ -1,27 +0,0 @@
|
||||
export declare class IconStyle {
|
||||
enabled: boolean;
|
||||
active: boolean;
|
||||
hover: boolean;
|
||||
scale: number;
|
||||
showDuration: boolean;
|
||||
}
|
||||
|
||||
export interface HTMLLayerElement extends HTMLDivElement {
|
||||
onStateChange?: (style: IconStyle) => void;
|
||||
filterData: unknown;
|
||||
updateFilter: () => void;
|
||||
}
|
||||
|
||||
export interface HTMLEventElement extends HTMLDivElement {
|
||||
onStateChange: (style: IconStyle) => void;
|
||||
eventStyle: IconStyle;
|
||||
eventData: object;
|
||||
moveTo: (x: number, y: number) => void;
|
||||
}
|
||||
|
||||
export declare function createElementEvent(
|
||||
obj: any,
|
||||
style: IconStyle,
|
||||
): HTMLEventElement | null;
|
||||
|
||||
export declare function colorOf(tab: string): any;
|
||||
+382
-956
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
||||
import "./rdview.js";
|
||||
import "./rdtkview_render.js";
|
||||
import "./rdview_render.js";
|
||||
|
||||
window.loadRDView();
|
||||
+567
-296
@@ -1,4 +1,124 @@
|
||||
import { createElementEvent } from "./rdtkview.js";
|
||||
"use strict";
|
||||
var tilePosition = {
|
||||
"events": {
|
||||
"sounds": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_1", "position": [0, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_2", "position": [1, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_3", "position": [2, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_4", "position": [3, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_5", "position": [4, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_6", "position": [5, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_7", "position": [6, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_8", "position": [7, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_9", "position": [8, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar", "position": [9, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_1", "position": [0, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_2", "position": [1, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_3", "position": [2, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_4", "position": [3, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_5", "position": [4, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_6", "position": [5, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_7", "position": [6, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_8", "position": [7, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_9", "position": [8, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_10", "position": [9, 2, 1, 1] },
|
||||
{ "name": "PlaySong", "position": [0, 3, 2, 1] },
|
||||
{ "name": "PlaySound", "position": [2, 3, 1, 1] },
|
||||
{ "name": "SetBeatsPerMinute", "position": [3, 3, 1, 1] },
|
||||
{ "name": "SetClapSounds", "position": [4, 3, 1, 1] },
|
||||
{ "name": "SetHeartExplodeVolume", "position": [5, 3, 1, 1] },
|
||||
{ "name": "SetHeartExplodeInterval", "position": [6, 3, 1, 1] },
|
||||
{ "name": "SetGameSound", "position": [7, 3, 1, 1] },
|
||||
{ "name": "SetBeatSound", "position": [8, 3, 1, 1] },
|
||||
{ "name": "SetCountingSound", "position": [9, 3, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Rea", "position": [1, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Dy", "position": [2, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Get", "position": [3, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Set", "position": [4, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Go", "position": [5, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Ready", "position": [10, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_And", "position": [10, 1, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_GetSetGo", "position": [11, 0, 3, 1] },
|
||||
{ "name": "SayReadyGetSetGo_GetSetOne", "position": [11, 1, 3, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Stop", "position": [14, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_AndStop", "position": [14, 1, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_ReaDyGetSetGo", "position": [10, 2, 5, 1] },
|
||||
{ "name": "SayReadyGetSetGo_ReaDyGetSetOne", "position": [10, 3, 5, 1] },
|
||||
{ "name": "Comment", "position": [15, 0, 1, 1] }
|
||||
],
|
||||
"rows": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "SetOneshotWave", "position": [1, 0, 1, 1] }
|
||||
],
|
||||
"actions": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "SetTheme", "position": [1, 0, 1, 1] },
|
||||
{ "name": "SetVFXPreset", "position": [2, 0, 1, 1] },
|
||||
{ "name": "SetBackgroundColor", "position": [3, 0, 1, 1] },
|
||||
{ "name": "SetForeground", "position": [4, 0, 1, 1] },
|
||||
{ "name": "SetSpeed", "position": [5, 0, 1, 1] },
|
||||
{ "name": "Flash", "position": [6, 0, 1, 1] },
|
||||
{ "name": "CustomFlash", "position": [7, 0, 1, 1] },
|
||||
{ "name": "NewWindowDance", "position": [8, 0, 1, 1] },
|
||||
{ "name": "MoveCamera", "position": [0, 1, 1, 1] },
|
||||
{ "name": "PulseCamera", "position": [1, 1, 1, 1] },
|
||||
{ "name": "TextExplosion", "position": [2, 1, 1, 1] },
|
||||
{ "name": "ShowDialogue", "position": [3, 1, 1, 1] },
|
||||
{ "name": "ShowStatusSign", "position": [4, 1, 1, 1] },
|
||||
{ "name": "FloatingText", "position": [5, 1, 1, 1] },
|
||||
{ "name": "AdvanceText", "position": [6, 1, 0.5, 1] },
|
||||
{ "name": "ChangePlayersRows", "position": [7, 1, 1, 1] },
|
||||
{ "name": "Comment", "position": [8, 1, 1, 1] },
|
||||
{ "name": "FinishLevel", "position": [0, 2, 1, 1] },
|
||||
{ "name": "Stutter", "position": [1, 2, 1, 1] },
|
||||
{ "name": "HideRow", "position": [2, 2, 1, 1] },
|
||||
{ "name": "MoveRow", "position": [3, 2, 1, 1] },
|
||||
{ "name": "PlayExpression", "position": [4, 2, 1, 1] },
|
||||
{ "name": "TintRows", "position": [5, 2, 1, 1] },
|
||||
{ "name": "BassDrop", "position": [6, 2, 1, 1] },
|
||||
{ "name": "ShakeScreen", "position": [7, 2, 1, 1] },
|
||||
{ "name": "FlipScreen", "position": [0, 3, 1, 1] },
|
||||
{ "name": "InvertColors", "position": [1, 3, 1, 1] },
|
||||
{ "name": "ShowHands", "position": [2, 3, 1, 1] },
|
||||
{ "name": "PaintHands", "position": [3, 3, 1, 1] },
|
||||
{ "name": "SetHandOwner", "position": [4, 3, 1, 1] },
|
||||
{ "name": "SetPlayStyle", "position": [5, 3, 1, 1] },
|
||||
{ "name": "TagAction", "position": [6, 3, 1, 1] },
|
||||
{ "name": "CallCustomMethod", "position": [7, 3, 1, 1] }
|
||||
],
|
||||
"decorations": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "PlayAnimation", "position": [1, 0, 1, 1] },
|
||||
{ "name": "Tint", "position": [0, 1, 1, 1] },
|
||||
{ "name": "Comment", "position": [1, 1, 1, 1] },
|
||||
{ "name": "SetVisible", "position": [0, 2, 1, 1] },
|
||||
{ "name": "Move", "position": [0, 3, 1, 1] }
|
||||
],
|
||||
"rooms": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "MoveRoom", "position": [0, 1, 1, 1] },
|
||||
{ "name": "FadeRoom", "position": [0, 2, 1, 1] },
|
||||
{ "name": "MaskRoom", "position": [0, 3, 1, 1] },
|
||||
{ "name": "ShowRooms", "position": [1, 0, 1, 4] },
|
||||
{ "name": "ReorderRooms", "position": [2, 0, 1, 4] },
|
||||
{ "name": "SetRoomContentMode", "position": [3, 0, 1, 1] },
|
||||
{ "name": "SetRoomPerspective", "position": [3, 1, 1, 1] },
|
||||
{ "name": "Comment", "position": [3, 2, 1, 1] }
|
||||
],
|
||||
"custom": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "Comment", "position": [0, 1, 1, 1] }
|
||||
],
|
||||
"beatsSpecial": [
|
||||
"AddClassicBeat",
|
||||
"AddOneshotBeat",
|
||||
"AddFreeTimeBeat",
|
||||
"PulseFreeTimeBeat",
|
||||
"SetRowXs"
|
||||
]
|
||||
}
|
||||
};
|
||||
function loadRDView() {
|
||||
window.RDViewRender = RDViewRender;
|
||||
}
|
||||
@@ -11,6 +131,23 @@ class Color {
|
||||
}
|
||||
;
|
||||
}
|
||||
var EventType;
|
||||
(function (EventType) {
|
||||
EventType["sounds"] = "sounds";
|
||||
EventType["rows"] = "rows";
|
||||
EventType["actions"] = "actions";
|
||||
EventType["decorations"] = "decorations";
|
||||
EventType["rooms"] = "rooms";
|
||||
EventType["custom"] = "custom";
|
||||
})(EventType || (EventType = {}));
|
||||
var BeatsSpecial;
|
||||
(function (BeatsSpecial) {
|
||||
BeatsSpecial[BeatsSpecial["AddClassicBeat"] = 0] = "AddClassicBeat";
|
||||
BeatsSpecial[BeatsSpecial["AddFreeTimeBeat"] = 1] = "AddFreeTimeBeat";
|
||||
BeatsSpecial[BeatsSpecial["PulseFreeTimeBeat"] = 2] = "PulseFreeTimeBeat";
|
||||
BeatsSpecial[BeatsSpecial["AddOneshotBeat"] = 3] = "AddOneshotBeat";
|
||||
BeatsSpecial[BeatsSpecial["SetRowXs"] = 4] = "SetRowXs";
|
||||
})(BeatsSpecial || (BeatsSpecial = {}));
|
||||
var EventCondition;
|
||||
(function (EventCondition) {
|
||||
EventCondition["true"] = "true";
|
||||
@@ -19,6 +156,7 @@ var EventCondition;
|
||||
})(EventCondition || (EventCondition = {}));
|
||||
class RDViewWindow {
|
||||
constructor() {
|
||||
this.Objects = [];
|
||||
this.Row = 4;
|
||||
this.Column = 8;
|
||||
this.Scale = 1;
|
||||
@@ -26,18 +164,81 @@ class RDViewWindow {
|
||||
}
|
||||
class RDEvent {
|
||||
constructor() {
|
||||
this.Name = "";
|
||||
this.PrefixTab = undefined;
|
||||
this.Properties = [];
|
||||
this.SubType = EventType.custom;
|
||||
this.BeatType = undefined;
|
||||
this.Width = 1;
|
||||
this.Height = 1;
|
||||
this.EventX = 0;
|
||||
this.EventY = 0;
|
||||
this.Style = { Beat: 0, Y: 0 };
|
||||
}
|
||||
}
|
||||
class RDDescription {
|
||||
constructor() {
|
||||
this.Width = 4;
|
||||
this.Lines = [];
|
||||
}
|
||||
}
|
||||
class RDDescriptionLine {
|
||||
constructor() {
|
||||
this.BoxCount = 1;
|
||||
this.IconCount = 0;
|
||||
this.Items = [];
|
||||
}
|
||||
}
|
||||
class RDDescriptionText {
|
||||
constructor() {
|
||||
this.Text = "";
|
||||
}
|
||||
}
|
||||
class RDDescriptionBox {
|
||||
constructor() {
|
||||
this.Items = [];
|
||||
}
|
||||
}
|
||||
class RDDescriptionBoxInput {
|
||||
constructor() {
|
||||
this.Tips = "";
|
||||
this.Text = "";
|
||||
}
|
||||
}
|
||||
class RDDescriptionBoxScroll {
|
||||
constructor() {
|
||||
this.Scroll = 0;
|
||||
}
|
||||
}
|
||||
class RDDescriptionBoxButton {
|
||||
constructor() {
|
||||
this.Text = "";
|
||||
}
|
||||
}
|
||||
class RDDescriptionBoxSelect {
|
||||
constructor() {
|
||||
this.Items = [];
|
||||
this.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
class RDDescriptionIcon {
|
||||
}
|
||||
class RDStyle {
|
||||
constructor() {
|
||||
this.Beat = 0;
|
||||
this.Y = 0;
|
||||
}
|
||||
}
|
||||
class RDBeatStyle {
|
||||
constructor() {
|
||||
this.OneshotBeatSubType = [];
|
||||
this.RowXs = '------';
|
||||
}
|
||||
}
|
||||
var RDOneshotBeatSubType;
|
||||
(function (RDOneshotBeatSubType) {
|
||||
RDOneshotBeatSubType[RDOneshotBeatSubType["Freezeshot"] = 0] = "Freezeshot";
|
||||
RDOneshotBeatSubType[RDOneshotBeatSubType["Burnshot"] = 1] = "Burnshot";
|
||||
RDOneshotBeatSubType[RDOneshotBeatSubType["Skipshot"] = 2] = "Skipshot";
|
||||
RDOneshotBeatSubType[RDOneshotBeatSubType["Subdivision"] = 3] = "Subdivision";
|
||||
})(RDOneshotBeatSubType || (RDOneshotBeatSubType = {}));
|
||||
class RDGroup {
|
||||
constructor() {
|
||||
this.Width = 1;
|
||||
@@ -49,72 +250,97 @@ class RDGroup {
|
||||
}
|
||||
}
|
||||
function RDViewRender(lang, code) {
|
||||
const view = new RDViewWindow();
|
||||
const lines = code.split('\n');
|
||||
const window = new RDViewWindow();
|
||||
var objs = [];
|
||||
try {
|
||||
objs = ReadObjs(code);
|
||||
window.Objects = ReadObjs(code);
|
||||
}
|
||||
catch (error) {
|
||||
return ErrorElement(`${error}`);
|
||||
return errorHtml(`${error}`);
|
||||
}
|
||||
const args = lang.split(/\s+/g);
|
||||
if (1 < args.length && args.length <= 4) {
|
||||
if (args[1]) {
|
||||
view.Column = parseInt(args[1]);
|
||||
window.Column = parseInt(args[1]);
|
||||
}
|
||||
if (args[2]) {
|
||||
view.Row = parseInt(args[2]);
|
||||
window.Row = parseInt(args[2]);
|
||||
}
|
||||
if (args[3]) {
|
||||
view.Scale = parseFloat(args[3]);
|
||||
window.Scale = parseFloat(args[3]);
|
||||
}
|
||||
}
|
||||
return ConstructObjs(view, objs);
|
||||
}
|
||||
function ErrorElement(message = "") {
|
||||
const el = document.createElement("div");
|
||||
el.className = "rdtk-error";
|
||||
el.textContent = message;
|
||||
return el;
|
||||
}
|
||||
function PrefixToTab(prefix) {
|
||||
switch (prefix) {
|
||||
case "es": return "Sounds";
|
||||
case "eb": return "Rows";
|
||||
case "ea": return "Actions";
|
||||
case "ed": return "Sprites";
|
||||
case "er": return "Rooms";
|
||||
case "ec": return "Unknown";
|
||||
default: return undefined;
|
||||
return ConstructObjs(window);
|
||||
}
|
||||
function errorHtml(message = "") {
|
||||
return `<div class="RDView" style="--row:1;--column:0;"><div class="event actions" style="--beat:0;--y:0"><div class="description" style="--width:12;">${message.length ? `${message}` : ""}</div></div></div>`;
|
||||
}
|
||||
function ReadObjs(line) {
|
||||
const objs = [];
|
||||
var reader = new Reader(line);
|
||||
while (!reader.IsEnd()) {
|
||||
var event;
|
||||
var name = "";
|
||||
var prefix = "";
|
||||
try {
|
||||
name = reader.ReadSymbol();
|
||||
if (reader.TestRead('.', false)) {
|
||||
prefix = name;
|
||||
name = reader.ReadSymbol();
|
||||
}
|
||||
const type = reader.ReadSymbol().toLowerCase();
|
||||
event = ReadType(type);
|
||||
}
|
||||
catch (e) {
|
||||
name = "";
|
||||
}
|
||||
if (name.toLowerCase() === 'g') {
|
||||
event = new RDGroup();
|
||||
}
|
||||
else {
|
||||
const ev = new RDEvent();
|
||||
ev.Name = name;
|
||||
ev.PrefixTab = PrefixToTab(prefix);
|
||||
event = ev;
|
||||
event = new RDEvent();
|
||||
}
|
||||
if (event instanceof RDEvent) {
|
||||
reader.TestRead('.', true);
|
||||
const name = reader.ReadSymbol();
|
||||
var collection;
|
||||
switch (event.SubType) {
|
||||
case EventType.sounds:
|
||||
collection = tilePosition.events.sounds;
|
||||
break;
|
||||
case EventType.rows:
|
||||
collection = tilePosition.events.rows;
|
||||
switch (name) {
|
||||
case 'AddClassicBeat':
|
||||
event.BeatType = BeatsSpecial.AddClassicBeat;
|
||||
break;
|
||||
case 'AddFreeTimeBeat':
|
||||
event.BeatType = BeatsSpecial.AddFreeTimeBeat;
|
||||
break;
|
||||
case 'PulseFreeTimeBeat':
|
||||
event.BeatType = BeatsSpecial.PulseFreeTimeBeat;
|
||||
break;
|
||||
case 'AddOneshotBeat':
|
||||
event.BeatType = BeatsSpecial.AddOneshotBeat;
|
||||
break;
|
||||
case 'SetRowXs':
|
||||
event.BeatType = BeatsSpecial.SetRowXs;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EventType.actions:
|
||||
collection = tilePosition.events.actions;
|
||||
break;
|
||||
case EventType.decorations:
|
||||
collection = tilePosition.events.decorations;
|
||||
break;
|
||||
case EventType.rooms:
|
||||
collection = tilePosition.events.rooms;
|
||||
break;
|
||||
case EventType.custom:
|
||||
collection = tilePosition.events.custom;
|
||||
break;
|
||||
default:
|
||||
collection = tilePosition.events.custom;
|
||||
break;
|
||||
}
|
||||
const pos = collection.filter(i => i.name.toLowerCase() === name.toLowerCase())[0];
|
||||
if (pos) {
|
||||
event.EventX = pos.position[0];
|
||||
event.EventY = pos.position[1];
|
||||
event.Width = pos.position[2];
|
||||
event.Height = pos.position[3];
|
||||
}
|
||||
try {
|
||||
event.Style.Beat = reader.ReadFloat();
|
||||
}
|
||||
@@ -369,7 +595,7 @@ class Reader {
|
||||
line += this.line;
|
||||
position = this.position;
|
||||
}
|
||||
return `<br>at "${s[line]}".`;
|
||||
return `<br>at "${s[line]}".`; //, at ${line + 1}:${position - curp}`;
|
||||
}
|
||||
}
|
||||
function FindValue(pairs, key) {
|
||||
@@ -379,22 +605,79 @@ function FindValue(pairs, key) {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function ReadType(typename) {
|
||||
var t = EventType.custom;
|
||||
var event;
|
||||
switch (typename[0]) {
|
||||
case 'e':
|
||||
event = new RDEvent();
|
||||
switch (typename[1]) {
|
||||
case 's':
|
||||
t = EventType.sounds;
|
||||
break;
|
||||
case 'b':
|
||||
t = EventType.rows;
|
||||
break;
|
||||
case 'a':
|
||||
t = EventType.actions;
|
||||
break;
|
||||
case 'd':
|
||||
t = EventType.decorations;
|
||||
break;
|
||||
case 'r':
|
||||
t = EventType.rooms;
|
||||
break;
|
||||
case 'c':
|
||||
t = EventType.custom;
|
||||
break;
|
||||
default:
|
||||
t = EventType.custom;
|
||||
}
|
||||
event.SubType = t;
|
||||
break;
|
||||
case 'g':
|
||||
event = new RDGroup();
|
||||
break;
|
||||
default:
|
||||
event = new RDEvent();
|
||||
}
|
||||
return event;
|
||||
}
|
||||
function ReadProperties(reader, event, pairs) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
if (event instanceof RDGroup) {
|
||||
var value;
|
||||
if (value = FindValue(pairs, "hue")) {
|
||||
try {
|
||||
event.Style.Hue = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "brightness")) {
|
||||
try {
|
||||
event.Style.Brightness = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "grayscale")) {
|
||||
try {
|
||||
event.Style.Grayscale = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "opacity")) {
|
||||
try {
|
||||
event.Style.Opacity = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "offset")) {
|
||||
reader = new Reader(value.Value);
|
||||
(_a = event.ClickStyle) !== null && _a !== void 0 ? _a : (event.ClickStyle = new RDStyle());
|
||||
@@ -429,293 +712,281 @@ function ReadProperties(reader, event, pairs) {
|
||||
}
|
||||
}
|
||||
else if (event instanceof RDEvent) {
|
||||
for (const pair of pairs) {
|
||||
const key = pair.Key;
|
||||
const value = pair.Value;
|
||||
switch (key) {
|
||||
case "if":
|
||||
if (["true", "false", "both"].find(i => i === value)) {
|
||||
event.Condition = value === "true" ? EventCondition.true :
|
||||
value === "false" ? EventCondition.false : EventCondition.both;
|
||||
var value;
|
||||
if (value = FindValue(pairs, "if")) {
|
||||
if (["true", "false", "both"].find(i => i === (value === null || value === void 0 ? void 0 : value.Value))) {
|
||||
event.Condition = value.Value === "true" ? EventCondition.true :
|
||||
value.Value === "false" ? EventCondition.false : EventCondition.both;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Expecting "true", "false" or "both", but find "${value}".`);
|
||||
throw new Error(`Expecting "true", "false" or "both", but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "tag")) {
|
||||
event.Tag = value.Value === "true" ? true : false;
|
||||
}
|
||||
if (value = FindValue(pairs, "hue")) {
|
||||
event.Style.Hue = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "brightness")) {
|
||||
event.Style.Brightness = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "grayscale")) {
|
||||
event.Style.Grayscale = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "opacity")) {
|
||||
event.Style.Opacity = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
case "tag":
|
||||
event.Tag = value === "true";
|
||||
break;
|
||||
case "hue":
|
||||
event.Style.Hue = parseFloat(value);
|
||||
break;
|
||||
case "brightness":
|
||||
event.Style.Brightness = parseFloat(value);
|
||||
break;
|
||||
case "grayscale":
|
||||
event.Style.Grayscale = parseFloat(value);
|
||||
break;
|
||||
case "opacity":
|
||||
event.Style.Opacity = parseFloat(value);
|
||||
break;
|
||||
case "offset": {
|
||||
const offsetReader = new Reader(value);
|
||||
(_f = event.ClickStyle) !== null && _f !== void 0 ? _f : (event.ClickStyle = new RDStyle());
|
||||
if (value = FindValue(pairs, "offset")) {
|
||||
reader = new Reader(value.Value);
|
||||
try {
|
||||
event.ClickStyle.Beat = offsetReader.ReadFloat();
|
||||
event.ClickStyle.Beat = reader.ReadFloat();
|
||||
}
|
||||
catch (e) { }
|
||||
try {
|
||||
event.ClickStyle.Y = offsetReader.ReadInt();
|
||||
event.ClickStyle.Y = reader.ReadInt();
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_hue")) {
|
||||
event.ClickStyle.Hue = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_brightness")) {
|
||||
event.ClickStyle.Brightness = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_grayscale")) {
|
||||
event.ClickStyle.Grayscale = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_opacity")) {
|
||||
event.ClickStyle.Opacity = parseFloat(value.Value);
|
||||
}
|
||||
if (event.BeatType !== undefined) {
|
||||
event.BeatStyle = new RDBeatStyle();
|
||||
if (value = FindValue(pairs, "tick")) {
|
||||
event.BeatStyle.Tick = parseFloat(value.Value);
|
||||
}
|
||||
switch (event.BeatType) {
|
||||
case BeatsSpecial.AddClassicBeat:
|
||||
if (value = FindValue(pairs, "swing")) {
|
||||
event.BeatStyle.Swing = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
case BeatsSpecial.AddFreeTimeBeat:
|
||||
if (value = FindValue(pairs, "pulse")) {
|
||||
event.BeatStyle.Pulse = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
case "offset_hue":
|
||||
(_g = event.ClickStyle) !== null && _g !== void 0 ? _g : (event.ClickStyle = new RDStyle());
|
||||
event.ClickStyle.Hue = parseFloat(value);
|
||||
break;
|
||||
case "offset_brightness":
|
||||
(_h = event.ClickStyle) !== null && _h !== void 0 ? _h : (event.ClickStyle = new RDStyle());
|
||||
event.ClickStyle.Brightness = parseFloat(value);
|
||||
case BeatsSpecial.PulseFreeTimeBeat:
|
||||
if (value = FindValue(pairs, "pulse")) {
|
||||
event.BeatStyle.Pulse = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
case "offset_grayscale":
|
||||
(_j = event.ClickStyle) !== null && _j !== void 0 ? _j : (event.ClickStyle = new RDStyle());
|
||||
event.ClickStyle.Grayscale = parseFloat(value);
|
||||
case BeatsSpecial.SetRowXs:
|
||||
if ((value = FindValue(pairs, "rowxs"))) {
|
||||
if (value.Value.match(/^[-x]{6}$/)) {
|
||||
event.BeatStyle.RowXs = value.Value;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Expect a string of length 6, consisting of "x" and "-", instead of "${value === null || value === void 0 ? void 0 : value.Value}".`);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "offset_opacity":
|
||||
(_k = event.ClickStyle) !== null && _k !== void 0 ? _k : (event.ClickStyle = new RDStyle());
|
||||
event.ClickStyle.Opacity = parseFloat(value);
|
||||
break;
|
||||
default:
|
||||
event.Properties.push(pair);
|
||||
case BeatsSpecial.AddOneshotBeat:
|
||||
if (value = FindValue(pairs, "type")) {
|
||||
const types = value.Value.split(/\s+/);
|
||||
var illegal;
|
||||
if ((illegal = types.filter(i => {
|
||||
![
|
||||
"freezeshot",
|
||||
"burnshot",
|
||||
"skipshot",
|
||||
"subdivision"
|
||||
].includes(i);
|
||||
})).length) {
|
||||
throw new Error(`Expecting "freezeshot", "burnshot", "skipshot" or "subdivision", but find ${illegal.map(i => `"${i}"`).join(', ')}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const CELL_SIZE = 28;
|
||||
const RDTK_SCALE = 2;
|
||||
const NUMERIC_KEYS = new Set([
|
||||
"tick", "swing", "hold", "pulse", "customPulse", "interval", "delay", "loop",
|
||||
"subdivision", "crotchetsPerBar", "syncoBeat", "duration", "angle", "bpm",
|
||||
"beatsPerMinute", "volume", "speed", "startOpacity", "endOpacity", "subdivOffset",
|
||||
]);
|
||||
const SAY_PHRASES = new Set([
|
||||
"SayReaDyGetSetGoNew", "SayReaDyGetSetOne", "SayGetSetGo", "SayGetSetOne",
|
||||
"JustSayRea", "JustSayDy", "JustSayGet", "JustSaySet", "JustSayAnd",
|
||||
"JustSayGo", "JustSayStop", "JustSayAndStop", "SaySwitch", "SayWatch",
|
||||
"SayListen", "Count1", "Count2", "Count3", "Count4", "Count5", "Count6",
|
||||
"Count7", "Count8", "Count9", "Count10", "SayReadyGetSetGo", "JustSayReady",
|
||||
]);
|
||||
function CoerceValue(key, value) {
|
||||
if (value === "true") {
|
||||
return true;
|
||||
}
|
||||
if (value === "false") {
|
||||
return false;
|
||||
}
|
||||
if (NUMERIC_KEYS.has(key) && /^[+-]?(\d+(\.\d+)?|\.\d+)$/.test(value)) {
|
||||
return Number(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function ToRDtkObject(ev) {
|
||||
const obj = { type: ev.Name };
|
||||
let tab = undefined;
|
||||
for (const pair of ev.Properties) {
|
||||
let key = pair.Key;
|
||||
const value = pair.Value;
|
||||
if (key === "tab") {
|
||||
tab = value;
|
||||
continue;
|
||||
}
|
||||
if (key === "tag") {
|
||||
continue;
|
||||
}
|
||||
if (ev.Name === "AddOneshotBeat" && key === "type") {
|
||||
const types = value.split(/\s+/).filter(i => i.length > 0);
|
||||
for (const t of types) {
|
||||
switch (t) {
|
||||
else {
|
||||
types.map(i => {
|
||||
var _a, _b, _c, _d;
|
||||
switch (i) {
|
||||
case "freezeshot":
|
||||
obj.freezeBurnMode = "Freezeshot";
|
||||
(_a = event.BeatStyle) === null || _a === void 0 ? void 0 : _a.OneshotBeatSubType.push(RDOneshotBeatSubType.Freezeshot);
|
||||
break;
|
||||
case "burnshot":
|
||||
obj.freezeBurnMode = "Burnshot";
|
||||
(_b = event.BeatStyle) === null || _b === void 0 ? void 0 : _b.OneshotBeatSubType.push(RDOneshotBeatSubType.Burnshot);
|
||||
break;
|
||||
case "skipshot":
|
||||
obj.skipshot = true;
|
||||
(_c = event.BeatStyle) === null || _c === void 0 ? void 0 : _c.OneshotBeatSubType.push(RDOneshotBeatSubType.Skipshot);
|
||||
break;
|
||||
case "subdivision":
|
||||
(_d = event.BeatStyle) === null || _d === void 0 ? void 0 : _d.OneshotBeatSubType.push(RDOneshotBeatSubType.Subdivision);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "interval")) {
|
||||
event.BeatStyle.Interval = parseFloat(value.Value);
|
||||
}
|
||||
if ((value = FindValue(pairs, "delay"))
|
||||
&& event.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Freezeshot)) {
|
||||
event.BeatStyle.Delay = parseFloat(value.Value);
|
||||
}
|
||||
if ((value = FindValue(pairs, "subdivision"))
|
||||
&& event.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Subdivision)) {
|
||||
event.BeatStyle.Subdivision = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "loop")) {
|
||||
event.BeatStyle.Loop = parseInt(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (ev.Name === "AddOneshotBeat" && key === "hold") {
|
||||
obj.hold = !(value === "false" || value === "0" || value === "0.0");
|
||||
continue;
|
||||
}
|
||||
if (key === "rowxs") {
|
||||
key = "pattern";
|
||||
}
|
||||
else if (ev.Name === "AddOneshotBeat" && key === "loop") {
|
||||
key = "loops";
|
||||
}
|
||||
else if (ev.Name === "AddOneshotBeat" && key === "subdivision") {
|
||||
key = "subdivisions";
|
||||
}
|
||||
if (ev.Name === "SayReadyGetSetGo" && key === "phraseToSay") {
|
||||
if (SAY_PHRASES.has(value)) {
|
||||
obj.phraseToSay = value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
obj[key] = CoerceValue(key, value);
|
||||
}
|
||||
if (tab !== undefined) {
|
||||
obj.tab = tab;
|
||||
}
|
||||
else if (ev.PrefixTab !== undefined) {
|
||||
obj.tab = ev.PrefixTab;
|
||||
}
|
||||
if (ev.Tag === true) {
|
||||
obj.tag = true;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function ConstructObjs(view, objs) {
|
||||
const content = document.createElement("div");
|
||||
content.className = "RDViewContent";
|
||||
content.style.setProperty("--column", `${view.Column}`);
|
||||
content.style.setProperty("--row", `${view.Row}`);
|
||||
content.style.setProperty("--scale", `${view.Scale}`);
|
||||
const canvas = document.createElement("div");
|
||||
canvas.className = "RDView rdtk-rdview";
|
||||
canvas.style.setProperty("--column", `${view.Column}`);
|
||||
canvas.style.setProperty("--row", `${view.Row}`);
|
||||
canvas.style.setProperty("--scale", `${view.Scale}`);
|
||||
for (const obj of objs) {
|
||||
const node = BuildObject(obj);
|
||||
if (node) {
|
||||
canvas.appendChild(node);
|
||||
}
|
||||
}
|
||||
content.appendChild(canvas);
|
||||
return content;
|
||||
function ConstructObjs(window) {
|
||||
var html = `<div class="RDViewContent" style="--column:${window.Column};--row:${window.Row};--scale:${window.Scale};">`
|
||||
+ `<div class="RDView" style="--column:${window.Column};--row:${window.Row};--scale:${window.Scale};">`;
|
||||
for (var obj of window.Objects) {
|
||||
html += ConstructDivObject(obj);
|
||||
}
|
||||
function BuildObject(obj) {
|
||||
return obj instanceof RDGroup ? BuildGroup(obj) : BuildEvent(obj);
|
||||
html += `</div></div>`;
|
||||
return html;
|
||||
}
|
||||
function BuildEvent(ev) {
|
||||
function ConstructDivObject(obj) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
||||
if (obj instanceof RDEvent) {
|
||||
return `<div class="event ${obj.BeatType === undefined ? `${obj.SubType}` : 'beat'}"style="${ConstructCssPropertiesIfExists(new Map([
|
||||
['beat', obj.Style.Beat],
|
||||
['y', obj.Style.Y],
|
||||
['event-x', obj.EventX],
|
||||
['event-y', obj.EventY],
|
||||
['event-width', obj.Width],
|
||||
['event-height', obj.Height],
|
||||
['hue', obj.Style.Hue],
|
||||
['brightness', obj.Style.Brightness],
|
||||
['grayscale', obj.Style.Grayscale],
|
||||
['opacity', obj.Style.Opacity],
|
||||
['offset-beat', (_a = obj.ClickStyle) === null || _a === void 0 ? void 0 : _a.Beat],
|
||||
['offset-y', (_b = obj.ClickStyle) === null || _b === void 0 ? void 0 : _b.Y],
|
||||
['offset-hue', (_c = obj.ClickStyle) === null || _c === void 0 ? void 0 : _c.Hue],
|
||||
['offset-brightness', (_d = obj.ClickStyle) === null || _d === void 0 ? void 0 : _d.Brightness],
|
||||
['offset-grayscale', (_e = obj.ClickStyle) === null || _e === void 0 ? void 0 : _e.Grayscale],
|
||||
['offset-opacity', (_f = obj.ClickStyle) === null || _f === void 0 ? void 0 : _f.Opacity],
|
||||
['tick', (_g = obj.BeatStyle) === null || _g === void 0 ? void 0 : _g.Tick],
|
||||
['delay', (_h = obj.BeatStyle) === null || _h === void 0 ? void 0 : _h.Delay],
|
||||
['interval', (_j = obj.BeatStyle) === null || _j === void 0 ? void 0 : _j.Interval],
|
||||
['subdivision', (_k = obj.BeatStyle) === null || _k === void 0 ? void 0 : _k.Subdivision],
|
||||
['hold', (_l = obj.BeatStyle) === null || _l === void 0 ? void 0 : _l.Hold],
|
||||
['pulse', (_m = obj.BeatStyle) === null || _m === void 0 ? void 0 : _m.Pulse],
|
||||
['swing', (_o = obj.BeatStyle) === null || _o === void 0 ? void 0 : _o.Swing],
|
||||
['loop', (_p = obj.BeatStyle) === null || _p === void 0 ? void 0 : _p.Loop],
|
||||
]))}">${ConstructSubDiv([obj.Condition !== undefined, `condition-${obj.Condition}`, () => ''], [obj.Tag === true, `tag`, () => ''], [obj.BeatType === BeatsSpecial.AddClassicBeat, `classicbeat`, () => {
|
||||
var result = '';
|
||||
for (var i = 0; i < 6; i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
return result;
|
||||
}], [obj.BeatType === BeatsSpecial.AddFreeTimeBeat, `add freetime`, () => { return ''; }], [obj.BeatType === BeatsSpecial.PulseFreeTimeBeat, `pulse freetime`, () => ''], [((_q = obj.BeatStyle) === null || _q === void 0 ? void 0 : _q.Loop) !== undefined && obj.BeatStyle.Loop > 0, `loop`, () => {
|
||||
var _a, _b;
|
||||
var result = '';
|
||||
for (var i = 0; i < ((_b = (_a = obj.BeatStyle) === null || _a === void 0 ? void 0 : _a.Loop) !== null && _b !== void 0 ? _b : 0); i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
return result;
|
||||
}], [obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Freezeshot), `freezeshots`, () => {
|
||||
var _a, _b;
|
||||
var result = '';
|
||||
for (var i = 0; i < ((_b = (_a = obj.BeatStyle) === null || _a === void 0 ? void 0 : _a.Loop) !== null && _b !== void 0 ? _b : 0) + 1; i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
return result;
|
||||
}], [obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Burnshot), `burnshots`, () => {
|
||||
var _a, _b;
|
||||
var result = '';
|
||||
for (var i = 0; i < ((_b = (_a = obj.BeatStyle) === null || _a === void 0 ? void 0 : _a.Loop) !== null && _b !== void 0 ? _b : 0) + 1; i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
return result;
|
||||
}], [obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Subdivision), `subdivisions`, () => {
|
||||
var _a, _b, _c, _d;
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "rdtk-event";
|
||||
wrapper.style.left = `${ev.Style.Beat * CELL_SIZE}px`;
|
||||
wrapper.style.top = `${ev.Style.Y * CELL_SIZE}px`;
|
||||
const state = { enabled: true, active: false, hover: false, scale: RDTK_SCALE, showDuration: false };
|
||||
const rdobj = ToRDtkObject(ev);
|
||||
const inner = rdobj ? createElementEvent(rdobj, state) : null;
|
||||
if (inner) {
|
||||
inner.style.position = "absolute";
|
||||
inner.style.left = "0px";
|
||||
inner.style.top = "0px";
|
||||
wrapper.appendChild(inner);
|
||||
var result = '';
|
||||
for (var l = 0; l < ((_b = (_a = obj.BeatStyle) === null || _a === void 0 ? void 0 : _a.Loop) !== null && _b !== void 0 ? _b : 0) + 1; l++) {
|
||||
result += `<div class="subdivision">`;
|
||||
for (var i = 0; i < ((_d = (_c = obj.BeatStyle) === null || _c === void 0 ? void 0 : _c.Subdivision) !== null && _d !== void 0 ? _d : 1); i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
result += `</div>`;
|
||||
}
|
||||
return result;
|
||||
}], [obj.BeatType === BeatsSpecial.SetRowXs, `row-xs`, () => {
|
||||
var _a;
|
||||
var result = '';
|
||||
for (var i = 0; i < 6; i++) {
|
||||
result += (((_a = obj.BeatStyle) === null || _a === void 0 ? void 0 : _a.RowXs[i]) === 'x') ? `<div class="x"></div>` : `<div></div>`;
|
||||
}
|
||||
return result;
|
||||
}], [(obj.BeatType === BeatsSpecial.AddClassicBeat || obj.BeatType === BeatsSpecial.AddFreeTimeBeat || obj.BeatType === BeatsSpecial.PulseFreeTimeBeat || obj.BeatType === BeatsSpecial.AddOneshotBeat) && ((_s = (_r = obj.BeatStyle) === null || _r === void 0 ? void 0 : _r.Hold) !== null && _s !== void 0 ? _s : 0) > 0, `holdbeat`, () => ''], [obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Skipshot), `skipshot`, () => ''])}</div>`;
|
||||
}
|
||||
else if (obj instanceof RDGroup) {
|
||||
return `<div class="event group"style="${ConstructCssPropertiesIfExists(new Map([
|
||||
['group-beat', obj.Style.Beat],
|
||||
['group-y', obj.Style.Y],
|
||||
['group-width', obj.Width],
|
||||
['group-height', obj.Height],
|
||||
['group-hue', obj.Style.Hue],
|
||||
['group-brightness', obj.Style.Brightness],
|
||||
['group-grayscale', obj.Style.Grayscale],
|
||||
['group-opacity', obj.Style.Opacity],
|
||||
['group-outline', ToHex(obj.Outline)],
|
||||
['group-offset-beat', obj.ClickStyle.Beat],
|
||||
['group-offset-y', obj.ClickStyle.Y],
|
||||
['group-offset-hue', obj.ClickStyle.Hue],
|
||||
['group-offset-brightness', obj.ClickStyle.Brightness],
|
||||
['group-offset-grayscale', obj.ClickStyle.Grayscale],
|
||||
['group-offset-opacity', obj.ClickStyle.Opacity],
|
||||
['group-offset-outline', ToHex((_t = obj.ClickOutline) !== null && _t !== void 0 ? _t : obj.Outline)],
|
||||
]))}">${obj.Children.map(i => ConstructDivObject(i)).join('')}</div>`;
|
||||
}
|
||||
else {
|
||||
wrapper.classList.add("rdtk-unknown");
|
||||
wrapper.textContent = ev.Name || "unknown";
|
||||
}
|
||||
ApplyFilter(wrapper, ev.Style);
|
||||
if (ev.Condition !== undefined) {
|
||||
const condition = document.createElement("div");
|
||||
condition.className = `rdtk-condition condition-${ev.Condition}`;
|
||||
wrapper.appendChild(condition);
|
||||
}
|
||||
const offsetBeat = (_b = (_a = ev.ClickStyle) === null || _a === void 0 ? void 0 : _a.Beat) !== null && _b !== void 0 ? _b : 0;
|
||||
const offsetY = (_d = (_c = ev.ClickStyle) === null || _c === void 0 ? void 0 : _c.Y) !== null && _d !== void 0 ? _d : 0;
|
||||
const hasOffset = offsetBeat !== 0 || offsetY !== 0;
|
||||
function setState(hover, active) {
|
||||
state.hover = hover;
|
||||
state.active = active;
|
||||
inner === null || inner === void 0 ? void 0 : inner.onStateChange(state);
|
||||
wrapper.classList.toggle("hover", hover);
|
||||
wrapper.classList.toggle("active", active);
|
||||
wrapper.style.transform = (active && hasOffset)
|
||||
? `translate(${offsetBeat * CELL_SIZE}px, ${offsetY * CELL_SIZE}px)`
|
||||
: "";
|
||||
ApplyFilter(wrapper, active && ev.ClickStyle ? ev.ClickStyle : ev.Style);
|
||||
}
|
||||
wrapper.addEventListener("mouseover", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget)) {
|
||||
setState(true, state.active);
|
||||
}
|
||||
});
|
||||
wrapper.addEventListener("mouseout", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget)) {
|
||||
setState(false, false);
|
||||
}
|
||||
});
|
||||
wrapper.addEventListener("mousedown", () => setState(true, true));
|
||||
wrapper.addEventListener("mouseup", () => setState(state.hover, false));
|
||||
wrapper.__setRDtkState = setState;
|
||||
return wrapper;
|
||||
}
|
||||
function BuildGroup(grp) {
|
||||
var _a, _b, _c, _d;
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "rdtk-group";
|
||||
wrapper.style.left = `${grp.Style.Beat * CELL_SIZE}px`;
|
||||
wrapper.style.top = `${grp.Style.Y * CELL_SIZE}px`;
|
||||
wrapper.style.width = `${grp.Width * CELL_SIZE}px`;
|
||||
wrapper.style.height = `${grp.Height * CELL_SIZE}px`;
|
||||
wrapper.style.outlineColor = ToHex(grp.Outline);
|
||||
ApplyFilter(wrapper, grp.Style);
|
||||
for (const child of grp.Children) {
|
||||
const node = BuildObject(child);
|
||||
if (node) {
|
||||
wrapper.appendChild(node);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
const offsetBeat = (_b = (_a = grp.ClickStyle) === null || _a === void 0 ? void 0 : _a.Beat) !== null && _b !== void 0 ? _b : 0;
|
||||
const offsetY = (_d = (_c = grp.ClickStyle) === null || _c === void 0 ? void 0 : _c.Y) !== null && _d !== void 0 ? _d : 0;
|
||||
const hasOffset = offsetBeat !== 0 || offsetY !== 0;
|
||||
function setState(hover, active) {
|
||||
var _a;
|
||||
wrapper.classList.toggle("hover", hover);
|
||||
wrapper.classList.toggle("active", active);
|
||||
wrapper.style.transform = (active && hasOffset)
|
||||
? `translate(${offsetBeat * CELL_SIZE}px, ${offsetY * CELL_SIZE}px)`
|
||||
: "";
|
||||
wrapper.style.outlineColor = active ? ToHex((_a = grp.ClickOutline) !== null && _a !== void 0 ? _a : grp.Outline) : ToHex(grp.Outline);
|
||||
ApplyFilter(wrapper, active && grp.ClickStyle ? grp.ClickStyle : grp.Style);
|
||||
function ConstructCssPropertiesIfExists(pairs) {
|
||||
var result = '';
|
||||
for (const [key, value] of pairs) {
|
||||
result += value !== undefined ? `--${key}:${value};` : ``;
|
||||
}
|
||||
wrapper.addEventListener("mouseover", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget)) {
|
||||
setState(true, false);
|
||||
return result;
|
||||
}
|
||||
});
|
||||
wrapper.addEventListener("mouseout", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget)) {
|
||||
setState(false, false);
|
||||
function ConstructCssProperties(pairs) {
|
||||
var result = '';
|
||||
for (const [key, value] of pairs) {
|
||||
result += `--${key}:${value};`;
|
||||
}
|
||||
});
|
||||
wrapper.addEventListener("mousedown", () => setState(true, true));
|
||||
wrapper.addEventListener("mouseup", () => setState(true, false));
|
||||
wrapper.__setRDtkState = setState;
|
||||
return wrapper;
|
||||
return result;
|
||||
}
|
||||
function ApplyFilter(el, style) {
|
||||
const parts = [];
|
||||
if (style.Hue !== undefined) {
|
||||
parts.push(`hue-rotate(${style.Hue}deg)`);
|
||||
function ConstructSubDiv(...pairs) {
|
||||
var result = '';
|
||||
for (const [key, name, func] of pairs) {
|
||||
result += key ? `<div class="${name}">${func()}</div>` : ``;
|
||||
}
|
||||
if (style.Brightness !== undefined) {
|
||||
parts.push(`brightness(${style.Brightness}%)`);
|
||||
}
|
||||
if (style.Grayscale !== undefined) {
|
||||
parts.push(`grayscale(${style.Grayscale}%)`);
|
||||
}
|
||||
if (style.Opacity !== undefined) {
|
||||
parts.push(`opacity(${style.Opacity}%)`);
|
||||
}
|
||||
el.style.filter = parts.join(" ");
|
||||
return result;
|
||||
}
|
||||
function ToHex(color) {
|
||||
const hex = parseInt(color.red.toFixed(0)).toString(16).padStart(2, '0') +
|
||||
|
||||
+602
-279
@@ -1,5 +1,123 @@
|
||||
import { createElementEvent, IconStyle } from "./rdtkview.js";
|
||||
|
||||
var tilePosition = {
|
||||
"events": {
|
||||
"sounds": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_1", "position": [0, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_2", "position": [1, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_3", "position": [2, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_4", "position": [3, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_5", "position": [4, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_6", "position": [5, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_7", "position": [6, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_8", "position": [7, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar_9", "position": [8, 1, 1, 1] },
|
||||
{ "name": "SetCrotchetsPerBar", "position": [9, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_1", "position": [0, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_2", "position": [1, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_3", "position": [2, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_4", "position": [3, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_5", "position": [4, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_6", "position": [5, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_7", "position": [6, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_8", "position": [7, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_9", "position": [8, 2, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_10", "position": [9, 2, 1, 1] },
|
||||
{ "name": "PlaySong", "position": [0, 3, 2, 1] },
|
||||
{ "name": "PlaySound", "position": [2, 3, 1, 1] },
|
||||
{ "name": "SetBeatsPerMinute", "position": [3, 3, 1, 1] },
|
||||
{ "name": "SetClapSounds", "position": [4, 3, 1, 1] },
|
||||
{ "name": "SetHeartExplodeVolume", "position": [5, 3, 1, 1] },
|
||||
{ "name": "SetHeartExplodeInterval", "position": [6, 3, 1, 1] },
|
||||
{ "name": "SetGameSound", "position": [7, 3, 1, 1] },
|
||||
{ "name": "SetBeatSound", "position": [8, 3, 1, 1] },
|
||||
{ "name": "SetCountingSound", "position": [9, 3, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Rea", "position": [1, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Dy", "position": [2, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Get", "position": [3, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Set", "position": [4, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Go", "position": [5, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Ready", "position": [10, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_And", "position": [10, 1, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_GetSetGo", "position": [11, 0, 3, 1] },
|
||||
{ "name": "SayReadyGetSetGo_GetSetOne", "position": [11, 1, 3, 1] },
|
||||
{ "name": "SayReadyGetSetGo_Stop", "position": [14, 0, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_AndStop", "position": [14, 1, 1, 1] },
|
||||
{ "name": "SayReadyGetSetGo_ReaDyGetSetGo", "position": [10, 2, 5, 1] },
|
||||
{ "name": "SayReadyGetSetGo_ReaDyGetSetOne", "position": [10, 3, 5, 1] },
|
||||
{ "name": "Comment", "position": [15, 0, 1, 1] }
|
||||
],
|
||||
"rows": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "SetOneshotWave", "position": [1, 0, 1, 1] }
|
||||
],
|
||||
"actions": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "SetTheme", "position": [1, 0, 1, 1] },
|
||||
{ "name": "SetVFXPreset", "position": [2, 0, 1, 1] },
|
||||
{ "name": "SetBackgroundColor", "position": [3, 0, 1, 1] },
|
||||
{ "name": "SetForeground", "position": [4, 0, 1, 1] },
|
||||
{ "name": "SetSpeed", "position": [5, 0, 1, 1] },
|
||||
{ "name": "Flash", "position": [6, 0, 1, 1] },
|
||||
{ "name": "CustomFlash", "position": [7, 0, 1, 1] },
|
||||
{ "name": "NewWindowDance", "position": [8, 0, 1, 1] },
|
||||
{ "name": "MoveCamera", "position": [0, 1, 1, 1] },
|
||||
{ "name": "PulseCamera", "position": [1, 1, 1, 1] },
|
||||
{ "name": "TextExplosion", "position": [2, 1, 1, 1] },
|
||||
{ "name": "ShowDialogue", "position": [3, 1, 1, 1] },
|
||||
{ "name": "ShowStatusSign", "position": [4, 1, 1, 1] },
|
||||
{ "name": "FloatingText", "position": [5, 1, 1, 1] },
|
||||
{ "name": "AdvanceText", "position": [6, 1, 0.5, 1] },
|
||||
{ "name": "ChangePlayersRows", "position": [7, 1, 1, 1] },
|
||||
{ "name": "Comment", "position": [8, 1, 1, 1] },
|
||||
{ "name": "FinishLevel", "position": [0, 2, 1, 1] },
|
||||
{ "name": "Stutter", "position": [1, 2, 1, 1] },
|
||||
{ "name": "HideRow", "position": [2, 2, 1, 1] },
|
||||
{ "name": "MoveRow", "position": [3, 2, 1, 1] },
|
||||
{ "name": "PlayExpression", "position": [4, 2, 1, 1] },
|
||||
{ "name": "TintRows", "position": [5, 2, 1, 1] },
|
||||
{ "name": "BassDrop", "position": [6, 2, 1, 1] },
|
||||
{ "name": "ShakeScreen", "position": [7, 2, 1, 1] },
|
||||
{ "name": "FlipScreen", "position": [0, 3, 1, 1] },
|
||||
{ "name": "InvertColors", "position": [1, 3, 1, 1] },
|
||||
{ "name": "ShowHands", "position": [2, 3, 1, 1] },
|
||||
{ "name": "PaintHands", "position": [3, 3, 1, 1] },
|
||||
{ "name": "SetHandOwner", "position": [4, 3, 1, 1] },
|
||||
{ "name": "SetPlayStyle", "position": [5, 3, 1, 1] },
|
||||
{ "name": "TagAction", "position": [6, 3, 1, 1] },
|
||||
{ "name": "CallCustomMethod", "position": [7, 3, 1, 1] }
|
||||
],
|
||||
"decorations": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "PlayAnimation", "position": [1, 0, 1, 1] },
|
||||
{ "name": "Tint", "position": [0, 1, 1, 1] },
|
||||
{ "name": "Comment", "position": [1, 1, 1, 1] },
|
||||
{ "name": "SetVisible", "position": [0, 2, 1, 1] },
|
||||
{ "name": "Move", "position": [0, 3, 1, 1] }
|
||||
],
|
||||
"rooms": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "MoveRoom", "position": [0, 1, 1, 1] },
|
||||
{ "name": "FadeRoom", "position": [0, 2, 1, 1] },
|
||||
{ "name": "MaskRoom", "position": [0, 3, 1, 1] },
|
||||
{ "name": "ShowRooms", "position": [1, 0, 1, 4] },
|
||||
{ "name": "ReorderRooms", "position": [2, 0, 1, 4] },
|
||||
{ "name": "SetRoomContentMode", "position": [3, 0, 1, 1] },
|
||||
{ "name": "SetRoomPerspective", "position": [3, 1, 1, 1] },
|
||||
{ "name": "Comment", "position": [3, 2, 1, 1] }
|
||||
],
|
||||
"custom": [
|
||||
{ "name": "Empty", "position": [0, 0, 1, 1] },
|
||||
{ "name": "Comment", "position": [0, 1, 1, 1] }
|
||||
],
|
||||
"beatsSpecial": [
|
||||
"AddClassicBeat",
|
||||
"AddOneshotBeat",
|
||||
"AddFreeTimeBeat",
|
||||
"PulseFreeTimeBeat",
|
||||
"SetRowXs"
|
||||
]
|
||||
}
|
||||
}
|
||||
function loadRDView() {
|
||||
(window as any).RDViewRender = RDViewRender;
|
||||
}
|
||||
@@ -15,24 +133,88 @@ class Color {
|
||||
this.alpha = alpha;
|
||||
};
|
||||
}
|
||||
enum EventType {
|
||||
sounds = "sounds",
|
||||
rows = "rows",
|
||||
actions = "actions",
|
||||
decorations = "decorations",
|
||||
rooms = "rooms",
|
||||
custom = "custom",
|
||||
}
|
||||
enum BeatsSpecial {
|
||||
AddClassicBeat,
|
||||
AddFreeTimeBeat,
|
||||
PulseFreeTimeBeat,
|
||||
AddOneshotBeat,
|
||||
SetRowXs,
|
||||
}
|
||||
enum EventCondition {
|
||||
true = "true",
|
||||
false = "false",
|
||||
both = "both",
|
||||
}
|
||||
class RDViewWindow {
|
||||
Objects: (RDEvent | RDGroup)[] = [];
|
||||
Row: number = 4;
|
||||
Column: number = 8;
|
||||
Scale: number = 1;
|
||||
}
|
||||
class RDEvent {
|
||||
Name: string = "";
|
||||
PrefixTab?: string = undefined;
|
||||
Properties: KeyValuePair[] = [];
|
||||
SubType: EventType = EventType.custom;
|
||||
BeatType?: BeatsSpecial = undefined;
|
||||
BeatStyle?: RDBeatStyle;
|
||||
Width: number = 1;
|
||||
Height: number = 1;
|
||||
EventX: number = 0;
|
||||
EventY: number = 0;
|
||||
Style: RDStyle = { Beat: 0, Y: 0 };
|
||||
ClickStyle?: RDStyle;
|
||||
Condition?: EventCondition;
|
||||
Tag?: boolean;
|
||||
Description?: RDDescription;
|
||||
}
|
||||
class RDDescription {
|
||||
Width: number = 4;
|
||||
Lines: RDDescriptionLine[] = [];
|
||||
}
|
||||
class RDDescriptionLine {
|
||||
BoxCount: number = 1;
|
||||
IconCount: number = 0;
|
||||
Items: (RDDescriptionText | RDDescriptionBox | RDDescriptionIcon)[] = [];
|
||||
}
|
||||
class RDDescriptionText {
|
||||
Middle?: boolean;
|
||||
Hoverable?: boolean;
|
||||
FGray?: boolean;
|
||||
Highlight?: boolean;
|
||||
Text: string = "";
|
||||
}
|
||||
class RDDescriptionBox {
|
||||
Items: (RDDescriptionBoxButton | RDDescriptionBoxInput | RDDescriptionBoxScroll | RDDescriptionBoxSelect)[] = [];
|
||||
}
|
||||
class RDDescriptionBoxInput {
|
||||
Tips?: string = "";
|
||||
Middle?: boolean;
|
||||
FGray?: boolean;
|
||||
BlackBack?: boolean;
|
||||
Highlight?: boolean;
|
||||
Text: string = "";
|
||||
}
|
||||
class RDDescriptionBoxScroll {
|
||||
Scroll: number = 0;
|
||||
}
|
||||
class RDDescriptionBoxButton {
|
||||
Middle?: boolean;
|
||||
Active?: boolean;
|
||||
GrayBack?: boolean;
|
||||
Highlight?: boolean;
|
||||
Text: string = "";
|
||||
}
|
||||
class RDDescriptionBoxSelect {
|
||||
Items: string[] = [];
|
||||
SelectedIndex: number = 0;
|
||||
}
|
||||
class RDDescriptionIcon {
|
||||
}
|
||||
class RDStyle {
|
||||
Beat: number = 0;
|
||||
@@ -42,6 +224,24 @@ class RDStyle {
|
||||
Grayscale?: number;
|
||||
Opacity?: number;
|
||||
}
|
||||
class RDBeatStyle {
|
||||
Tick?: number;
|
||||
OneshotBeatSubType: RDOneshotBeatSubType[] = [];
|
||||
Interval?: number;
|
||||
Delay?: number;
|
||||
Subdivision?: number;
|
||||
Swing?: number;
|
||||
Hold?: number;
|
||||
Pulse?: number;
|
||||
RowXs: string = '------';
|
||||
Loop?: number;
|
||||
}
|
||||
enum RDOneshotBeatSubType {
|
||||
Freezeshot,
|
||||
Burnshot,
|
||||
Skipshot,
|
||||
Subdivision,
|
||||
}
|
||||
class RDGroup {
|
||||
Width: number = 1;
|
||||
Height: number = 1;
|
||||
@@ -51,72 +251,97 @@ class RDGroup {
|
||||
ClickOutline?: Color;
|
||||
Children: (RDEvent | RDGroup)[] = [];
|
||||
}
|
||||
function RDViewRender(lang: string, code: string): HTMLElement {
|
||||
const view: RDViewWindow = new RDViewWindow();
|
||||
function RDViewRender(lang: string, code: string): string {
|
||||
const lines: string[] = code.split('\n');
|
||||
const window: RDViewWindow = new RDViewWindow();
|
||||
var objs: (RDEvent | RDGroup)[] = [];
|
||||
try {
|
||||
objs = ReadObjs(code);
|
||||
window.Objects = ReadObjs(code);
|
||||
} catch (error) {
|
||||
return ErrorElement(`${error}`);
|
||||
return errorHtml(`${error}`);
|
||||
}
|
||||
const args = lang.split(/\s+/g);
|
||||
if (1 < args.length && args.length <= 4) {
|
||||
if (args[1]) {
|
||||
view.Column = parseInt(args[1]);
|
||||
window.Column = parseInt(args[1]);
|
||||
}
|
||||
if (args[2]) {
|
||||
view.Row = parseInt(args[2]);
|
||||
window.Row = parseInt(args[2]);
|
||||
}
|
||||
if (args[3]) {
|
||||
view.Scale = parseFloat(args[3]);
|
||||
window.Scale = parseFloat(args[3]);
|
||||
}
|
||||
}
|
||||
return ConstructObjs(view, objs);
|
||||
}
|
||||
function ErrorElement(message: string = ""): HTMLElement {
|
||||
const el = document.createElement("div");
|
||||
el.className = "rdtk-error";
|
||||
el.textContent = message;
|
||||
return el;
|
||||
}
|
||||
function PrefixToTab(prefix: string): string | undefined {
|
||||
switch (prefix) {
|
||||
case "es": return "Sounds";
|
||||
case "eb": return "Rows";
|
||||
case "ea": return "Actions";
|
||||
case "ed": return "Sprites";
|
||||
case "er": return "Rooms";
|
||||
case "ec": return "Unknown";
|
||||
default: return undefined;
|
||||
return ConstructObjs(window);
|
||||
}
|
||||
function errorHtml(message: string = ""): string {
|
||||
return `<div class="RDView" style="--row:1;--column:0;"><div class="event actions" style="--beat:0;--y:0"><div class="description" style="--width:12;">${message.length ? `${message}` : ""}</div></div></div>`;
|
||||
}
|
||||
function ReadObjs(line: string): (RDEvent | RDGroup)[] {
|
||||
const objs: (RDEvent | RDGroup)[] = [];
|
||||
var reader = new Reader(line);
|
||||
while (!reader.IsEnd()) {
|
||||
var event: (RDEvent | RDGroup);
|
||||
var name: string = "";
|
||||
var prefix: string = "";
|
||||
try {
|
||||
name = reader.ReadSymbol();
|
||||
if (reader.TestRead('.', false)) {
|
||||
prefix = name;
|
||||
name = reader.ReadSymbol();
|
||||
}
|
||||
const type = reader.ReadSymbol().toLowerCase();
|
||||
event = ReadType(type);
|
||||
}
|
||||
catch (e) {
|
||||
name = "";
|
||||
}
|
||||
if (name.toLowerCase() === 'g') {
|
||||
event = new RDGroup();
|
||||
}
|
||||
else {
|
||||
const ev = new RDEvent();
|
||||
ev.Name = name;
|
||||
ev.PrefixTab = PrefixToTab(prefix);
|
||||
event = ev;
|
||||
event = new RDEvent();
|
||||
}
|
||||
if (event instanceof RDEvent) {
|
||||
reader.TestRead('.', true);
|
||||
const name = reader.ReadSymbol();
|
||||
var collection;
|
||||
switch (event.SubType) {
|
||||
case EventType.sounds:
|
||||
collection = tilePosition.events.sounds;
|
||||
break;
|
||||
case EventType.rows:
|
||||
collection = tilePosition.events.rows;
|
||||
switch (name) {
|
||||
case 'AddClassicBeat':
|
||||
event.BeatType = BeatsSpecial.AddClassicBeat;
|
||||
break;
|
||||
case 'AddFreeTimeBeat':
|
||||
event.BeatType = BeatsSpecial.AddFreeTimeBeat;
|
||||
break;
|
||||
case 'PulseFreeTimeBeat':
|
||||
event.BeatType = BeatsSpecial.PulseFreeTimeBeat;
|
||||
break;
|
||||
case 'AddOneshotBeat':
|
||||
event.BeatType = BeatsSpecial.AddOneshotBeat;
|
||||
break;
|
||||
case 'SetRowXs':
|
||||
event.BeatType = BeatsSpecial.SetRowXs;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EventType.actions:
|
||||
collection = tilePosition.events.actions;
|
||||
break;
|
||||
case EventType.decorations:
|
||||
collection = tilePosition.events.decorations;
|
||||
break;
|
||||
case EventType.rooms:
|
||||
collection = tilePosition.events.rooms;
|
||||
break;
|
||||
case EventType.custom:
|
||||
collection = tilePosition.events.custom;
|
||||
break;
|
||||
default:
|
||||
collection = tilePosition.events.custom;
|
||||
break;
|
||||
}
|
||||
const pos = collection.filter(i => i.name.toLowerCase() === name.toLowerCase())[0];
|
||||
if (pos) {
|
||||
event.EventX = pos.position[0];
|
||||
event.EventY = pos.position[1];
|
||||
event.Width = pos.position[2];
|
||||
event.Height = pos.position[3];
|
||||
}
|
||||
try { event.Style.Beat = reader.ReadFloat(); } catch (e) { }
|
||||
try { event.Style.Y = reader.ReadInt(); } catch (e) { }
|
||||
if (reader.TestPeek('[')) {
|
||||
@@ -366,7 +591,7 @@ class Reader {
|
||||
line += this.line;
|
||||
position = this.position;
|
||||
}
|
||||
return `<br>at "${s[line]}".`;
|
||||
return `<br>at "${s[line]}".`;//, at ${line + 1}:${position - curp}`;
|
||||
}
|
||||
}
|
||||
function FindValue(pairs: KeyValuePair[], key: string): KeyValuePair | undefined {
|
||||
@@ -376,13 +601,79 @@ function FindValue(pairs: KeyValuePair[], key: string): KeyValuePair | undefined
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function ReadType(typename: string): (RDEvent | RDGroup) {
|
||||
var t: EventType = EventType.custom;
|
||||
var event: RDEvent | RDGroup;
|
||||
switch (typename[0]) {
|
||||
case 'e':
|
||||
event = new RDEvent();
|
||||
switch (typename[1]) {
|
||||
case 's':
|
||||
t = EventType.sounds;
|
||||
break;
|
||||
case 'b':
|
||||
t = EventType.rows;
|
||||
break;
|
||||
case 'a':
|
||||
t = EventType.actions;
|
||||
break;
|
||||
case 'd':
|
||||
t = EventType.decorations;
|
||||
break;
|
||||
case 'r':
|
||||
t = EventType.rooms;
|
||||
break;
|
||||
case 'c':
|
||||
t = EventType.custom;
|
||||
break;
|
||||
default:
|
||||
t = EventType.custom;
|
||||
}
|
||||
event.SubType = t;
|
||||
break;
|
||||
case 'g':
|
||||
event = new RDGroup();
|
||||
break;
|
||||
default:
|
||||
event = new RDEvent();
|
||||
}
|
||||
return event;
|
||||
}
|
||||
function ReadProperties(reader: Reader, event: RDEvent | RDGroup, pairs: KeyValuePair[]) {
|
||||
|
||||
if (event instanceof RDGroup) {
|
||||
var value: KeyValuePair | undefined;
|
||||
if (value = FindValue(pairs, "hue")) { event.Style.Hue = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "brightness")) { event.Style.Brightness = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "grayscale")) { event.Style.Grayscale = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "opacity")) { event.Style.Opacity = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "hue")) {
|
||||
try {
|
||||
event.Style.Hue = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "brightness")) {
|
||||
try {
|
||||
event.Style.Brightness = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "grayscale")) {
|
||||
try {
|
||||
event.Style.Grayscale = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "opacity")) {
|
||||
try {
|
||||
event.Style.Opacity = parseFloat(value.Value);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Expecting a number, but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "offset")) {
|
||||
reader = new Reader(value.Value);
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
@@ -390,270 +681,302 @@ function ReadProperties(reader: Reader, event: RDEvent | RDGroup, pairs: KeyValu
|
||||
try { event.ClickStyle.Y = reader.ReadInt(); } catch (e) { }
|
||||
try { event.ClickOutline = reader.ReadColor(); } catch (e) { }
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_hue")) { event.ClickStyle ??= new RDStyle(); event.ClickStyle.Hue = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "offset_brightness")) { event.ClickStyle ??= new RDStyle(); event.ClickStyle.Brightness = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "offset_grayscale")) { event.ClickStyle ??= new RDStyle(); event.ClickStyle.Grayscale = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "offset_opacity")) { event.ClickStyle ??= new RDStyle(); event.ClickStyle.Opacity = parseFloat(value.Value); }
|
||||
if (value = FindValue(pairs, "offset_hue")) {
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Hue = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_brightness")) {
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Brightness = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_grayscale")) {
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Grayscale = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_opacity")) {
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Opacity = parseFloat(value.Value);
|
||||
}
|
||||
}
|
||||
else if (event instanceof RDEvent) {
|
||||
for (const pair of pairs) {
|
||||
const key = pair.Key;
|
||||
const value = pair.Value;
|
||||
switch (key) {
|
||||
case "if":
|
||||
if (["true", "false", "both"].find(i => i === value)) {
|
||||
event.Condition = value === "true" ? EventCondition.true :
|
||||
value === "false" ? EventCondition.false : EventCondition.both;
|
||||
var value: KeyValuePair | undefined;
|
||||
if (value = FindValue(pairs, "if")) {
|
||||
if (["true", "false", "both"].find(i => i === value?.Value)) {
|
||||
event.Condition = value.Value === "true" ? EventCondition.true :
|
||||
value.Value === "false" ? EventCondition.false : EventCondition.both;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Expecting "true", "false" or "both", but find "${value}".`);
|
||||
throw new Error(`Expecting "true", "false" or "both", but find "${value.Value}".`);
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "tag")) {
|
||||
event.Tag = value.Value === "true" ? true : false;
|
||||
}
|
||||
if (value = FindValue(pairs, "hue")) {
|
||||
event.Style.Hue = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "brightness")) {
|
||||
event.Style.Brightness = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "grayscale")) {
|
||||
event.Style.Grayscale = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "opacity")) {
|
||||
event.Style.Opacity = parseFloat(value.Value);
|
||||
}
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
if (value = FindValue(pairs, "offset")) {
|
||||
reader = new Reader(value.Value);
|
||||
try { event.ClickStyle.Beat = reader.ReadFloat(); } catch (e) { }
|
||||
try { event.ClickStyle.Y = reader.ReadInt(); } catch (e) { }
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_hue")) {
|
||||
event.ClickStyle.Hue = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_brightness")) {
|
||||
event.ClickStyle.Brightness = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_grayscale")) {
|
||||
event.ClickStyle.Grayscale = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "offset_opacity")) {
|
||||
event.ClickStyle.Opacity = parseFloat(value.Value);
|
||||
}
|
||||
if (event.BeatType !== undefined) {
|
||||
event.BeatStyle = new RDBeatStyle();
|
||||
if (value = FindValue(pairs, "tick")) {
|
||||
event.BeatStyle.Tick = parseFloat(value.Value);
|
||||
}
|
||||
switch (event.BeatType) {
|
||||
case BeatsSpecial.AddClassicBeat:
|
||||
if (value = FindValue(pairs, "swing")) {
|
||||
event.BeatStyle.Swing = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
case "tag":
|
||||
event.Tag = value === "true";
|
||||
case BeatsSpecial.AddFreeTimeBeat:
|
||||
if (value = FindValue(pairs, "pulse")) {
|
||||
event.BeatStyle.Pulse = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
case "hue":
|
||||
event.Style.Hue = parseFloat(value);
|
||||
case BeatsSpecial.PulseFreeTimeBeat:
|
||||
if (value = FindValue(pairs, "pulse")) {
|
||||
event.BeatStyle.Pulse = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
case "brightness":
|
||||
event.Style.Brightness = parseFloat(value);
|
||||
case BeatsSpecial.SetRowXs:
|
||||
if ((value = FindValue(pairs, "rowxs"))) {
|
||||
if (value.Value.match(/^[-x]{6}$/)) {
|
||||
event.BeatStyle.RowXs = value.Value;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Expect a string of length 6, consisting of "x" and "-", instead of "${value?.Value}".`);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "grayscale":
|
||||
event.Style.Grayscale = parseFloat(value);
|
||||
case BeatsSpecial.AddOneshotBeat:
|
||||
if (value = FindValue(pairs, "type")) {
|
||||
const types: string[] = value.Value.split(/\s+/);
|
||||
var illegal: string[] | undefined;
|
||||
if ((illegal = types.filter(i => {
|
||||
![
|
||||
"freezeshot",
|
||||
"burnshot",
|
||||
"skipshot",
|
||||
"subdivision"
|
||||
].includes(i);
|
||||
})).length) {
|
||||
throw new Error(`Expecting "freezeshot", "burnshot", "skipshot" or "subdivision", but find ${illegal.map(i => `"${i}"`).join(', ')}.`);
|
||||
}
|
||||
else {
|
||||
types.map(i => {
|
||||
switch (i) {
|
||||
case "freezeshot":
|
||||
event.BeatStyle?.OneshotBeatSubType.push(RDOneshotBeatSubType.Freezeshot);
|
||||
break;
|
||||
case "opacity":
|
||||
event.Style.Opacity = parseFloat(value);
|
||||
case "burnshot":
|
||||
event.BeatStyle?.OneshotBeatSubType.push(RDOneshotBeatSubType.Burnshot);
|
||||
break;
|
||||
case "offset": {
|
||||
const offsetReader = new Reader(value);
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
try { event.ClickStyle.Beat = offsetReader.ReadFloat(); } catch (e) { }
|
||||
try { event.ClickStyle.Y = offsetReader.ReadInt(); } catch (e) { }
|
||||
case "skipshot":
|
||||
event.BeatStyle?.OneshotBeatSubType.push(RDOneshotBeatSubType.Skipshot);
|
||||
break;
|
||||
case "subdivision":
|
||||
event.BeatStyle?.OneshotBeatSubType.push(RDOneshotBeatSubType.Subdivision);
|
||||
break;
|
||||
}
|
||||
case "offset_hue":
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Hue = parseFloat(value);
|
||||
break;
|
||||
case "offset_brightness":
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Brightness = parseFloat(value);
|
||||
break;
|
||||
case "offset_grayscale":
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Grayscale = parseFloat(value);
|
||||
break;
|
||||
case "offset_opacity":
|
||||
event.ClickStyle ??= new RDStyle();
|
||||
event.ClickStyle.Opacity = parseFloat(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (value = FindValue(pairs, "interval")){
|
||||
event.BeatStyle.Interval = parseFloat(value.Value);
|
||||
}
|
||||
if ((value = FindValue(pairs, "delay"))
|
||||
&& event.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Freezeshot)) {
|
||||
event.BeatStyle.Delay = parseFloat(value.Value);
|
||||
}
|
||||
if ((value = FindValue(pairs, "subdivision"))
|
||||
&& event.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Subdivision)) {
|
||||
event.BeatStyle.Subdivision = parseFloat(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "loop")) {
|
||||
event.BeatStyle.Loop = parseInt(value.Value);
|
||||
}
|
||||
if (value = FindValue(pairs, "hold")) {
|
||||
event.BeatStyle.Hold = parseFloat(value.Value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
event.Properties.push(pair);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const CELL_SIZE = 28;
|
||||
const RDTK_SCALE = 2;
|
||||
|
||||
const NUMERIC_KEYS = new Set<string>([
|
||||
"tick", "swing", "hold", "pulse", "customPulse", "interval", "delay", "loop",
|
||||
"subdivision", "crotchetsPerBar", "syncoBeat", "duration", "angle", "bpm",
|
||||
"beatsPerMinute", "volume", "speed", "startOpacity", "endOpacity", "subdivOffset",
|
||||
]);
|
||||
|
||||
const SAY_PHRASES = new Set<string>([
|
||||
"SayReaDyGetSetGoNew", "SayReaDyGetSetOne", "SayGetSetGo", "SayGetSetOne",
|
||||
"JustSayRea", "JustSayDy", "JustSayGet", "JustSaySet", "JustSayAnd",
|
||||
"JustSayGo", "JustSayStop", "JustSayAndStop", "SaySwitch", "SayWatch",
|
||||
"SayListen", "Count1", "Count2", "Count3", "Count4", "Count5", "Count6",
|
||||
"Count7", "Count8", "Count9", "Count10", "SayReadyGetSetGo", "JustSayReady",
|
||||
]);
|
||||
|
||||
function CoerceValue(key: string, value: string): any {
|
||||
if (value === "true") { return true; }
|
||||
if (value === "false") { return false; }
|
||||
if (NUMERIC_KEYS.has(key) && /^[+-]?(\d+(\.\d+)?|\.\d+)$/.test(value)) {
|
||||
return Number(value);
|
||||
function ConstructObjs(window: RDViewWindow) {
|
||||
var html: string = `<div class="RDViewContent" style="--column:${window.Column};--row:${window.Row};--scale:${window.Scale};">`
|
||||
+`<div class="RDView" style="--column:${window.Column};--row:${window.Row};--scale:${window.Scale};">`;
|
||||
for (var obj of window.Objects) {
|
||||
html += ConstructDivObject(obj);
|
||||
}
|
||||
return value;
|
||||
html += `</div></div>`;
|
||||
return html;
|
||||
}
|
||||
|
||||
function ToRDtkObject(ev: RDEvent): any {
|
||||
const obj: any = { type: ev.Name };
|
||||
let tab: string | undefined = undefined;
|
||||
for (const pair of ev.Properties) {
|
||||
let key = pair.Key;
|
||||
const value = pair.Value;
|
||||
if (key === "tab") { tab = value; continue; }
|
||||
if (key === "tag") { continue; }
|
||||
if (ev.Name === "AddOneshotBeat" && key === "type") {
|
||||
const types = value.split(/\s+/).filter(i => i.length > 0);
|
||||
for (const t of types) {
|
||||
switch (t) {
|
||||
case "freezeshot": obj.freezeBurnMode = "Freezeshot"; break;
|
||||
case "burnshot": obj.freezeBurnMode = "Burnshot"; break;
|
||||
case "skipshot": obj.skipshot = true; break;
|
||||
function ConstructDivObject(obj: RDEvent | RDGroup): string {
|
||||
if (obj instanceof RDEvent) {
|
||||
return `<div class="event ${obj.BeatType === undefined ? `${obj.SubType}` : 'beat'}"style="${ConstructCssPropertiesIfExists(
|
||||
new Map<string, any>([
|
||||
['beat', obj.Style.Beat],
|
||||
['y', obj.Style.Y],
|
||||
['event-x', obj.EventX],
|
||||
['event-y', obj.EventY],
|
||||
['event-width', obj.Width],
|
||||
['event-height', obj.Height],
|
||||
['hue', obj.Style.Hue],
|
||||
['brightness', obj.Style.Brightness],
|
||||
['grayscale', obj.Style.Grayscale],
|
||||
['opacity', obj.Style.Opacity],
|
||||
['offset-beat', obj.ClickStyle?.Beat],
|
||||
['offset-y', obj.ClickStyle?.Y],
|
||||
['offset-hue', obj.ClickStyle?.Hue],
|
||||
['offset-brightness', obj.ClickStyle?.Brightness],
|
||||
['offset-grayscale', obj.ClickStyle?.Grayscale],
|
||||
['offset-opacity', obj.ClickStyle?.Opacity],
|
||||
['tick', obj.BeatStyle?.Tick],
|
||||
['delay', obj.BeatStyle?.Delay],
|
||||
['interval', obj.BeatStyle?.Interval],
|
||||
['subdivision', obj.BeatStyle?.Subdivision],
|
||||
['hold', obj.BeatStyle?.Hold],
|
||||
['pulse', obj.BeatStyle?.Pulse],
|
||||
['swing', obj.BeatStyle?.Swing],
|
||||
['loop', obj.BeatStyle?.Loop],
|
||||
]))
|
||||
}">${ConstructSubDiv(
|
||||
[obj.Condition !== undefined, `condition-${obj.Condition}`, () => ''],
|
||||
[obj.Tag === true, `tag`, () => ''],
|
||||
[obj.BeatType === BeatsSpecial.AddClassicBeat, `classicbeat`, () => {
|
||||
var result: string = '';
|
||||
for (var i = 0; i < 6; i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
return result;
|
||||
}],
|
||||
[obj.BeatType === BeatsSpecial.AddFreeTimeBeat, `add freetime`, () => {return '';}],
|
||||
[obj.BeatType === BeatsSpecial.PulseFreeTimeBeat, `pulse freetime`, () => ''],
|
||||
[obj.BeatStyle?.Loop !== undefined && obj.BeatStyle.Loop > 0, `loop`, () => {
|
||||
var result: string = '';
|
||||
for (var i = 0; i < (obj.BeatStyle?.Loop ?? 0); i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
continue;
|
||||
return result;
|
||||
}],
|
||||
[obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Freezeshot), `freezeshots`, () => {
|
||||
var result: string = '';
|
||||
for (var i = 0; i < (obj.BeatStyle?.Loop ?? 0) + 1; i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
if (ev.Name === "AddOneshotBeat" && key === "hold") {
|
||||
obj.hold = !(value === "false" || value === "0" || value === "0.0");
|
||||
continue;
|
||||
return result;
|
||||
}],
|
||||
[obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Burnshot), `burnshots`, () => {
|
||||
var result: string = '';
|
||||
for (var i = 0; i < (obj.BeatStyle?.Loop ?? 0) + 1; i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
if (key === "rowxs") { key = "pattern"; }
|
||||
else if (ev.Name === "AddOneshotBeat" && key === "loop") { key = "loops"; }
|
||||
else if (ev.Name === "AddOneshotBeat" && key === "subdivision") { key = "subdivisions"; }
|
||||
if (ev.Name === "SayReadyGetSetGo" && key === "phraseToSay") {
|
||||
if (SAY_PHRASES.has(value)) { obj.phraseToSay = value; }
|
||||
continue;
|
||||
return result;
|
||||
}],
|
||||
[obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Subdivision), `subdivisions`, () => {
|
||||
var result: string = '';
|
||||
for(var l = 0; l < (obj.BeatStyle?.Loop ?? 0) + 1; l++){
|
||||
result += `<div class="subdivision">`;
|
||||
for (var i = 0; i < (obj.BeatStyle?.Subdivision ?? 1); i++) {
|
||||
result += `<div></div>`;
|
||||
}
|
||||
obj[key] = CoerceValue(key, value);
|
||||
result += `</div>`;
|
||||
}
|
||||
if (tab !== undefined) {
|
||||
obj.tab = tab;
|
||||
return result;
|
||||
}],
|
||||
[obj.BeatType === BeatsSpecial.SetRowXs, `row-xs`, () => {
|
||||
var result: string = '';
|
||||
for (var i = 0; i < 6; i++) {
|
||||
result += (obj.BeatStyle?.RowXs[i] === 'x') ? `<div class="x"></div>` : `<div></div>`;
|
||||
}
|
||||
else if (ev.PrefixTab !== undefined) {
|
||||
obj.tab = ev.PrefixTab;
|
||||
return result;
|
||||
}],
|
||||
[(obj.BeatType === BeatsSpecial.AddClassicBeat || obj.BeatType === BeatsSpecial.AddFreeTimeBeat || obj.BeatType === BeatsSpecial.PulseFreeTimeBeat || obj.BeatType === BeatsSpecial.AddOneshotBeat) && (obj.BeatStyle?.Hold ?? 0) > 0, `holdbeat`, () => ''],
|
||||
[obj.BeatType === BeatsSpecial.AddOneshotBeat && obj.BeatStyle !== undefined && obj.BeatStyle.OneshotBeatSubType.includes(RDOneshotBeatSubType.Skipshot), `skipshot`, () => ''],
|
||||
)}</div>`;
|
||||
}
|
||||
if (ev.Tag === true) {
|
||||
obj.tag = true;
|
||||
else if (obj instanceof RDGroup) {
|
||||
return `<div class="event group"style="${ConstructCssPropertiesIfExists(
|
||||
new Map<string, any>([
|
||||
['group-beat', obj.Style.Beat],
|
||||
['group-y', obj.Style.Y],
|
||||
['group-width', obj.Width],
|
||||
['group-height', obj.Height],
|
||||
['group-hue', obj.Style.Hue],
|
||||
['group-brightness', obj.Style.Brightness],
|
||||
['group-grayscale', obj.Style.Grayscale],
|
||||
['group-opacity', obj.Style.Opacity],
|
||||
['group-outline', ToHex(obj.Outline)],
|
||||
['group-offset-beat', obj.ClickStyle.Beat],
|
||||
['group-offset-y', obj.ClickStyle.Y],
|
||||
['group-offset-hue', obj.ClickStyle.Hue],
|
||||
['group-offset-brightness', obj.ClickStyle.Brightness],
|
||||
['group-offset-grayscale', obj.ClickStyle.Grayscale],
|
||||
['group-offset-opacity', obj.ClickStyle.Opacity],
|
||||
['group-offset-outline', ToHex(obj.ClickOutline??obj.Outline)],
|
||||
])
|
||||
)}">${obj.Children.map(i => ConstructDivObject(i)).join('')}</div>`;
|
||||
}
|
||||
return obj;
|
||||
else { return ''; }
|
||||
}
|
||||
|
||||
interface RDtkNode extends HTMLElement {
|
||||
__setRDtkState?: (hover: boolean, active: boolean) => void;
|
||||
function ConstructCssPropertiesIfExists(pairs: Map<string, any>): string {
|
||||
var result: string = '';
|
||||
for (const [key, value] of pairs) {
|
||||
result += value !== undefined ? `--${key}:${value};` : ``;
|
||||
}
|
||||
|
||||
function ConstructObjs(view: RDViewWindow, objs: (RDEvent | RDGroup)[]): HTMLElement {
|
||||
const content = document.createElement("div");
|
||||
content.className = "RDViewContent";
|
||||
content.style.setProperty("--column", `${view.Column}`);
|
||||
content.style.setProperty("--row", `${view.Row}`);
|
||||
content.style.setProperty("--scale", `${view.Scale}`);
|
||||
const canvas = document.createElement("div");
|
||||
canvas.className = "RDView rdtk-rdview";
|
||||
canvas.style.setProperty("--column", `${view.Column}`);
|
||||
canvas.style.setProperty("--row", `${view.Row}`);
|
||||
canvas.style.setProperty("--scale", `${view.Scale}`);
|
||||
for (const obj of objs) {
|
||||
const node = BuildObject(obj);
|
||||
if (node) { canvas.appendChild(node); }
|
||||
return result;
|
||||
}
|
||||
content.appendChild(canvas);
|
||||
return content;
|
||||
function ConstructCssProperties(pairs: Map<string, any>): string {
|
||||
var result: string = '';
|
||||
for (const [key, value] of pairs) {
|
||||
result += `--${key}:${value};`;
|
||||
}
|
||||
|
||||
function BuildObject(obj: RDEvent | RDGroup): HTMLElement {
|
||||
return obj instanceof RDGroup ? BuildGroup(obj) : BuildEvent(obj);
|
||||
return result;
|
||||
}
|
||||
|
||||
function BuildEvent(ev: RDEvent): HTMLElement {
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "rdtk-event";
|
||||
wrapper.style.left = `${ev.Style.Beat * CELL_SIZE}px`;
|
||||
wrapper.style.top = `${ev.Style.Y * CELL_SIZE}px`;
|
||||
|
||||
const state: IconStyle = { enabled: true, active: false, hover: false, scale: RDTK_SCALE, showDuration: false };
|
||||
const rdobj = ToRDtkObject(ev);
|
||||
const inner = rdobj ? createElementEvent(rdobj, state) : null;
|
||||
if (inner) {
|
||||
inner.style.position = "absolute";
|
||||
inner.style.left = "0px";
|
||||
inner.style.top = "0px";
|
||||
wrapper.appendChild(inner);
|
||||
function ConstructSubDiv(...pairs: [shouldDo: boolean, name: string, func: () => string][]) {
|
||||
var result: string = '';
|
||||
for (const [key, name, func] of pairs) {
|
||||
result += key ? `<div class="${name}">${func()}</div>` : ``;
|
||||
}
|
||||
else {
|
||||
wrapper.classList.add("rdtk-unknown");
|
||||
wrapper.textContent = ev.Name || "unknown";
|
||||
return result;
|
||||
}
|
||||
|
||||
ApplyFilter(wrapper, ev.Style);
|
||||
if (ev.Condition !== undefined) {
|
||||
const condition = document.createElement("div");
|
||||
condition.className = `rdtk-condition condition-${ev.Condition}`;
|
||||
wrapper.appendChild(condition);
|
||||
}
|
||||
|
||||
const offsetBeat = ev.ClickStyle?.Beat ?? 0;
|
||||
const offsetY = ev.ClickStyle?.Y ?? 0;
|
||||
const hasOffset = offsetBeat !== 0 || offsetY !== 0;
|
||||
|
||||
function setState(hover: boolean, active: boolean): void {
|
||||
state.hover = hover;
|
||||
state.active = active;
|
||||
inner?.onStateChange(state);
|
||||
wrapper.classList.toggle("hover", hover);
|
||||
wrapper.classList.toggle("active", active);
|
||||
wrapper.style.transform = (active && hasOffset)
|
||||
? `translate(${offsetBeat * CELL_SIZE}px, ${offsetY * CELL_SIZE}px)`
|
||||
: "";
|
||||
ApplyFilter(wrapper, active && ev.ClickStyle ? ev.ClickStyle : ev.Style);
|
||||
}
|
||||
wrapper.addEventListener("mouseover", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget as Node | null)) { setState(true, state.active); }
|
||||
});
|
||||
wrapper.addEventListener("mouseout", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget as Node | null)) { setState(false, false); }
|
||||
});
|
||||
wrapper.addEventListener("mousedown", () => setState(true, true));
|
||||
wrapper.addEventListener("mouseup", () => setState(state.hover, false));
|
||||
(wrapper as RDtkNode).__setRDtkState = setState;
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function BuildGroup(grp: RDGroup): HTMLElement {
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "rdtk-group";
|
||||
wrapper.style.left = `${grp.Style.Beat * CELL_SIZE}px`;
|
||||
wrapper.style.top = `${grp.Style.Y * CELL_SIZE}px`;
|
||||
wrapper.style.width = `${grp.Width * CELL_SIZE}px`;
|
||||
wrapper.style.height = `${grp.Height * CELL_SIZE}px`;
|
||||
wrapper.style.outlineColor = ToHex(grp.Outline);
|
||||
ApplyFilter(wrapper, grp.Style);
|
||||
|
||||
for (const child of grp.Children) {
|
||||
const node = BuildObject(child);
|
||||
if (node) { wrapper.appendChild(node); }
|
||||
}
|
||||
|
||||
const offsetBeat = grp.ClickStyle?.Beat ?? 0;
|
||||
const offsetY = grp.ClickStyle?.Y ?? 0;
|
||||
const hasOffset = offsetBeat !== 0 || offsetY !== 0;
|
||||
|
||||
function setState(hover: boolean, active: boolean): void {
|
||||
wrapper.classList.toggle("hover", hover);
|
||||
wrapper.classList.toggle("active", active);
|
||||
wrapper.style.transform = (active && hasOffset)
|
||||
? `translate(${offsetBeat * CELL_SIZE}px, ${offsetY * CELL_SIZE}px)`
|
||||
: "";
|
||||
wrapper.style.outlineColor = active ? ToHex(grp.ClickOutline ?? grp.Outline) : ToHex(grp.Outline);
|
||||
ApplyFilter(wrapper, active && grp.ClickStyle ? grp.ClickStyle : grp.Style);
|
||||
}
|
||||
wrapper.addEventListener("mouseover", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget as Node | null)) { setState(true, false); }
|
||||
});
|
||||
wrapper.addEventListener("mouseout", (e) => {
|
||||
if (!wrapper.contains(e.relatedTarget as Node | null)) { setState(false, false); }
|
||||
});
|
||||
wrapper.addEventListener("mousedown", () => setState(true, true));
|
||||
wrapper.addEventListener("mouseup", () => setState(true, false));
|
||||
(wrapper as RDtkNode).__setRDtkState = setState;
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function ApplyFilter(el: HTMLElement, style: RDStyle): void {
|
||||
const parts: string[] = [];
|
||||
if (style.Hue !== undefined) { parts.push(`hue-rotate(${style.Hue}deg)`); }
|
||||
if (style.Brightness !== undefined) { parts.push(`brightness(${style.Brightness}%)`); }
|
||||
if (style.Grayscale !== undefined) { parts.push(`grayscale(${style.Grayscale}%)`); }
|
||||
if (style.Opacity !== undefined) { parts.push(`opacity(${style.Opacity}%)`); }
|
||||
el.style.filter = parts.join(" ");
|
||||
}
|
||||
|
||||
function ToHex(color: Color) {
|
||||
const hex =
|
||||
parseInt(color.red.toFixed(0)).toString(16).padStart(2, '0') +
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
window.$docsify.plugins = [].concat(window.$docsify.plugins, (hook) => {
|
||||
hook.doneEach(() => {
|
||||
if (typeof window.RDViewRender !== "function") {
|
||||
return;
|
||||
}
|
||||
const codeBlocks = document.querySelectorAll("pre[data-lang]");
|
||||
codeBlocks.forEach((codeBlock) => {
|
||||
const lang = codeBlock.getAttribute("data-lang") || "";
|
||||
if (!lang.trim().startsWith("rdview")) {
|
||||
return;
|
||||
}
|
||||
const codeEl = codeBlock.querySelector("code");
|
||||
const code = codeEl ? codeEl.innerText : codeBlock.innerText;
|
||||
let node;
|
||||
try {
|
||||
node = window.RDViewRender(lang, code);
|
||||
} catch (e) {
|
||||
console.error("rdview render failed:", lang, e);
|
||||
return;
|
||||
}
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
const parent = document.createElement("div");
|
||||
parent.className = "rdtk-rdview-wrap";
|
||||
parent.appendChild(node);
|
||||
codeBlock.replaceWith(parent);
|
||||
});
|
||||
});
|
||||
});
|
||||
+8
-5
@@ -228,7 +228,7 @@ function rdview() {
|
||||
function initCanvas() {
|
||||
const lang = textarea.value.split("\n")[0];
|
||||
const code = textarea.value.split("\n").slice(1).join("\n");
|
||||
rdcanvas.replaceChildren(RDViewRender(lang, code));
|
||||
rdcanvas.innerHTML = RDViewRender(lang, code);
|
||||
}
|
||||
initCanvas();
|
||||
initLineNumbers();
|
||||
@@ -322,11 +322,10 @@ function rdview2() {
|
||||
}
|
||||
const eventStyle = { "scale": 2.0, "showDuration": false };
|
||||
let maxy = 0;
|
||||
const elems = [];
|
||||
const elemPromises = [];
|
||||
for (let obj of objs) {
|
||||
const style = { ...eventStyle, enabled: obj.active ?? true };
|
||||
const elem = createElementEvent(obj, style);
|
||||
if (!elem) continue;
|
||||
const elem = createElementEvent(obj, style).then((elem) => {
|
||||
elem.eventStyle = style;
|
||||
elem.style.position = "absolute";
|
||||
elem.style.left = `${
|
||||
@@ -364,11 +363,15 @@ function rdview2() {
|
||||
eStyle.active = false;
|
||||
elem.onStateChange(eStyle);
|
||||
});
|
||||
elems.push(elem);
|
||||
return elem;
|
||||
});
|
||||
elemPromises.push(elem);
|
||||
}
|
||||
Promise.all(elemPromises).then((elems) => {
|
||||
elems.forEach((elem) => {
|
||||
rdcanvas.appendChild(elem);
|
||||
});
|
||||
});
|
||||
rdcanvas.style.position = "relative";
|
||||
rdcanvas.style.height = `${maxy + 4 * 14 * eventStyle.scale}px`;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
"target": "es2015",
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom",
|
||||
"dom.iterable"
|
||||
"dom"
|
||||
],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "es6",
|
||||
"moduleResolution": "node",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
@@ -15,7 +14,6 @@
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"files": [
|
||||
"rdview.ts",
|
||||
"custommethod-search.ts"
|
||||
"rdview.ts"
|
||||
],
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
.rdtk-rdview-wrap {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rdtk-rdview {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.rdtk-event {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
z-index: 0;
|
||||
transition: transform 0.3s, filter 0.3s;
|
||||
}
|
||||
|
||||
.rdtk-event.hover {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.rdtk-group {
|
||||
position: absolute;
|
||||
outline-style: solid;
|
||||
outline-width: 2px;
|
||||
transition: transform 0.3s, filter 0.3s, outline-color 0.3s;
|
||||
}
|
||||
|
||||
.rdtk-group.hover {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.rdtk-condition {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
pointer-events: none;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.rdtk-condition.condition-true {
|
||||
background-image: url(./assets/condition-true.png);
|
||||
}
|
||||
|
||||
.rdtk-condition.condition-false {
|
||||
background-image: url(./assets/condition-false.png);
|
||||
}
|
||||
|
||||
.rdtk-condition.condition-both {
|
||||
background-image: url(./assets/condition-both.png);
|
||||
}
|
||||
|
||||
.rdtk-unknown {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.rdtk-error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
@@ -267,314 +267,3 @@ div.decoration-depth {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div.custommethods-search {
|
||||
position: relative;
|
||||
margin: 16px 0;
|
||||
|
||||
& .cm-search {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
& .cm-query {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
font-family: d9c, d9, monospace;
|
||||
font-size: 15px;
|
||||
color: inherit;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 6px;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #3b8e59;
|
||||
}
|
||||
}
|
||||
|
||||
& .cm-suggest {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: calc(100% + 4px);
|
||||
z-index: 30;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
list-style: none;
|
||||
max-height: 260px;
|
||||
overflow-y: auto;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
& .cm-suggest-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
padding: 6px 8px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(127, 127, 127, 0.16);
|
||||
}
|
||||
}
|
||||
|
||||
& .cm-suggest-name {
|
||||
font-family: d9c, d9, monospace;
|
||||
}
|
||||
|
||||
& .cm-suggest-desc {
|
||||
font-size: 12px;
|
||||
opacity: 0.6;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
& .cm-selected {
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 6px;
|
||||
background-color: rgba(127, 127, 127, 0.06);
|
||||
}
|
||||
|
||||
& .cm-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding-right: 56px;
|
||||
}
|
||||
|
||||
& .cm-name {
|
||||
font-family: d9c, d9, monospace;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
& .cm-desc {
|
||||
font-size: 12px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
& .cm-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
& .cm-param {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
& .cm-param-name {
|
||||
font-family: d9c, d9, monospace;
|
||||
font-size: 13px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
& .cm-input {
|
||||
padding: 4px 6px;
|
||||
font-size: 14px;
|
||||
color: inherit;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 4px;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #3b8e59;
|
||||
}
|
||||
}
|
||||
|
||||
& select.cm-input {
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
& input.cm-input[type="number"] {
|
||||
width: 96px;
|
||||
}
|
||||
|
||||
& input.cm-input[type="text"] {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
& .cm-preview {
|
||||
display: block;
|
||||
margin-top: 12px;
|
||||
padding: 8px 10px;
|
||||
font-family: d9c, d9, monospace;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
background-color: rgba(127, 127, 127, 0.12);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
& .cm-empty {
|
||||
font-size: 13px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
& .cm-input.cm-invalid,
|
||||
& .cm-combo.cm-invalid .cm-input {
|
||||
border-color: #e5484d;
|
||||
box-shadow: 0 0 0 1px #e5484d;
|
||||
}
|
||||
|
||||
& .cm-combo {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
& .cm-combo-input {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
& .cm-combo-list {
|
||||
position: absolute;
|
||||
top: calc(100% + 2px);
|
||||
left: 0;
|
||||
min-width: 100%;
|
||||
z-index: 40;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
list-style: none;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
|
||||
}
|
||||
|
||||
& .cm-combo-item {
|
||||
padding: 4px 8px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(127, 127, 127, 0.16);
|
||||
}
|
||||
}
|
||||
|
||||
& .cm-copy {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
padding: 2px 10px;
|
||||
font-size: 12px;
|
||||
color: inherit;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #3b8e59;
|
||||
border-color: #3b8e59;
|
||||
}
|
||||
}
|
||||
|
||||
& .cm-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
& .cm-option {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
& .cm-option-select {
|
||||
padding: 2px 4px;
|
||||
font-size: 12px;
|
||||
color: inherit;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
& .cm-short {
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
& .cm-call {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
& .cm-code {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 8px 10px;
|
||||
font-family: d9c, d9, monospace;
|
||||
background-color: rgba(127, 127, 127, 0.12);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
& .cm-lit {
|
||||
font-family: d9c, d9, monospace;
|
||||
opacity: 0.85;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
& .cm-field {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
|
||||
& [hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
& .cm-field.cm-invalid .cm-input {
|
||||
border-color: #e5484d;
|
||||
box-shadow: 0 0 0 1px #e5484d;
|
||||
}
|
||||
|
||||
& .cm-check {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
& .cm-desc {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
opacity: 0.75;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
& .cm-mode {
|
||||
padding: 1px 6px;
|
||||
font-size: 11px;
|
||||
color: inherit;
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--background-border-color);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
|
||||
&.is-expression {
|
||||
color: #3b8e59;
|
||||
border-color: #3b8e59;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user