JS脚本:原琴·五线谱版【更新】、提瓦特自动钓鱼【修复】 (#448)
* 添加了制谱器 * 修正两个误改点位 * 更新版号 * 添加制谱器【跟新描述】 * 添加制谱器 * Delete repo/js/AutoYuanQin/assets/1.小星星.json * Delete repo/js/AutoYuanQin/assets/2.小星星变奏曲.json * Delete repo/js/AutoYuanQin/assets/3.Unknown Mother Goose [アンノウン・マザーグース].json * Delete repo/js/AutoYuanQin/assets/4.铃芽之旅[Suzume].json * Delete repo/js/AutoYuanQin/assets/5.Flower Dance.json * Delete repo/js/AutoYuanQin/assets/example.json * 更新制谱器
This commit is contained in:
@@ -46,8 +46,8 @@
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"x": 1107.88,
|
||||
"y": 1861.32,
|
||||
"x": 1108.71,
|
||||
"y": 1858.86,
|
||||
"type": "path",
|
||||
"move_mode": "run",
|
||||
"action": "",
|
||||
@@ -55,8 +55,8 @@
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"x": 1101.35,
|
||||
"y": 1866.58,
|
||||
"x": 1105.45,
|
||||
"y": 1865.58,
|
||||
"type": "target",
|
||||
"move_mode": "walk",
|
||||
"action": "combat_script",
|
||||
|
||||
@@ -10,15 +10,24 @@
|
||||
"positions": [
|
||||
{
|
||||
"id": 1,
|
||||
"action": "combat_script",
|
||||
"action": "",
|
||||
"move_mode": "walk",
|
||||
"type": "teleport",
|
||||
"x": 526.14,
|
||||
"y": 105.78,
|
||||
"action_params": "wait(0.5),keypress(space),wait(0.5)"
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"x": 527.00,
|
||||
"y": 106.75,
|
||||
"action": "combat_script",
|
||||
"move_mode": "walk",
|
||||
"action_params": "wait(2),keydown(Space),wait(0.1),keyup(Space),wait(0.2),keydown(Space),wait(0.1),keyup(Space),wait(5)",
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"x": 529.17,
|
||||
"y": 120.12,
|
||||
"type": "path",
|
||||
@@ -27,7 +36,7 @@
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"id": 4,
|
||||
"x": 530.63,
|
||||
"y": 129.27,
|
||||
"type": "target",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "提瓦特自动钓鱼(全流程+自选)",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"bgi_version": "0.43.1",
|
||||
"description": "脚本名称:提瓦特自动钓鱼(全流程+自选)\n功能描述:支持自动追踪并垂钓bgi支持的全提瓦特垂钓点\n核心功能------------------------------>\n1.可自选地区、鱼类、鱼饵\n2.可直接钓取特定物品的兑换材料(例如渔获)\n3.脚本会根据需要的鱼类自动调节时间,不需要的时段会跳过\n4.支持部分地图追踪无法到达的钓鱼点(例如炽岩斗士急流鱼钓鱼点,枫丹廷东北钓鱼点、雷鸣仙垂钓点)\n5.支持从特定的垂钓点继续任务(仅启用所有垂钓点时可用)\n6.默认禁用需要战斗的路线,如有需要请在JS脚本配置内启用\n7.支持自定义钓鱼超时时间\n8.支持设置定时关闭(最多24小时)\n9.4点自动领取月卡(可选)\n10.启用自动拾取(可选)\n注意事项------------------------------>\n1.部分点位涉及战斗,且队伍内不能有双风和跑步(不是冲刺)时加移速的角色\n2.跑图位必须是少男体型\n3.同时选择鱼类和鱼饵的情况下按照以下逻辑选择路线: 所有被选的鱼类会被加入任务列表,如果选择的鱼饵中某个鱼饵不是已选的任何一个鱼类的对应的鱼饵,那么这个鱼饵对应的所有鱼类将被添加到任务列表\n4.JS脚本的设置内各设置项含有优先级,如果存在高优先级且选项不为默认,则只有最高优先级的设置项生效\n5.部分钓鱼点为路径追踪+键鼠脚本(GCM)的混合模式,可能会出现因键鼠脚本误差卡死的情况,如果出现这种情况,请在JS脚本设置禁用键鼠路线来禁用所有包含键鼠脚本的钓鱼点\n---------------------------------------->\n作者:提瓦特钓鱼玳师\n脚本反馈邮箱:hijiwos@hotmail.com",
|
||||
"authors": [
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# 曲谱 JSON 文件说明
|
||||
此文档供曲谱制作人阅读,本文档详细说明了如何书写一个标准格式的曲谱.json文件,包括各个字段的解释以及曲谱内容的格式要求。
|
||||
* **注意**
|
||||
- 制铺优先使用AutoYuanQin\assets\tutorial_file目录下的制铺软件(index.html),有任何疑问请来看这个使用说明
|
||||
此文档供曲谱制作人阅读,本文档详细说明了一个标准格式的曲谱.json文件格式,包括各个字段的解释以及曲谱内容的格式要求。
|
||||
|
||||
重要:即使制作了曲谱的JSON文件,放到了正确的路径下,在调度器的JS脚本配置里也不会出现你制作的曲谱(上传方法如下)
|
||||
|
||||
@@ -10,10 +12,29 @@
|
||||
|
||||
3.发送邮件到hijiwos@hotmail.com并说明,你的谱子将会在一段时间内更新到仓库
|
||||
|
||||
## 曲谱制作问题
|
||||
\assets/tutorial_file/五线谱注解.png包含了五线谱(高音区和低音区)对应的4组键盘键位(相邻的红蓝大写字母为一组,每组音域为三个八度)
|
||||
## 曲谱制作器使用方法
|
||||
**制谱器路径: AutoYuanQin\assets\tutorial_file\index.html(请确保 五线谱注解.png与制谱器位于同一目录下)**
|
||||
**声明:本制谱器生成的曲谱文件为标准格式**
|
||||
|
||||
有不懂的地方请在\assets/tutorial_file/example.json内找,这个谱子内包含了该脚本的五线谱相关的所有功能
|
||||
* 使用步骤如下(顺序)
|
||||
* 确定音域(共有三种音域可选[左中右共三个],每个音域为一对红蓝大写字符[21个])
|
||||
* 选择音符:点击左上角图片中的对应大写字母或@, 点击多个音符实现和弦
|
||||
* 完善音符:页面底部两行选择音符的具体类型,选好后点击按钮```确定(完善音符)```
|
||||
* 分节:确保当前页面的音符都已完善,点击按钮```分节```
|
||||
* 换行:确保当前页面的音符都已完善,点击按钮```换行```
|
||||
|
||||
* **删除音符:** 如果您**写错了音符**,请**手动**删除**整个音符**并确保右上角代码框的**末尾**是 ```]、|、或一行的开头```
|
||||
* 音符删除示例:```A[16]B[32]``` 比如您想写 ```B[16]``` ,一不小心写成了三十二分音符,请删除整个音符~~B[32]~~,删除后的示例```A[16]```,然后再次进行音符 ```B```的写入
|
||||
* 写入曲谱信息(曲名、录谱人必填、bpm、拍号)
|
||||
* 导出曲谱
|
||||
点击按钮```导出乐谱JSON```,曲谱文件名请确认是```曲名.json```
|
||||
* 读取乐谱
|
||||
如果您写了一半,打算下次在写,可以使用导出曲谱功能保存曲谱,下次要写的时候点击按钮```读取乐谱JSON```,选择上次导出的文件即可
|
||||
|
||||
## 曲谱制作问题
|
||||
\assets\tutorial_file\五线谱注解.png包含了五线谱(高音区和低音区)对应的3组键盘键位(相邻的红蓝大写字母为一组,每组音域为三个八度)
|
||||
|
||||
有不懂的地方请在\assets\tutorial_file\example.json内找,这个谱子内包含了该脚本的五线谱相关的所有功能
|
||||
|
||||
## 曲谱文件位置
|
||||
所有的曲谱文件应放置于 AutoLyre\assets\score_file 路径下,并在文件名前添加正确的序号
|
||||
@@ -58,14 +79,14 @@ notes 字段中包含的是乐谱内容。音符**必须**使用**大写字母**
|
||||
### A[4]
|
||||
表示按下A键,A键视作四分音符。
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/四分音符示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\四分音符示例.png"/>
|
||||
<p>四分音符示例</p>
|
||||
</div>
|
||||
|
||||
### F[16-#]D[16-#]S[16-#]
|
||||
表示**装饰音·倚音**
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/装饰音·倚音示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\装饰音·倚音示例.png"/>
|
||||
<p>装饰音·倚音示例</p>
|
||||
</div>
|
||||
|
||||
@@ -75,7 +96,7 @@ notes 字段中包含的是乐谱内容。音符**必须**使用**大写字母**
|
||||
表示一个**三连音**(六连音用法与此相似,仅需将3改成6,**其它类型的连音**也请使用3或6(即使是5连音))
|
||||
另外,连音内支持和弦
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/三连音示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\三连音示例.png"/>
|
||||
<p>三连音示例</p>
|
||||
</div>
|
||||
|
||||
@@ -94,7 +115,7 @@ notes 字段中包含的是乐谱内容。音符**必须**使用**大写字母**
|
||||
### D[4-16.3]G[4-16.3]H[4-16.3]W[4-16.3]R[4-16.$]
|
||||
表示一个**五连音**,同理也可以是**N连音**
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/五连音示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\五连音示例.png"/>
|
||||
<p>五连音示例</p>
|
||||
</div>
|
||||
|
||||
@@ -108,7 +129,7 @@ notes 字段中包含的是乐谱内容。音符**必须**使用**大写字母**
|
||||
### (BG)[4-4.3]\(VF\)[4-8.$]
|
||||
表示一个**三连音连音线**(与三连音用法相同,但是三连音连音线允许连线内出现不同类型的音符)
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/三连音连音线示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\三连音连音线示例.png"/>
|
||||
<p>三连音连音线示例</p>
|
||||
</div>
|
||||
|
||||
@@ -123,7 +144,7 @@ notes 字段中包含的是乐谱内容。音符**必须**使用**大写字母**
|
||||
### @[2-8.6]\(AF\)[2-16.6]N[2-16.6]\(AF\)[2-16.6]N[2-16.6]\(AF\)[2-16.6]N[2-16.6]\(AF\)[2-16.6]N[2-16.6]\(AF\)[2-16.6]N[2-16.$]
|
||||
表示一个**六连音连音线**(乐谱上表示为一个六连音连音线内包含1个八分休止符和10个十六分音符,区别于三连音,六连音的.后面的数字是6)
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/六连音连音线示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\六连音连音线示例.png"/>
|
||||
<p>六连音连音线示例</p>
|
||||
</div>
|
||||
|
||||
@@ -138,7 +159,7 @@ notes 字段中包含的是乐谱内容。音符**必须**使用**大写字母**
|
||||
### @[4]
|
||||
表示一个**休止符**
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/四分休止符示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\四分休止符示例.png"/>
|
||||
<p>四分休止符示例</p>
|
||||
</div>
|
||||
|
||||
@@ -147,7 +168,7 @@ notes 字段中包含的是乐谱内容。音符**必须**使用**大写字母**
|
||||
### (SH)[4-*]
|
||||
表示一个**附点四分音符**
|
||||
<div align="center">
|
||||
<img src="https://github.com/babalae/bettergi-scripts-list/tree/main/repo/js/AutoYuanQin/assets/tutorial_file/附点四分音符示例.png"/>
|
||||
<img src="D:\Workplace\BetterGI脚本-追踪-战斗\JS脚本\AutoYuanQin\assets\tutorial_file\附点四分音符示例.png"/>
|
||||
<p>附点四分音符示例</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "小星星",
|
||||
"author": "提瓦特钓鱼玳师",
|
||||
"bpm": "80",
|
||||
"time_signature": "4/4",
|
||||
"composer": "none",
|
||||
"arranger": "none",
|
||||
"notes": "Z[4]Z[4]B[4]B[4]|N[4]N[4]B[2]|V[4]V[4]C[4]C[4]|X[4]X[4]Z[2]|B[4]B[4]V[4]V[4]|C[4]C[4]X[2]|B[4]B[4]V[4]V[4]|C[4]C[4]X[2]|Z[4]Z[4]B[4]B[4]|N[4]N[4]B[2]|V[4]V[4]C[4]C[4]|X[4]X[4]Z[2]|"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "铃芽之旅[Suzume]",
|
||||
"author": "提瓦特钓鱼玳师",
|
||||
"description": "五线谱网址:https://musescore.com/user/35362468/scores/7642952",
|
||||
"bpm": "78",
|
||||
"time_signature": "4/4",
|
||||
"composer": "野田洋次郎",
|
||||
"arranger": "JenaV",
|
||||
"notes": "S[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\nS[8]D[16]F[16]G[16]F[16]D[8]A[2]|\nS[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\n\nS[8]D[16]F[16]G[16]F[16]D[8]S[2]|\nS[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\nS[8]D[16]F[16]G[16]F[16]D[8]A[2]|\n\nS[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\nS[8]D[16]F[16]G[16]F[16]D[8]S[2]|\nH[4]Q[8-*]H[16]G[4]H[4]|\n\nF[4]G[8-*]F[16]D[4]A[4]|\nH[4]Q[8-*]H[16]G[4]H[4]|\nF[4]G[4]D[4]F[4]|\n\nS[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\nS[8]D[16]F[16]G[8]F[16]D[16]S[2]|\nS[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\n\nS[8]D[16]F[16]G[8]F[16]D[16]S[2]|\nS[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\nS[8]D[16]F[16]G[8]F[16]D[16]A[2]|\n\nS[4]H[8-*]H[16]F[16]D[16]S[8]A[8]N[16]A[16]|\nS[8]D[16]F[16]G[8]F[16]D[16]S[4]@[8]F[16]G[16]|\nH[8-*]G[16]F[16]G[16]H[8]H[4]F[8]G[8]|\n\nH[8-*]G[16]F[16]G[16]H[8]H[4]F[8]G[8]|\nH[8-*]G[16]F[16]G[16]H[8]H[4]F[8]G[8]|\nH[8-*]G[16]F[16]G[16]H[8]H[2]|\n\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4-*]F[16]G[16]H[16]G[16]G[16]F[16]F[8]|\n\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4-*]F[16]G[16]H[16]G[16]G[16]F[16]F[16]A[16]|\nS[8]F[8]D[8]A[16]S[16]S[4]@[16]A[16]S[16]A[16]|\n\nS[8]F[8]F[8]G[16]H[16]H[2]|\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4]@[16]F[16]F[16]G[16]H[16]G[16]G[16]F[16]F[8]|\n\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4]@[16]F[16]F[16]G[16]H[16]G[16]G[16]F[16]F[16]A[16]|\nS[8]F[8]D[8]A[16]S[16]S[4]@[8-*]A[16]|\n\nS[8]F[8]F[8]G[16]H[16]H[4-*]@[16]A[16]|\nS[8]F[8]D[8]A[16]S[16]S[8]F[8]F[8]G[16]G[16]|\nG[4]@[16]F[16]F[16]G[16]H[8-*]G[16]G[8-*]F[16]|\n\n(FH)[8]Q[8]H[8]G[8]F[4]G[4]|\n(FH)[2-*](AD)[4]|\nH[8]Q[8]W[8]Q[8]H[4]G[4]|\n\n(SF)[2-*]@[8]F[16]G[16]|\nH[8]G[16]G[16]G[16]F[16]S[8]S[4]@[8]S[16]A[16]|\nS[8]F[16]F[16]F[16]G[16]H[8]H[4]@[8]F[16]G[16]|\n\nH[8]G[16]G[16]G[16]F[16]S[8]S[4]@[8]S[16]A[16]|\nS[16]F[16]F[16]F[16]F[16]H[16]G[8]G[4]@[8]H[16]G[16]|\nH[8-*]H[16]H[16]W[16]Q[8]Q[4]@[8]F[16]S[16]|\n\nF[8-*]F[16]F[16]G[16]H[8]H[4-*]S[16]A[16]|\nS[8]F[16]F[16]F[16]G[16]H[8]@[8]H[8]G[16]F[16]D[8]|\nS[8]S[16]A[16]A[16]S[16]S[8]S[4]@[8]H[16]G[16]|\n\nH[8-*]H[16]H[16]W[16]Q[8]Q[4]@[8]F[16]S[16]|\nF[8-*]F[16]F[16]G[16]H[8]H[4]@[8]S[16]A[16]|\nS[8]F[16]F[16]F[16]G[16]H[8]H[8]H[8]G[16]F[16]D[8]|\n\nS[8]S[16]A[16]A[16]S[16]S[8]S[4]@[8]H[8]|\nG[8-*]F[16]F[16]D[16]S[8]S[2]|\nH[16]S[16]F[16]H[16]G[16]A[16]D[16]N[16]N[4]@[16]A[16]D[16]G[16]|\n\nH[16]S[16]F[16]H[16]G[16]A[16]D[16]N[16]N[4]@[16]A[16]D[16]G[16]|\nH[16]S[16]F[16]H[16]G[16]A[16]D[16]N[16]N[4]@[16]Q[16]E[16]T[16]|\n\nY[16]W[16]R[16]Y[16]T[16]Q[16]E[16]H[16]E[16]Q[16]F[32]G[32]H[32]J[32]Q[32]W[32]E[32]R[32]T[32]Y[32]U[32]U[32]|\nU[2]|\n\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4-*]F[16]G[16]H[16]G[16]G[16]F[16]F[8]|\n\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4-*]F[16]G[16]H[16]G[16]G[16]F[16]F[16]A[16]|\nS[8]F[8]D[8]A[16]S[16]S[4]@[16]A[16]S[16]A[16]|\n\nS[8]F[8]F[8]G[16]H[16]H[2]|\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4]@[16]F[16]F[16]G[16]H[16]G[16]G[16]F[16]F[8]|\n\nW[16]Q[16]Q[16]Q[16]Q[16]H[16]H[16]H[16]H[16]G[16]G[16]G[16]G[16]F[16]F[16]G[16]|\nG[8]H[4]@[16]F[16]F[16]G[16]H[16]G[16]G[16]F[16]F[16]A[16]|\n\nS[8]F[8]D[8]A[16]S[16]S[4]@[8-*]A[16]|\nS[8]F[8]F[8]G[16]H[16]H[4-*]@[16]A[16]|\nS[8]F[8]D[8]A[16]S[16]S[8]F[8]F[8]G[16]G[16]|\n\nG[4]@[16]F[16]F[16]G[16]H[8-*]G[16]G[8-*]F[16]|\nH[8]Q[8]H[8]G[8]F[4]A[4]|\n(AFH)[2](NMA)[2]"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
repo/js/AutoYuanQin/assets/score_file/7.千本樱 (Eric Chen).json
Normal file
10
repo/js/AutoYuanQin/assets/score_file/7.千本樱 (Eric Chen).json
Normal file
File diff suppressed because one or more lines are too long
624
repo/js/AutoYuanQin/assets/tutorial_file/index.html
Normal file
624
repo/js/AutoYuanQin/assets/tutorial_file/index.html
Normal file
@@ -0,0 +1,624 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="version" content="1.0.0">
|
||||
<title>BGI原琴制谱器</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
min-height: 100vh; /* 确保包括缓冲区域的最小高度 */
|
||||
}
|
||||
/* 页面容器 */
|
||||
#container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
#top-section {
|
||||
display: flex;
|
||||
min-height: 100vh; /* 占满可见页面高度 */
|
||||
margin-bottom: 100px; /* 给菜单栏留出空间 */
|
||||
}
|
||||
/* 左侧图像区域 */
|
||||
/*
|
||||
#image-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
*/
|
||||
#image-section img {
|
||||
height: 100%; /* 自适应页面高度 */
|
||||
object-fit: contain; /* 保持比例缩放 */
|
||||
}
|
||||
/* 文本区域容器 */
|
||||
#code-wrapper {
|
||||
flex: 1;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
#code-area {
|
||||
width: 100%;
|
||||
height: 62.5%; /* 高度基于左侧图片 */
|
||||
border: none;
|
||||
padding: 10px;
|
||||
font-size: calc(0.6vw + 0.6vh);
|
||||
font-family: monospace;
|
||||
line-height: 1.5em;
|
||||
resize: none; /* 禁止调整大小 */
|
||||
overflow-y: auto; /* 内容超出时显示滚动条 */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* 悬浮菜单栏 */
|
||||
#bottom-section {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: auto; /* 根据内容高度自适应 */
|
||||
padding: 10px;
|
||||
background-color: #e0e0e0;
|
||||
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column; /* 垂直排列 */
|
||||
justify-content: center;
|
||||
}
|
||||
.action-button {
|
||||
margin: calc(0.5vw + 0.5vh);
|
||||
padding: calc(0.5vw + 0.5vh) calc(1vw + 1vh);
|
||||
font-size: 16px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.action-button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
.textarea {
|
||||
margin: 10px;
|
||||
padding: 10px 20px;
|
||||
font-size: calc(0.6vw + 0.6vh);
|
||||
color: black;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.input-text {
|
||||
width: calc(5vw + 5vh);
|
||||
height: calc(0.5vw + 0.5vh);
|
||||
margin: calc(0.5vw + 0.5vh);
|
||||
padding: calc(0.5vw + 0.5vh) calc(0.5vw + 0.5vh);
|
||||
font-size: calc(0.6vw + 0.6vh);
|
||||
color: black;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.input-text-bpm {
|
||||
width: calc(2vw + 2vh);
|
||||
height: calc(0.5vw + 0.5vh);
|
||||
margin: calc(0.5vw + 0.5vh);
|
||||
padding: calc(0.5vw + 0.5vh) calc(0.5vw + 0.5vh);
|
||||
font-size: calc(0.6vw + 0.6vh);
|
||||
color: black;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.input-text-descriptiont {
|
||||
width: calc(20vw + 20vh);
|
||||
height: calc(0.5vw + 0.5vh);
|
||||
margin: calc(0.5vw + 0.5vh);
|
||||
padding: calc(0.5vw + 0.5vh) calc(0.5vw + 0.5vh);
|
||||
font-size: calc(0.6vw + 0.6vh);
|
||||
color: black;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.dropdown {
|
||||
margin: calc(0.5vw + 0.5vh);
|
||||
padding: calc(0.5vw + 0.5vh) calc(0.5vw + 0.5vh);
|
||||
font-size: calc(0.6vw + 0.6vh);
|
||||
background-color: #FFFFFF;
|
||||
color: black;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.hotspot {
|
||||
margin: 10px auto;
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
background-color: #ffa500;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
border-radius: calc(0.15625vw + 0.15625vw);
|
||||
}
|
||||
/* 缓冲区域 */
|
||||
#buffer {
|
||||
height: 100px; /* 缓冲区域高度(占位) */
|
||||
background-color: transparent;
|
||||
display: block;
|
||||
}
|
||||
/* 隐藏默认文件选择框 */
|
||||
#file_input {
|
||||
display: none;
|
||||
}
|
||||
/* 鼠标悬停效果 */
|
||||
.custom-file-label:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
/* 为文件名展示样式 */
|
||||
.file_name {
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<!-- 顶部内容 -->
|
||||
<div id="top-section">
|
||||
<div id="image-section">
|
||||
<img src="五线谱注解.png" alt="左侧图片" width="1111" height="1111" usemap="#Map" style="display: block; max-width: 100%; height: auto;">
|
||||
<map name="Map">
|
||||
<area shape="rect" coords="194,227,254,287" onclick="add_key('@')">
|
||||
<area shape="rect" coords="394,27,449,77" onclick="add_key('U')">
|
||||
<area shape="rect" coords="394,77,449,127" onclick="add_key('T')">
|
||||
<area shape="rect" coords="394,127,449,177" onclick="add_key('E')">
|
||||
<area shape="rect" coords="394,177,449,227" onclick="add_key('Q')">
|
||||
<area shape="rect" coords="394,227,449,277" onclick="add_key('H')">
|
||||
<area shape="rect" coords="394,277,449,327" onclick="add_key('F')">
|
||||
<area shape="rect" coords="394,327,449,377" onclick="add_key('S')">
|
||||
<area shape="rect" coords="394,377,449,427" onclick="add_key('M')">
|
||||
<area shape="rect" coords="394,427,449,477" onclick="add_key('B')">
|
||||
<area shape="rect" coords="394,477,449,527" onclick="add_key('C')">
|
||||
<area shape="rect" coords="394,527,449,577" onclick="add_key('Z')">
|
||||
<area shape="rect" coords="448,52,503,102" onclick="add_key('Y')">
|
||||
<area shape="rect" coords="448,102,503,152" onclick="add_key('R')">
|
||||
<area shape="rect" coords="448,152,503,202" onclick="add_key('W')">
|
||||
<area shape="rect" coords="448,202,503,252" onclick="add_key('J')">
|
||||
<area shape="rect" coords="448,252,503,302" onclick="add_key('G')">
|
||||
<area shape="rect" coords="448,302,503,352" onclick="add_key('D')">
|
||||
<area shape="rect" coords="448,352,503,402" onclick="add_key('A')">
|
||||
<area shape="rect" coords="448,402,503,452" onclick="add_key('N')">
|
||||
<area shape="rect" coords="448,452,503,502" onclick="add_key('V')">
|
||||
<area shape="rect" coords="448,502,503,552" onclick="add_key('X')">
|
||||
<area shape="rect" coords="596,202,651,252" onclick="add_key('U')">
|
||||
<area shape="rect" coords="596,252,651,302" onclick="add_key('T')">
|
||||
<area shape="rect" coords="596,302,651,352" onclick="add_key('E')">
|
||||
<area shape="rect" coords="596,352,651,402" onclick="add_key('Q')">
|
||||
<area shape="rect" coords="596,402,651,452" onclick="add_key('H')">
|
||||
<area shape="rect" coords="596,452,651,502" onclick="add_key('F')">
|
||||
<area shape="rect" coords="596,502,651,552" onclick="add_key('S')">
|
||||
<area shape="rect" coords="596,552,651,602" onclick="add_key('M')">
|
||||
<area shape="rect" coords="596,602,651,652" onclick="add_key('B')">
|
||||
<area shape="rect" coords="596,652,651,702" onclick="add_key('C')">
|
||||
<area shape="rect" coords="596,702,651,752" onclick="add_key('Z')">
|
||||
<area shape="rect" coords="650,227,705,277" onclick="add_key('Y')">
|
||||
<area shape="rect" coords="650,277,705,327" onclick="add_key('R')">
|
||||
<area shape="rect" coords="650,327,705,377" onclick="add_key('W')">
|
||||
<area shape="rect" coords="650,377,705,427" onclick="add_key('J')">
|
||||
<area shape="rect" coords="650,427,705,477" onclick="add_key('G')">
|
||||
<area shape="rect" coords="650,477,705,527" onclick="add_key('D')">
|
||||
<area shape="rect" coords="650,527,705,577" onclick="add_key('A')">
|
||||
<area shape="rect" coords="650,577,705,627" onclick="add_key('N')">
|
||||
<area shape="rect" coords="650,627,705,677" onclick="add_key('V')">
|
||||
<area shape="rect" coords="650,677,705,727" onclick="add_key('X')">
|
||||
<area shape="rect" coords="794,427,849,477" onclick="add_key('U')">
|
||||
<area shape="rect" coords="794,477,849,527" onclick="add_key('T')">
|
||||
<area shape="rect" coords="794,527,849,577" onclick="add_key('E')">
|
||||
<area shape="rect" coords="794,577,849,627" onclick="add_key('Q')">
|
||||
<area shape="rect" coords="794,627,849,677" onclick="add_key('H')">
|
||||
<area shape="rect" coords="794,677,849,727" onclick="add_key('F')">
|
||||
<area shape="rect" coords="794,727,849,777" onclick="add_key('S')">
|
||||
<area shape="rect" coords="794,777,849,827" onclick="add_key('M')">
|
||||
<area shape="rect" coords="794,827,849,877" onclick="add_key('B')">
|
||||
<area shape="rect" coords="794,877,849,927" onclick="add_key('C')">
|
||||
<area shape="rect" coords="794,927,849,977" onclick="add_key('Z')">
|
||||
<area shape="rect" coords="854,477,909,527" onclick="add_key('Y')">
|
||||
<area shape="rect" coords="854,527,909,577" onclick="add_key('R')">
|
||||
<area shape="rect" coords="854,577,909,627" onclick="add_key('W')">
|
||||
<area shape="rect" coords="854,627,909,677" onclick="add_key('J')">
|
||||
<area shape="rect" coords="854,677,909,727" onclick="add_key('G')">
|
||||
<area shape="rect" coords="854,727,909,777" onclick="add_key('D')">
|
||||
<area shape="rect" coords="854,777,909,827" onclick="add_key('A')">
|
||||
<area shape="rect" coords="854,827,909,877" onclick="add_key('N')">
|
||||
<area shape="rect" coords="854,877,909,927" onclick="add_key('V')">
|
||||
<area shape="rect" coords="854,927,909,977" onclick="add_key('X')">
|
||||
</map>
|
||||
</div>
|
||||
<div id="code-wrapper">
|
||||
<textarea id="code-area" placeholder="自动生成代码..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 缓冲区域 -->
|
||||
<div id="buffer"></div>
|
||||
|
||||
<!-- 悬浮菜单栏 -->
|
||||
<div id="bottom-section">
|
||||
<!-- 第一行 -->
|
||||
<div class="row">
|
||||
<label for="score_name" class="textarea">曲名:</label>
|
||||
<input type="text" id="score_name" name="score_name" class="input-text" placeholder="输入歌曲名称...">
|
||||
<label for="score_author" class="textarea">录谱人:</label>
|
||||
<input type="text" id="score_author" name="score_author" class="input-text" placeholder="输入翻谱人名称...">
|
||||
<label for="score_bpm" class="textarea">BPM:</label>
|
||||
<input type="number" id="score_bpm" name="score_bpm" min="1" max="1000" value="1" class="input-text-bpm">
|
||||
<label for="time_signature" class="textarea">拍号: </label>
|
||||
<select id="time_signature" class="dropdown">
|
||||
<option value="1/4">1/4</option>
|
||||
<option value="2/4">3/4</option>
|
||||
<option value="3/4">3/4</option>
|
||||
<option value="4/4">4/4</option>
|
||||
<option value="5/4">5/4</option>
|
||||
<option value="3/8">3/8</option>
|
||||
<option value="4/8">4/8</option>
|
||||
<option value="6/8">6/8</option>
|
||||
<option value="9/8">9/8</option>
|
||||
<option value="2/2">2/2</option>
|
||||
<option value="3/2">3/2</option>
|
||||
</select>
|
||||
<label for="score_composer" class="textarea">曲师:</label>
|
||||
<input type="text" id="score_composer" name="score_composer" class="input-text" placeholder="曲师...">
|
||||
<label for="score_arranger" class="textarea">谱师:</label>
|
||||
<input type="text" id="score_arranger" name="score_arranger" class="input-text" placeholder="谱师...">
|
||||
</div>
|
||||
<!-- 第二行 -->
|
||||
<div class="row">
|
||||
<label for="dropdown_type" class="textarea">音符类型: </label>
|
||||
<select id="dropdown_type" class="dropdown">
|
||||
<option value="none">普通</option>
|
||||
<option value="*">附点音符</option>
|
||||
<option value=".">连音</option>
|
||||
<option value="&">连音(末尾)</option>
|
||||
<option value="#">装饰音·倚音</option>
|
||||
</select>
|
||||
<label for="dropdown_all" class="textarea" style="display: none;" id="dropdown_all_text">连音总时值: </label>
|
||||
<select id="dropdown_all" class="dropdown" style="display: none;">
|
||||
<option value="0.25">4个全音符</option>
|
||||
<option value="0.375">3个全音符</option>
|
||||
<option value="0.5">2个全音符</option>
|
||||
<option value="1">全音符</option>
|
||||
<option value="2">二分音符</option>
|
||||
<option value="4">四分音符</option>
|
||||
<option value="8">八分音符</option>
|
||||
<option value="16">十六分音符</option>
|
||||
<option value="32">三十二分音符</option>
|
||||
<option value="64">六十四分音符</option>
|
||||
</select>
|
||||
<label for="score_description" class="textarea">描述:</label>
|
||||
<input type="text" id="score_description" name="score_description" class="input-text-descriptiont" placeholder="在这里填写描述(例如五线谱的网址)...">
|
||||
</div>
|
||||
<!-- 第三行 -->
|
||||
<div class="row">
|
||||
<label for="dropdown_long" class="textarea" id="dropdown_long_text">音符时值: </label>
|
||||
<select id="dropdown_long" class="dropdown">
|
||||
<option value="1">全音符</option>
|
||||
<option value="2">二分音符</option>
|
||||
<option value="4">四分音符</option>
|
||||
<option value="8">八分音符</option>
|
||||
<option value="16">十六分音符</option>
|
||||
<option value="32">三十二分音符</option>
|
||||
<option value="64">六十四分音符</option>
|
||||
</select>
|
||||
<button class="action-button" onclick="new_bar()">分节</button>
|
||||
<button class="action-button" onclick="new_line()">换行</button>
|
||||
<button class="action-button" onclick="btn_confirm()">确定(完善音符)</button>
|
||||
<button class="action-button" onclick="btn_output()">导出乐谱JSON</button>
|
||||
<input type="file" id="file_input">
|
||||
<button for="file_input" class="action-button" id="read_button">读取乐谱JSON</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
/*设置页面底部缓冲区高度与悬浮菜单栏的高度相同*/
|
||||
var bottomSection = document.getElementById('bottom-section');
|
||||
var buffer = document.getElementById('buffer');
|
||||
buffer.style.height = bottomSection.offsetHeight + 'px';
|
||||
|
||||
var dropdownType = document.getElementById('dropdown_type');
|
||||
var dropdownAllText = document.getElementById('dropdown_all_text');
|
||||
var dropdownAll = document.getElementById('dropdown_all');
|
||||
var dropdownLong = document.getElementById('dropdown_long_text');
|
||||
|
||||
const fileInput = document.getElementById('file_input');
|
||||
const readButton = document.getElementById('read_button');
|
||||
|
||||
/*设置连音时值下拉菜单的可见性和音符时值文本*/
|
||||
dropdownType.addEventListener('change', function() {
|
||||
if (dropdownType.value === "." || dropdownType.value === "$") { // 显示连音总时值
|
||||
dropdownAll.style.display = 'inline-block';
|
||||
dropdownAllText.style.display = 'inline-block';
|
||||
dropdownLong.textContent = "连音中当前音符时值: ";
|
||||
} else {
|
||||
dropdownAll.style.display = 'none'; // 隐藏
|
||||
dropdownAllText.style.display = 'none';
|
||||
dropdownLong.textContent = "音符时值: ";
|
||||
// // 重置音符类型下拉菜单为默认选项
|
||||
// dropdownAll.selectedIndex = 0;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*点击“读取JSON文件”按钮时触发*/
|
||||
readButton.addEventListener('click', () => {
|
||||
fileInput.value = ""; // 清空上一次选择的文件
|
||||
fileInput.click(); // 模拟点击文件选择框
|
||||
});
|
||||
|
||||
/*文件选择完成后触发*/
|
||||
fileInput.addEventListener('change', () => {
|
||||
const file = fileInput.files[0];
|
||||
if (file) {
|
||||
btn_read(); // 在选择文件后调用读取方法
|
||||
} else {
|
||||
alert("文件选择出错!"); // 理论上不会执行
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/*点击图片添加音符*/
|
||||
function add_key(key) {
|
||||
const regex_note = /(^|(?<=\])|(?<=\n))[^][^\n]*(?=\[\])/g; // 匹配空音符A[]或(AD)[]
|
||||
const codeArea = document.getElementById('code-area');
|
||||
let content = codeArea.value;
|
||||
let matches = content.match(regex_note);
|
||||
if (matches !== null && matches.length > 1) { // 异常操作检测
|
||||
alert(`存在的未完成的音符大于一个,无法添加新的音符(目前存在的所有未完成音符数: ${matches.length})`);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (content.endsWith("[]")) { // 添加为和弦
|
||||
if (content[content.length - 3] === ")") {
|
||||
const left_index = content.lastIndexOf("(");
|
||||
const right_index = content.lastIndexOf(")");
|
||||
|
||||
const string_mid = content.substring(left_index, right_index);
|
||||
if (string_mid.includes(key)) {
|
||||
return null;
|
||||
}
|
||||
content = `${content.substring(0, left_index)}${string_mid}${key}${content.substring(right_index)}`;
|
||||
} else {
|
||||
const ori_key_index = content.lastIndexOf("[") - 1;
|
||||
if (content[ori_key_index] === key) {
|
||||
return null;
|
||||
}
|
||||
content = `${content.substring(0, ori_key_index)}(${content[ori_key_index]}${key})[]`;
|
||||
}
|
||||
// // 取正则匹配的最后一个
|
||||
// matches = matches[matches.length - 1];
|
||||
// if (!matches.includes(key)) { // 和弦不能有重复的音符
|
||||
// if (matches.endsWith(")")) {
|
||||
// matches = `${matches.slice(0, -1)}${key})`;
|
||||
// } else {
|
||||
// if (matches.startsWith("\n\n")) {
|
||||
// matches = `\n(${matches.replace(/\n/g, "")}${key})`;
|
||||
// } else if (matches.startsWith("\n")) {
|
||||
// matches = `\n(${matches.replace(/\n/g, "")}${key})`;
|
||||
// } else if (content.length === 3){
|
||||
// matches = `(${matches}${key})`;
|
||||
// } else {
|
||||
// `${matches.slice(0, -3)}(${matches[-1]}${key})[]`;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// content = content.replace(regex_note, matches);
|
||||
codeArea.value = content;
|
||||
} else { // 添加新的音
|
||||
content += key + "[]";
|
||||
codeArea.value = content;
|
||||
}
|
||||
}
|
||||
|
||||
/*点击按钮添加分节标志*/
|
||||
function new_bar() {
|
||||
const regex_note = /(^|(?<=\])|(?<=\n))[^][^\n]*(?=\[\])/g; // 匹配空音符A[]或(AD)[]
|
||||
const codeArea = document.getElementById('code-area');
|
||||
let content = codeArea.value;
|
||||
if (regex_note.test(content)) {
|
||||
alert(`存在未完成的音符!`);
|
||||
return null;
|
||||
} else if (content.endsWith("\n") || content.endsWith("|")) {
|
||||
alert("小节内容不能为空!");
|
||||
return null;
|
||||
}
|
||||
content += "|\n";
|
||||
codeArea.value = content;
|
||||
|
||||
}
|
||||
|
||||
/*点击按钮添加换行标志*/
|
||||
function new_line() {
|
||||
const regex_note = /(^|(?<=\])|(?<=\n))[^][^\n]*(?=\[\])/g; // 匹配空音符A[]或(AD)[]
|
||||
const codeArea = document.getElementById('code-area');
|
||||
let content = codeArea.value;
|
||||
if (regex_note.test(content)) {
|
||||
alert(`存在未完成的音符!`);
|
||||
return null;
|
||||
} else if (content.endsWith("\n")) {
|
||||
alert("行的内容不能为空!\n如果已经添加了分节标志,请手动删除分节标志");
|
||||
return null;
|
||||
}
|
||||
content += "|\n\n";
|
||||
codeArea.value = content;
|
||||
}
|
||||
|
||||
/*根据所选完善音符*/
|
||||
function btn_confirm() {
|
||||
const codeArea = document.getElementById('code-area');
|
||||
let content = codeArea.value;
|
||||
if (!content.endsWith("[]")) {
|
||||
alert("未检测到空音符,请先添加音符!");
|
||||
return null;
|
||||
}
|
||||
const dropdownType = document.getElementById('dropdown_type');
|
||||
const score_type = dropdownType.value;
|
||||
const dropdownLong = document.getElementById('dropdown_long');
|
||||
const dropdownAll = document.getElementById('dropdown_all');
|
||||
const regex_detail = /(?<=\[)[\s\S]*?(?=\])/g // 匹配 [] test
|
||||
|
||||
if (score_type === "none") { // 普通音符
|
||||
content = `${content.slice(0, -2)}[${dropdownLong.value}]`;
|
||||
} else if (score_type === ".") { // 连音(默认使用3)
|
||||
content = `${content.slice(0, -2)}[${dropdownAll.value}-${dropdownLong.value}.3]`;
|
||||
} else if (score_type === "$") { // 连音(末尾)
|
||||
content = `${content.slice(0, -2)}[${dropdownAll.value}-${dropdownLong.value}.$]`;
|
||||
} else { // 附点音符或装饰音·倚音
|
||||
content = `${content.slice(0, -2)}[${dropdownLong.value}-${dropdownType.value}]`;
|
||||
}
|
||||
codeArea.value = content;
|
||||
|
||||
}
|
||||
|
||||
/*导出乐谱文件*/
|
||||
function btn_output() {
|
||||
const score_name = document.getElementById("score_name").value;
|
||||
const score_author = document.getElementById("score_author").value;
|
||||
|
||||
if (score_name === "" || score_author === "") {
|
||||
alert("导出前请填写曲谱名和录谱人!");
|
||||
return null;
|
||||
}
|
||||
let score_description = document.getElementById("score_description").value;
|
||||
const score_bpm = document.getElementById("score_bpm").value;
|
||||
const time_signature = document.getElementById("time_signature").value;
|
||||
let score_composer = document.getElementById("score_composer").value;
|
||||
let score_arranger = document.getElementById("score_arranger").value;
|
||||
score_description = typeof(score_description) === "undefined" ? "无": score_description;
|
||||
score_composer = typeof(score_composer) === "undefined" ? "无": score_composer;
|
||||
score_arranger = typeof(score_arranger) === "undefined" ? "无": score_arranger;
|
||||
const notes = document.getElementById("code-area").value;
|
||||
|
||||
const json_content = `{
|
||||
"name": "${score_name}",
|
||||
"author": "${score_author}",
|
||||
"description": "${score_description}",
|
||||
"bpm": "${score_bpm}",
|
||||
"time_signature": "${time_signature}",
|
||||
"composer": "${score_composer}",
|
||||
"arranger": "${score_arranger}",
|
||||
"notes": "${notes.replace(/\n/g, "\\n")}"
|
||||
}`;
|
||||
// 创建Blob对象
|
||||
const blob = new Blob([json_content], { type: 'application/json' });
|
||||
// 创建下载链接
|
||||
const url = URL.createObjectURL(blob);
|
||||
// 动态创建隐藏的<a>元素
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `${score_name}.json`; // 文件名
|
||||
a.style.display = 'none';
|
||||
|
||||
// 模拟点击触发下载
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
// 释放URL对象
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
/*读取乐谱文件*/
|
||||
function btn_read() {
|
||||
const codeArea = document.getElementById('code-area');
|
||||
const scoreName = document.getElementById('score_name');
|
||||
const scoreAuthor = document.getElementById('score_author');
|
||||
const scoreBpm = document.getElementById('score_bpm');
|
||||
const timeSignature = document.getElementById('time_signature');
|
||||
const scoreComposer = document.getElementById('score_composer');
|
||||
const scoreArranger = document.getElementById('score_arranger');
|
||||
const scoreDescription = document.getElementById('score_description');
|
||||
|
||||
const fileInput = document.getElementById('file_input');
|
||||
const file = fileInput.files[0]; // 获取选中的文件
|
||||
if (!file) {
|
||||
alert('请先选择一个文件!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用 FileReader 读取文件内容
|
||||
const reader = new FileReader();
|
||||
|
||||
// 文件读取成功的回调函数
|
||||
reader.onload = function(event) {
|
||||
const content = event.target.result; // 文件内容
|
||||
const content_msg = get_music_msg(content); // 解析后的文件内容
|
||||
|
||||
scoreName.value = content_msg["name"];
|
||||
scoreAuthor.value = content_msg["author"];
|
||||
scoreBpm.value = content_msg["bpm"];
|
||||
timeSignature.value = content_msg["time_signature"];
|
||||
scoreComposer.value = content_msg["composer"];
|
||||
scoreArranger.value = content_msg["arranger"];
|
||||
scoreDescription.value = content_msg["description"];
|
||||
codeArea.value = content_msg["notes"]; // notes
|
||||
};
|
||||
|
||||
// 以文本形式读取文件
|
||||
reader.readAsText(file);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 解析一个乐谱文件
|
||||
*
|
||||
* @param file_text {string} 乐曲文件内容
|
||||
* @returns
|
||||
*/
|
||||
function get_music_msg(file_text) {
|
||||
|
||||
let music_msg_dic = {};
|
||||
|
||||
// 正则表达式,用于匹配如下内容
|
||||
let regex_name = /(?<="name": ")[\s\S]*?(?=")/
|
||||
let regex_author = /(?<="author": ")[\s\S]*?(?=")/
|
||||
let regex_description = /(?<="description": ")[\s\S]*?(?=")/
|
||||
let regex_bpm = /(?<="bpm": ")[\s\S]*?(?=")/
|
||||
let regex_time_signature = /(?<="time_signature": ")[\s\S]*?(?=")/
|
||||
let regex_composer = /(?<="composer": ")[\s\S]*?(?=")/
|
||||
let regex_arranger = /(?<="arranger": ")[\s\S]*?(?=")/
|
||||
let regex_notes = /(?<="notes": ")[\s\S]*?(?=")/
|
||||
|
||||
let regex_blank = /[\\\\n]{2}/g
|
||||
try {
|
||||
// 歌曲名
|
||||
music_msg_dic["name"] = file_text.match(regex_name)[0];
|
||||
// 录谱人
|
||||
music_msg_dic["author"] = file_text.match(regex_author)[0];
|
||||
// 描述
|
||||
music_msg_dic["description"] = file_text.match(regex_description)[0];
|
||||
// 歌曲BPM
|
||||
music_msg_dic["bpm"] = file_text.match(regex_bpm)[0];
|
||||
// 拍号
|
||||
music_msg_dic["time_signature"] = file_text.match(regex_time_signature)[0];
|
||||
// 曲师
|
||||
music_msg_dic["composer"] = file_text.match(regex_composer)[0];
|
||||
// 谱师
|
||||
music_msg_dic["arranger"] = file_text.match(regex_arranger)[0];
|
||||
// 曲谱内容(删除换行符)
|
||||
music_msg_dic["notes"] = file_text.match(regex_notes)[0].replace(/[\\\\n]{3}/g, "\n").replace(/[\\\\n]{2}/g, "\n\n");
|
||||
|
||||
} catch(error) {
|
||||
alert(`曲谱解析错误:${error}\n请检查曲谱文件格式是否正确`);
|
||||
return null;
|
||||
}
|
||||
|
||||
return music_msg_dic;
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
@@ -200,6 +200,7 @@
|
||||
// 正则表达式,用于匹配如下内容
|
||||
let regex_name = /(?<="name": ")[\s\S]*?(?=")/
|
||||
let regex_author = /(?<="author": ")[\s\S]*?(?=")/
|
||||
let regex_description = /(?<="description": ")[\s\S]*?(?=")/
|
||||
let regex_bpm = /(?<="bpm": ")[\s\S]*?(?=")/
|
||||
let regex_time_signature = /(?<="time_signature": ")[\s\S]*?(?=")/
|
||||
let regex_composer = /(?<="composer": ")[\s\S]*?(?=")/
|
||||
@@ -212,6 +213,8 @@
|
||||
music_msg_dic["name"] = file_text.match(regex_name)[0];
|
||||
// 录谱人
|
||||
music_msg_dic["author"] = file_text.match(regex_author)[0];
|
||||
// 描述
|
||||
music_msg_dic["description"] = file_text.match(regex_description)[0];
|
||||
// 歌曲BPM
|
||||
music_msg_dic["bpm"] = file_text.match(regex_bpm)[0];
|
||||
// 拍号
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "原琴·五线谱版",
|
||||
"version": "2.0",
|
||||
"bgi_version": "0.42.5",
|
||||
"description": "功能描述:功能及其强大的原琴脚本\n核心功能------------------------------>\n1.轻松实现根据五线谱翻版琴谱,支持单音、和弦\n2.曲谱支持录入BPM、拍号\n3.特殊音符支持休止符、浮点音符、(三/六)连音、(三/六)连音标记线、装饰音·倚音\n注意事项------------------------------>\n1.使用前请装备原琴\n2.音域只有3个八度,受原琴音域限制,本脚本的上限取决于翻谱的大佬(卑微\n3.实际上装饰音·倚音的时长视为基础时值单位(比如拍号2/4的基础时值单位就是4分音符)的1/16\n4.制铺说明:曲谱JSON文件的notes必须保证为一行且不能包括空白符(换行符除外);小节之间用|隔开,|不是必要的,作用是方便曲谱维护\n---------------------------------------->\n作者:提瓦特钓鱼玳师\n脚本反馈邮箱:hijiwos@hotmail.com",
|
||||
"version": "2.1",
|
||||
"bgi_version": "0.43.1",
|
||||
"description": "功能描述:功能及其强大的原琴脚本\n核心功能------------------------------>\n1.轻松实现根据五线谱翻版琴谱,支持单音、和弦\n2.曲谱支持录入BPM、拍号\n3.特殊音符支持休止符、浮点音符、(三/六)连音、(三/六)连音标记线、装饰音·倚音\n4.含有制谱器,方便制作曲谱\n注意事项------------------------------>\n1.使用前请装备原琴\n2.音域只有3个八度,受原琴音域限制,本脚本的上限取决于翻谱的大佬(卑微\n3.实际上装饰音·倚音的时长视为基础时值单位(比如拍号2/4的基础时值单位就是4分音符)的1/16\n4.制铺说明:曲谱JSON文件的notes必须保证为一行且不能包括空白符(换行符除外);小节之间用|隔开,|不是必要的,作用是方便曲谱维护\n---------------------------------------->\n作者:提瓦特钓鱼玳师\n脚本反馈邮箱:hijiwos@hotmail.com",
|
||||
"authors": [
|
||||
{
|
||||
"name": "提瓦特钓鱼玳师",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"4.铃芽之旅[Suzume]-[3:52]",
|
||||
"5.Flower Dance-[5:20]",
|
||||
"6.起风了-[3:22]",
|
||||
"7.千本樱 (Eric Chen)-[4:03]"
|
||||
"7.千本樱 (Eric Chen)-[4:03]"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user