Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa7b623a96 | ||
|
|
dbb262716e | ||
|
|
c61d680fe9 | ||
|
|
89175adca6 | ||
|
|
c1ae9225be | ||
|
|
d5e94caef1 | ||
|
|
c7141c911c | ||
|
|
b6713a792f | ||
|
|
c0976b30c1 | ||
|
|
65fdecb9be | ||
|
|
2a16af252f | ||
|
|
cd967af5c8 | ||
|
|
df9ddff4e4 | ||
|
|
8f26c9e1de | ||
|
|
b88515f4f2 | ||
|
|
46b88f4c6f | ||
|
|
03af82818a | ||
|
|
9f5a6ab58e | ||
|
|
f468dabb89 | ||
|
|
bb570e1b5c | ||
|
|
e57d7d5ad3 | ||
|
|
b3d3f77ba5 | ||
|
|
8abf823182 | ||
|
|
064a8fbe9a | ||
|
|
c43edd8549 | ||
|
|
eca5b79934 | ||
|
|
4e14a0d2c9 | ||
|
|
f38adb904f | ||
|
|
44aab3f525 | ||
|
|
1383f66726 | ||
|
|
715e21a420 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,5 @@
|
|||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
.vscode/tasks.json
|
.vscode/tasks.json
|
||||||
|
rhino.jar
|
||||||
|
update.sh
|
||||||
|
updateSharedSheets.js
|
||||||
22
README.md
22
README.md
@@ -14,11 +14,15 @@ A script to play Sheets generated by SkyStudio automatically in game Sky with ac
|
|||||||
* 自动更新,及时修复BUG,无需担心版本过时问题。
|
* 自动更新,及时修复BUG,无需担心版本过时问题。
|
||||||
* ...
|
* ...
|
||||||
|
|
||||||
## 使用
|
## 使用(Usage)
|
||||||
<br>①Auto.js`4.1.1 Alpha2 (461)`版本下载: [`Ericwyn/Auto.js/releases@V4.1.1.Alpha2`](https://github.com/Ericwyn/Auto.js/releases/tag/V4.1.1.Alpha2)
|
<br>①Auto.js`4.1.1 Alpha2 (461)`版本下载: [`Ericwyn/Auto.js/releases@V4.1.1.Alpha2`](https://github.com/Ericwyn/Auto.js/releases/tag/V4.1.1.Alpha2)
|
||||||
|
<br>Download `Auto.js`[`Ericwyn/Auto.js/releases@V4.1.1.Alpha2`](https://github.com/Ericwyn/Auto.js/releases/tag/V4.1.1.Alpha2)
|
||||||
<br>手机请下载`autoJs-V4.1.1.Alpha2-common-armeabi-v7a-debug.apk`
|
<br>手机请下载`autoJs-V4.1.1.Alpha2-common-armeabi-v7a-debug.apk`
|
||||||
|
<br>Please download `autoJs-V4.1.1.Alpha2-common-armeabi-v7a-debug.apk`
|
||||||
<br>②为Auto.js开启**无障碍服务**和**悬浮窗权限**。
|
<br>②为Auto.js开启**无障碍服务**和**悬浮窗权限**。
|
||||||
|
<br>Turn on **Accessibility service** and allow **Display pop-up window** permission for Auto.js
|
||||||
<br>③在Auto.js中新建一个脚本并粘贴以下代码并运行:
|
<br>③在Auto.js中新建一个脚本并粘贴以下代码并运行:
|
||||||
|
<br>Create a new script file in Auto.js. Copy the code below and run!
|
||||||
```javascript
|
```javascript
|
||||||
"ui";
|
"ui";
|
||||||
"use strict";
|
"use strict";
|
||||||
@@ -45,8 +49,10 @@ emitter.on('evaluate', function(s){
|
|||||||
|
|
||||||
在Auto.js版本`4.1.1 Alpha2 (461)`中测试通过,不保证其他版本的兼容性(取决于其他版本相对于此版本的API是否有`breaking changes`)
|
在Auto.js版本`4.1.1 Alpha2 (461)`中测试通过,不保证其他版本的兼容性(取决于其他版本相对于此版本的API是否有`breaking changes`)
|
||||||
|
|
||||||
## 清除数据
|
## 清除数据(Clear data)
|
||||||
SkyAutoPlayer在使用过程中会产生本地数据存储,若想全部删除,请使用Auto.js执行以下代码
|
`SkyAutoPlayerScript`在使用过程中会产生本地数据存储,若想全部删除,请使用Auto.js执行以下代码
|
||||||
|
<br>`SkyAutoPlayerScript` will store some data while using, if you want to delete all data, please run the code below in Auto.js
|
||||||
|
|
||||||
```
|
```
|
||||||
storages.remove("StageGuard:SkyAutoPlayer:Config");
|
storages.remove("StageGuard:SkyAutoPlayer:Config");
|
||||||
files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
|
files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
|
||||||
@@ -71,6 +77,8 @@ files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
|
|||||||
"bpm" : 320,
|
"bpm" : 320,
|
||||||
//暂时没用
|
//暂时没用
|
||||||
"suggested_instrument": 1,
|
"suggested_instrument": 1,
|
||||||
|
//乐谱键位数(8键或15键)
|
||||||
|
"keyCount": 15,
|
||||||
//乐谱音高
|
//乐谱音高
|
||||||
"pitchLevel": 0
|
"pitchLevel": 0
|
||||||
}
|
}
|
||||||
@@ -79,6 +87,8 @@ files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
|
|||||||
修改完成后,申请`Pull Request`,等待merge即可。
|
修改完成后,申请`Pull Request`,等待merge即可。
|
||||||
> 请注意:在申请`Pull Request`之前请确保你的SkyAutoPlayerScript仓库已同步至最新,以免出现意外问题!
|
> 请注意:在申请`Pull Request`之前请确保你的SkyAutoPlayerScript仓库已同步至最新,以免出现意外问题!
|
||||||
|
|
||||||
|
或通过发送乐谱到邮箱[beamiscool@qq.com](mailto:beamiscool@qq.com)
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
# 注意
|
# 注意
|
||||||
@@ -89,6 +99,7 @@ files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
|
|||||||
3. 本脚本仅可用作娱乐用途,请不要在正规场合使用本脚本(请自行体会\"正规场合\"是什么意思),若因使用本脚本所出现了一些不友好的问题,与脚本作者StageGuard无关。
|
3. 本脚本仅可用作娱乐用途,请不要在正规场合使用本脚本(请自行体会\"正规场合\"是什么意思),若因使用本脚本所出现了一些不友好的问题,与脚本作者StageGuard无关。
|
||||||
4. 脚本只能给你一时满足感而不能使你进步,请适当使用,只有真正的技术才是王道,才能使你感到快乐。
|
4. 脚本只能给你一时满足感而不能使你进步,请适当使用,只有真正的技术才是王道,才能使你感到快乐。
|
||||||
5. 本脚本只是一个"弹奏机",并不内置曲谱,请在GooglePlay下载[SkyStudio](https://play.google.com/store/apps/details?id=com.Maple.SkyStudio)编谱。
|
5. 本脚本只是一个"弹奏机",并不内置曲谱,请在GooglePlay下载[SkyStudio](https://play.google.com/store/apps/details?id=com.Maple.SkyStudio)编谱。
|
||||||
|
6. 本脚本不会增加解密乐谱功能,包括但不限于**加密的SkyStudio乐谱**,**加密的JS**等,也不接受加密乐谱的共享。
|
||||||
|
|
||||||
# 贡献
|
# 贡献
|
||||||
欢迎任何人贡献本项目,包括但不限于Pull Request,Issue,New feature request
|
欢迎任何人贡献本项目,包括但不限于Pull Request,Issue,New feature request
|
||||||
@@ -109,8 +120,9 @@ files.removeDir("/storage/emulated/0/Documents/SkyAutoPlayer/");
|
|||||||
酷安[@社区最弱萌新](http://www.coolapk.com/u/3291313)<br>
|
酷安[@社区最弱萌新](http://www.coolapk.com/u/3291313)<br>
|
||||||
酷安[@九方辰](http://www.coolapk.com/u/634078)<br>
|
酷安[@九方辰](http://www.coolapk.com/u/634078)<br>
|
||||||
酷安[@北极马可罗尼](http://www.coolapk.com/u/463478)<br>
|
酷安[@北极马可罗尼](http://www.coolapk.com/u/463478)<br>
|
||||||
酷安[@UTF16](http://www.coolapk.com/u/3751911)<br>
|
哔哩哔哩[@UTF16](https://space.bilibili.com/623364258)<br>
|
||||||
酷安[@]()<br>
|
酷安[@Syngenex](http://www.coolapk.com/u/1093421)<br>
|
||||||
|
Twitter[Phoebe@huunhut1217](https://mobile.twitter.com/huunhut1217)<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
# 图标来源
|
# 图标来源
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
13979f81ae3a4e415446100d56b9499592d89b8d
|
dbb262716e0bf7f84b015a55dc9d02af1717a1ab
|
||||||
BIN
resources/clock.png
Normal file
BIN
resources/clock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
BIN
resources/note.png
Normal file
BIN
resources/note.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
BIN
resources/piano.png
Normal file
BIN
resources/piano.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
resources/user.png
Normal file
BIN
resources/user.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
File diff suppressed because it is too large
Load Diff
BIN
shared_sheets/Co_Chac_Yeu_La_Day-MTP.txt
Normal file
BIN
shared_sheets/Co_Chac_Yeu_La_Day-MTP.txt
Normal file
Binary file not shown.
BIN
shared_sheets/Dream_It_Possible.txt
Normal file
BIN
shared_sheets/Dream_It_Possible.txt
Normal file
Binary file not shown.
BIN
shared_sheets/Hanava.txt
Normal file
BIN
shared_sheets/Hanava.txt
Normal file
Binary file not shown.
BIN
shared_sheets/Love_5.txt
Normal file
BIN
shared_sheets/Love_5.txt
Normal file
Binary file not shown.
BIN
shared_sheets/Mojito.txt
Normal file
BIN
shared_sheets/Mojito.txt
Normal file
Binary file not shown.
BIN
shared_sheets/See_You_Again_(Stb).txt
Normal file
BIN
shared_sheets/See_You_Again_(Stb).txt
Normal file
Binary file not shown.
BIN
shared_sheets/Summertime.txt
Normal file
BIN
shared_sheets/Summertime.txt
Normal file
Binary file not shown.
BIN
shared_sheets/下雨天.txt
Normal file
BIN
shared_sheets/下雨天.txt
Normal file
Binary file not shown.
BIN
shared_sheets/不知所措.txt
Normal file
BIN
shared_sheets/不知所措.txt
Normal file
Binary file not shown.
BIN
shared_sheets/体面.txt
Normal file
BIN
shared_sheets/体面.txt
Normal file
Binary file not shown.
BIN
shared_sheets/微微.txt
Normal file
BIN
shared_sheets/微微.txt
Normal file
Binary file not shown.
BIN
shared_sheets/恋爱循环.txt
Normal file
BIN
shared_sheets/恋爱循环.txt
Normal file
Binary file not shown.
BIN
shared_sheets/演员.txt
Normal file
BIN
shared_sheets/演员.txt
Normal file
Binary file not shown.
BIN
shared_sheets/童话镇.txt
Normal file
BIN
shared_sheets/童话镇.txt
Normal file
Binary file not shown.
BIN
shared_sheets/菊次郎的夏天(夏卡重制版).txt
Normal file
BIN
shared_sheets/菊次郎的夏天(夏卡重制版).txt
Normal file
Binary file not shown.
BIN
shared_sheets/走马.txt
Normal file
BIN
shared_sheets/走马.txt
Normal file
Binary file not shown.
BIN
shared_sheets/追光者.txt
Normal file
BIN
shared_sheets/追光者.txt
Normal file
Binary file not shown.
BIN
shared_sheets/那女孩对我说.txt
Normal file
BIN
shared_sheets/那女孩对我说.txt
Normal file
Binary file not shown.
@@ -31,7 +31,9 @@ const user_agreements =
|
|||||||
"1. SkyAutoPlayer(以下简称\"本脚本\")是完全免费且开源的软件/脚本(https://github.com/StageGuard/SkyAutoPlayerScript),禁止使用本脚本作为盈利用途!\n若你是从其他渠道购买获得的本脚本,那么就说明你被骗了!\n\n" +
|
"1. SkyAutoPlayer(以下简称\"本脚本\")是完全免费且开源的软件/脚本(https://github.com/StageGuard/SkyAutoPlayerScript),禁止使用本脚本作为盈利用途!\n若你是从其他渠道购买获得的本脚本,那么就说明你被骗了!\n\n" +
|
||||||
"2. 本脚本仅可用作娱乐用途,请不要在正规场合使用本脚本(请自行体会\"正规场合\"是什么意思),若因使用本脚本所出现了一些不友好的问题,与脚本作者StageGuard(以下简称\"作者\")无关。\n\n" +
|
"2. 本脚本仅可用作娱乐用途,请不要在正规场合使用本脚本(请自行体会\"正规场合\"是什么意思),若因使用本脚本所出现了一些不友好的问题,与脚本作者StageGuard(以下简称\"作者\")无关。\n\n" +
|
||||||
"3. 脚本只能给你一时满足感而不能使你进步,请适当使用,只有真正的技术才是王道,才能使你感到快乐。\n\n" +
|
"3. 脚本只能给你一时满足感而不能使你进步,请适当使用,只有真正的技术才是王道,才能使你感到快乐。\n\n" +
|
||||||
"4. 本脚本的发行遵守GPLv3协议,若你不了解协议内容,请访问 https://www.gnu.org/licenses 查看"
|
"4. 本脚本只是一个\"弹奏机\",并不内置曲谱,请在GooglePlay下载SkyStudio编谱。\n\n" +
|
||||||
|
"5. 本脚本不会增加解密乐谱功能,包括但不限于加密的SkyStudio乐谱,加密的JS等,也不接受加密乐谱的共享。\n\n" +
|
||||||
|
"6. 本脚本的发行遵守GPLv3协议,若你不了解协议内容,请访问 https://www.gnu.org/licenses 查看"
|
||||||
;
|
;
|
||||||
|
|
||||||
//Script global scope
|
//Script global scope
|
||||||
@@ -88,7 +90,7 @@ sheetmgr = {
|
|||||||
return resultList;
|
return resultList;
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadAndLoad: function(file, author, listener) {
|
downloadAndLoad: function(file, extraData, listener) {
|
||||||
listener({status:1});
|
listener({status:1});
|
||||||
config.fetchRepoFile("shared_sheets/" + file, null, function(body) {
|
config.fetchRepoFile("shared_sheets/" + file, null, function(body) {
|
||||||
var sheet = files.join(sheetmgr.rootDir, files.getNameWithoutExtension(file) + (function(length) {
|
var sheet = files.join(sheetmgr.rootDir, files.getNameWithoutExtension(file) + (function(length) {
|
||||||
@@ -103,7 +105,8 @@ sheetmgr = {
|
|||||||
files.write(sheet, parsed = (function() {
|
files.write(sheet, parsed = (function() {
|
||||||
var data = eval(body.string())[0];
|
var data = eval(body.string())[0];
|
||||||
listener({status:2});
|
listener({status:2});
|
||||||
data.author = author;
|
data.author = extraData.author;
|
||||||
|
data.keyCount = extraData.keyCount;
|
||||||
return "[" + JSON.stringify(data) + "]";
|
return "[" + JSON.stringify(data) + "]";
|
||||||
}()), sheetmgr.encoding);
|
}()), sheetmgr.encoding);
|
||||||
parsed = eval(parsed)[0];
|
parsed = eval(parsed)[0];
|
||||||
@@ -219,6 +222,8 @@ sheetplayer = {
|
|||||||
playing: false,
|
playing: false,
|
||||||
nextInterval: 0,
|
nextInterval: 0,
|
||||||
|
|
||||||
|
keyCount: 15,
|
||||||
|
|
||||||
speed: 1,
|
speed: 1,
|
||||||
current_speed_index: 9,
|
current_speed_index: 9,
|
||||||
speed_list: [
|
speed_list: [
|
||||||
@@ -259,11 +264,8 @@ sheetplayer = {
|
|||||||
run: function() {
|
run: function() {
|
||||||
var gestureMap = [];
|
var gestureMap = [];
|
||||||
sheetplayer.notes[sheetplayer.currentNote].keys.map(function(e, i) {
|
sheetplayer.notes[sheetplayer.currentNote].keys.map(function(e, i) {
|
||||||
gestureMap.push([
|
var keyCoordinates = sheetplayer.keyCount == 15 ? [config.values.key_coordinates15[e][0], config.values.key_coordinates15[e][1]] : [config.values.key_coordinates8[e][0], config.values.key_coordinates8[e][1]];
|
||||||
0, 25,
|
gestureMap.push([0, 25, keyCoordinates, keyCoordinates]);
|
||||||
[config.values.key_coordinates[e][0], config.values.key_coordinates[e][1]],
|
|
||||||
[config.values.key_coordinates[e][0], config.values.key_coordinates[e][1]]
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
gestureMap = sheetplayer.toSource(gestureMap);
|
gestureMap = sheetplayer.toSource(gestureMap);
|
||||||
eval("gestures(" + gestureMap.slice(1, gestureMap.length - 1) + ");");
|
eval("gestures(" + gestureMap.slice(1, gestureMap.length - 1) + ");");
|
||||||
@@ -317,6 +319,7 @@ sheetplayer = {
|
|||||||
this.pitch = j.pitchLevel;
|
this.pitch = j.pitchLevel;
|
||||||
this.bpm = j.bpm;
|
this.bpm = j.bpm;
|
||||||
this.noteCount = this.notes.length;
|
this.noteCount = this.notes.length;
|
||||||
|
this.keyCount = j.keyCount;
|
||||||
},
|
},
|
||||||
|
|
||||||
toSource: function(obj) {
|
toSource: function(obj) {
|
||||||
@@ -342,16 +345,18 @@ config = {
|
|||||||
_global_storage: null,
|
_global_storage: null,
|
||||||
|
|
||||||
values: {
|
values: {
|
||||||
key_coordinates: [],
|
key_coordinates15: [],
|
||||||
|
key_coordinates8: [],
|
||||||
skipRunScriptTip: false,
|
skipRunScriptTip: false,
|
||||||
skipOpenWindowTip: false,
|
skipOpenWindowTip: false,
|
||||||
skipOpenPlayerPanelWindowTip: false,
|
skipOpenPlayerPanelWindowTip: false,
|
||||||
skipOnlineUploadTip: false,
|
skipOnlineUploadTip: false,
|
||||||
skipOnlineSharedSheetCTip: false,
|
skipOnlineSharedSheetCTip: false,
|
||||||
skipImportLocalSheetTip: false,
|
skipImportLocalSheetTip: false,
|
||||||
|
skipChangeKeyCountTip: false,
|
||||||
showFailedSheets: true,
|
showFailedSheets: true,
|
||||||
tipOnAndroidR: true,
|
tipOnAndroidR: true,
|
||||||
currentVersion: 14,
|
currentVersion: 16,
|
||||||
gitVersion: "",
|
gitVersion: "",
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -360,13 +365,15 @@ config = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
this._global_storage = storages.create("StageGuard:SkyAutoPlayer:Config");
|
this._global_storage = storages.create("StageGuard:SkyAutoPlayer:Config");
|
||||||
|
|
||||||
this.values.key_coordinates = this._global_storage.get("key_coordinates", this.values.key_coordinates);
|
this.values.key_coordinates15 = this._global_storage.get("key_coordinates15", this.values.key_coordinates15);
|
||||||
|
this.values.key_coordinates8 = this._global_storage.get("key_coordinates8", this.values.key_coordinates8);
|
||||||
this.values.skipRunScriptTip = this._global_storage.get("skip_run_script_tip", this.values.skipRunScriptTip);
|
this.values.skipRunScriptTip = this._global_storage.get("skip_run_script_tip", this.values.skipRunScriptTip);
|
||||||
this.values.skipOpenWindowTip = this._global_storage.get("skip_open_window_tip", this.values.skipOpenWindowTip);
|
this.values.skipOpenWindowTip = this._global_storage.get("skip_open_window_tip", this.values.skipOpenWindowTip);
|
||||||
this.values.skipOpenPlayerPanelWindowTip = this._global_storage.get("skip_open_player_panel_window_tip", this.values.skipOpenPlayerPanelWindowTip);
|
this.values.skipOpenPlayerPanelWindowTip = this._global_storage.get("skip_open_player_panel_window_tip", this.values.skipOpenPlayerPanelWindowTip);
|
||||||
this.values.skipOnlineUploadTip = this._global_storage.get("skip_online_upload_tip", this.values.skipOnlineUploadTip);
|
this.values.skipOnlineUploadTip = this._global_storage.get("skip_online_upload_tip", this.values.skipOnlineUploadTip);
|
||||||
this.values.skipOnlineSharedSheetCTip = this._global_storage.get("skip_shared_sheet_c_tip", this.values.skipOnlineSharedSheetCTip);
|
this.values.skipOnlineSharedSheetCTip = this._global_storage.get("skip_shared_sheet_c_tip", this.values.skipOnlineSharedSheetCTip);
|
||||||
this.values.skipImportLocalSheetTip = this._global_storage.get("skip_import_local_sheet_tip", this.values.skipImportLocalSheetTip);
|
this.values.skipImportLocalSheetTip = this._global_storage.get("skip_import_local_sheet_tip", this.values.skipImportLocalSheetTip);
|
||||||
|
this.values.skipChangeKeyCountTip = this._global_storage.get("skip_change_key_count_tip", this.values.skipChangeKeyCountTip);
|
||||||
this.values.showFailedSheets = this._global_storage.get("show_failed_sheets", this.values.showFailedSheets);
|
this.values.showFailedSheets = this._global_storage.get("show_failed_sheets", this.values.showFailedSheets);
|
||||||
this.values.tipOnAndroidR = this._global_storage.get("tip_storage_on_android_r", this.values.tipOnAndroidR);
|
this.values.tipOnAndroidR = this._global_storage.get("tip_storage_on_android_r", this.values.tipOnAndroidR);
|
||||||
|
|
||||||
@@ -407,7 +414,7 @@ config = {
|
|||||||
|
|
||||||
fetchResources: function(listener) {
|
fetchResources: function(listener) {
|
||||||
var remoteHost = "https://cdn.jsdelivr.net/gh/StageGuard/SkyAutoPlayerScript@" + this.values.gitVersion + "/resources/";
|
var remoteHost = "https://cdn.jsdelivr.net/gh/StageGuard/SkyAutoPlayerScript@" + this.values.gitVersion + "/resources/";
|
||||||
var resourceList = ["local.png", "online.png", "play.png", "pause.png", "refresh.png", "settings.png", "info.png", "download.png", "bin.png", "speedup.png", "search.png"/*, "filter.png"*/];
|
var resourceList = ["local.png", "online.png", "play.png", "pause.png", "refresh.png", "settings.png", "info.png", "download.png", "bin.png", "speedup.png", "search.png", "note.png", "user.png", "piano.png", "clock.png"/*, "filter.png"*/];
|
||||||
var localRootDir = android.os.Environment.getExternalStorageDirectory() + "/Documents/SkyAutoPlayer/bitmaps/";
|
var localRootDir = android.os.Environment.getExternalStorageDirectory() + "/Documents/SkyAutoPlayer/bitmaps/";
|
||||||
var downloadQueue = [];
|
var downloadQueue = [];
|
||||||
var tryCount = 1;
|
var tryCount = 1;
|
||||||
@@ -713,8 +720,8 @@ gui = {
|
|||||||
config: {
|
config: {
|
||||||
colors: {
|
colors: {
|
||||||
background: android.graphics.Color.parseColor("#212121"),
|
background: android.graphics.Color.parseColor("#212121"),
|
||||||
text: android.graphics.Color.WHITE,
|
text: android.graphics.Color.parseColor("#FFFFFF"),
|
||||||
dark_text: android.graphics.Color.BLACK,
|
dark_text: android.graphics.Color.parseColor("#000000"),
|
||||||
sec_text: android.graphics.Color.parseColor("#7B7B7B"),
|
sec_text: android.graphics.Color.parseColor("#7B7B7B"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -748,7 +755,7 @@ gui = {
|
|||||||
if (customshape == "roundrect") gradientDrawable.setCornerRadius(arguments[3]);
|
if (customshape == "roundrect") gradientDrawable.setCornerRadius(arguments[3]);
|
||||||
gradientDrawable.setStroke(dp * 10, android.graphics.Color.TRANSPARENT);
|
gradientDrawable.setStroke(dp * 10, android.graphics.Color.TRANSPARENT);
|
||||||
return new android.graphics.drawable.RippleDrawable(android.content.res.ColorStateList.valueOf(android.graphics.Color.argb(1, 0, 0, 0)), gradientDrawable, mask);
|
return new android.graphics.drawable.RippleDrawable(android.content.res.ColorStateList.valueOf(android.graphics.Color.argb(1, 0, 0, 0)), gradientDrawable, mask);
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
dialogs: {
|
dialogs: {
|
||||||
@@ -1023,6 +1030,25 @@ gui = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
vmaker: {},
|
||||||
|
|
||||||
|
addViewMaker: function(name, vmaker) {
|
||||||
|
if(!this.vmaker[name]) {
|
||||||
|
this.vmaker[name] = vmaker;
|
||||||
|
} else {
|
||||||
|
error("ViewMaker " + name + " already exists.");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getViewMaker: function(name) {
|
||||||
|
if(this.vmaker[name]) {
|
||||||
|
return this.vmaker[name];
|
||||||
|
} else {
|
||||||
|
error("ViewMaker " + name + " doesn't exist.");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
main: {
|
main: {
|
||||||
|
|
||||||
//window
|
//window
|
||||||
@@ -1312,7 +1338,6 @@ gui = {
|
|||||||
var view = new android.widget.ImageView(ctx);
|
var view = new android.widget.ImageView(ctx);
|
||||||
view.setId(++s.baseFuncIndex);
|
view.setId(++s.baseFuncIndex);
|
||||||
view.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * gui.main.status_bar_height, dp * gui.main.status_bar_height));
|
view.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * gui.main.status_bar_height, dp * gui.main.status_bar_height));
|
||||||
view.setPadding(dp * 1, dp * 1, dp * 1, dp * 1);
|
|
||||||
view.getLayoutParams().addRule(android.widget.RelativeLayout.LEFT_OF, s.baseFuncIndex - 1);
|
view.getLayoutParams().addRule(android.widget.RelativeLayout.LEFT_OF, s.baseFuncIndex - 1);
|
||||||
view.measure(0, 0);
|
view.measure(0, 0);
|
||||||
view.setBackgroundDrawable(gui.utils.ripple_drawable(view.getMeasuredWidth(), view.getMeasuredHeight(), "rect"));
|
view.setBackgroundDrawable(gui.utils.ripple_drawable(view.getMeasuredWidth(), view.getMeasuredHeight(), "rect"));
|
||||||
@@ -1515,7 +1540,7 @@ gui = {
|
|||||||
|
|
||||||
current_index: 0,
|
current_index: 0,
|
||||||
|
|
||||||
__internal_showTargetDots: function s() { gui.run(function(){
|
__internal_showTargetDots: function s(keyTargetedCbk, finishCbk) { gui.run(function(){
|
||||||
if(!gui.key_coordinate_navigation.isShowing) {
|
if(!gui.key_coordinate_navigation.isShowing) {
|
||||||
gui.key_coordinate_navigation._global_base = new android.widget.TextView(ctx);
|
gui.key_coordinate_navigation._global_base = new android.widget.TextView(ctx);
|
||||||
gui.key_coordinate_navigation._global_base.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
gui.key_coordinate_navigation._global_base.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
||||||
@@ -1537,7 +1562,7 @@ gui = {
|
|||||||
break;
|
break;
|
||||||
case event.ACTION_UP:
|
case event.ACTION_UP:
|
||||||
gui.key_coordinate_navigation._global_text.setText("键" + (gui.key_coordinate_navigation.current_index + 1) + "坐标已设置: [" + event.getRawX() + ", " + event.getRawY() + "]");
|
gui.key_coordinate_navigation._global_text.setText("键" + (gui.key_coordinate_navigation.current_index + 1) + "坐标已设置: [" + event.getRawX() + ", " + event.getRawY() + "]");
|
||||||
config.values.key_coordinates.push([event.getRawX(), event.getRawY()])
|
keyTargetedCbk([event.getRawX(), event.getRawY()]);
|
||||||
gui.utils.value_animation("Float", 1, 0, 200 , new android.view.animation.DecelerateInterpolator(), function(anim) {
|
gui.utils.value_animation("Float", 1, 0, 200 , new android.view.animation.DecelerateInterpolator(), function(anim) {
|
||||||
gui.key_coordinate_navigation._global_base.setAlpha(anim.getAnimatedValue());
|
gui.key_coordinate_navigation._global_base.setAlpha(anim.getAnimatedValue());
|
||||||
gui.key_coordinate_navigation._global_text.setAlpha(1 - anim.getAnimatedValue());
|
gui.key_coordinate_navigation._global_text.setAlpha(1 - anim.getAnimatedValue());
|
||||||
@@ -1546,19 +1571,16 @@ gui = {
|
|||||||
gui.key_coordinate_navigation.isShowing = false;
|
gui.key_coordinate_navigation.isShowing = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
threads.start(function() {
|
var handler = new android.os.Handler();
|
||||||
java.lang.Thread.currentThread().sleep(1000);
|
handler.postDelayed(function() {
|
||||||
gui.run(function() {
|
if(++gui.key_coordinate_navigation.current_index < gui.key_coordinate_navigation.total) {
|
||||||
if(++gui.key_coordinate_navigation.current_index < 15) {
|
gui.key_coordinate_navigation.__internal_showTargetDots(keyTargetedCbk, finishCbk);
|
||||||
gui.key_coordinate_navigation.__internal_showTargetDots(gui.key_coordinate_navigation.current_index);
|
|
||||||
} else {
|
} else {
|
||||||
config.save("key_coordinates");
|
finishCbk();
|
||||||
toast("坐标设置已保存至存储!\n");
|
|
||||||
gui.key_coordinate_navigation.__internal_dismissText();
|
gui.key_coordinate_navigation.__internal_dismissText();
|
||||||
gui.main.show(2);
|
gui.main.show(2);
|
||||||
}
|
}
|
||||||
});
|
}, 1000);
|
||||||
});
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1628,11 +1650,11 @@ gui = {
|
|||||||
}
|
}
|
||||||
})},
|
})},
|
||||||
|
|
||||||
show: function() {
|
show: function(keyCount, keyTargetedCbk, finishCbk) {
|
||||||
config.values.key_coordinates.length = 0;
|
|
||||||
gui.key_coordinate_navigation.current_index = 0;
|
gui.key_coordinate_navigation.current_index = 0;
|
||||||
|
gui.key_coordinate_navigation.total = keyCount ? keyCount : 15;
|
||||||
this.__internal_showTips();
|
this.__internal_showTips();
|
||||||
this.__internal_showTargetDots();
|
this.__internal_showTargetDots(keyTargetedCbk, finishCbk);
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -2006,6 +2028,165 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
o.setText(msg);
|
o.setText(msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
gui.addViewMaker("sheetInfo", function(item) {
|
||||||
|
var scr = new android.widget.ScrollView(ctx);
|
||||||
|
scr.setBackgroundColor(gui.config.colors.background);
|
||||||
|
var layout = new android.widget.LinearLayout(ctx);
|
||||||
|
layout.setLayoutParams(new android.widget.FrameLayout.LayoutParams(-2, -2));
|
||||||
|
layout.setOrientation(android.widget.LinearLayout.VERTICAL);
|
||||||
|
layout.setPadding(15 * dp, 15 * dp, 15 * dp, 15 * dp);
|
||||||
|
var title = new android.widget.TextView(ctx);
|
||||||
|
title.setText(item.name);
|
||||||
|
title.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
||||||
|
title.setPadding(0, 0, 0, 10 * dp);
|
||||||
|
title.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
|
||||||
|
title.setTextColor(gui.config.colors.text);
|
||||||
|
title.setTextSize(20);
|
||||||
|
title.getLayoutParams().setMargins(0, 0, 0, 7.5 * dp);
|
||||||
|
layout.addView(title);
|
||||||
|
var infoLayout = new android.widget.RelativeLayout(ctx);
|
||||||
|
infoLayout.setLayoutParams(new android.widget.FrameLayout.LayoutParams(-2, -2));
|
||||||
|
infoLayout.setPadding(10 * dp, 10 * dp, 10 * dp, 10 * dp);
|
||||||
|
var authorImg = new android.widget.ImageView(ctx);
|
||||||
|
authorImg.setId(10);
|
||||||
|
authorImg.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * 38, dp * 38));
|
||||||
|
authorImg.measure(0, 0);
|
||||||
|
authorImg.setPadding(dp * 5, dp * 5, dp * 5, dp * 5);
|
||||||
|
authorImg.setImageBitmap(config.bitmaps.user);
|
||||||
|
authorImg.getLayoutParams().setMargins(0, 0, dp * 7.5, dp * 5);
|
||||||
|
var authorText = new android.widget.TextView(ctx);
|
||||||
|
authorText.setId(11);
|
||||||
|
authorText.setText(android.text.Html.fromHtml((item.author.length == 0 ? "<font color=#7B7B7B>Not Provided</font>" : item.author)));
|
||||||
|
authorText.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-2, dp * 38));
|
||||||
|
authorText.getLayoutParams().addRule(android.widget.RelativeLayout.RIGHT_OF, 10);
|
||||||
|
authorText.setPadding(0, 0, 0, 0);
|
||||||
|
authorText.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
|
||||||
|
authorText.setTextColor(gui.config.colors.text);
|
||||||
|
authorText.setTextSize(16);
|
||||||
|
authorText.getLayoutParams().setMargins(dp * 7.5, 0, 0, dp * 5);
|
||||||
|
var noteImg = new android.widget.ImageView(ctx);
|
||||||
|
noteImg.setId(12);
|
||||||
|
noteImg.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * 38, dp * 38));
|
||||||
|
noteImg.getLayoutParams().addRule(android.widget.RelativeLayout.BELOW, 10);
|
||||||
|
noteImg.measure(0, 0);
|
||||||
|
noteImg.setPadding(dp * 5, dp * 5, dp * 5, dp * 5);
|
||||||
|
noteImg.setImageBitmap(config.bitmaps.piano);
|
||||||
|
noteImg.getLayoutParams().setMargins(0, dp * 5, dp * 7.5, dp * 5);
|
||||||
|
var noteText = new android.widget.TextView(ctx);
|
||||||
|
noteText.setId(13);
|
||||||
|
noteText.setText((item.noteCount ? item.noteCount : item.songNotes.length) + " notes");
|
||||||
|
noteText.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-2, dp * 38));
|
||||||
|
noteText.getLayoutParams().addRule(android.widget.RelativeLayout.RIGHT_OF, 12);
|
||||||
|
noteText.getLayoutParams().addRule(android.widget.RelativeLayout.BELOW, 11);
|
||||||
|
noteText.setPadding(0, 0, 0, 0);
|
||||||
|
noteText.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
|
||||||
|
noteText.setTextColor(gui.config.colors.text);
|
||||||
|
noteText.setTextSize(16);
|
||||||
|
noteText.getLayoutParams().setMargins(dp * 7.5, dp * 5, 0, dp * 5);
|
||||||
|
var pitchImg = new android.widget.ImageView(ctx);
|
||||||
|
pitchImg.setId(14);
|
||||||
|
pitchImg.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * 38, dp * 38));
|
||||||
|
pitchImg.getLayoutParams().addRule(android.widget.RelativeLayout.BELOW, 12);
|
||||||
|
pitchImg.measure(0, 0);
|
||||||
|
pitchImg.setPadding(dp * 5, dp * 5, dp * 5, dp * 5);
|
||||||
|
pitchImg.setImageBitmap(config.bitmaps.note);
|
||||||
|
pitchImg.getLayoutParams().setMargins(0, dp * 5, dp * 7.5, dp * 5);
|
||||||
|
var pitchText = new android.widget.TextView(ctx);
|
||||||
|
pitchText.setId(15);
|
||||||
|
pitchText.setText(android.text.Html.fromHtml((function(){
|
||||||
|
var r = "<font color=";
|
||||||
|
switch(item.pitchLevel) {
|
||||||
|
case 0: r += "#FF6100";break;
|
||||||
|
case 1: r += "#FF9200";break;
|
||||||
|
case 2: r += "#FFC600";break;
|
||||||
|
case 3: r += "#FFFF00";break;
|
||||||
|
case 4: r += "#8CC619";break;
|
||||||
|
case 5: r += "#00815A";break;
|
||||||
|
case 6: r += "#0096B5";break;
|
||||||
|
case 7: r += "#2971B5";break;
|
||||||
|
case 8: r += "#424DA4";break;
|
||||||
|
case 9: r += "#6B3594";break;
|
||||||
|
case 10: r += "#C5047B";break;
|
||||||
|
case 11: r += "#FF0000";break;
|
||||||
|
}
|
||||||
|
r += (">" + sheetmgr.pitch_suggestion[item.pitchLevel].name + "</font>");
|
||||||
|
return r;
|
||||||
|
}())));
|
||||||
|
pitchText.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-2, dp * 38));
|
||||||
|
pitchText.getLayoutParams().addRule(android.widget.RelativeLayout.RIGHT_OF, 14);
|
||||||
|
pitchText.getLayoutParams().addRule(android.widget.RelativeLayout.BELOW, 13);
|
||||||
|
pitchText.setPadding(0, 0, 0, 0);
|
||||||
|
pitchText.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
|
||||||
|
pitchText.setTextColor(gui.config.colors.text);
|
||||||
|
pitchText.setTextSize(16);
|
||||||
|
pitchText.getLayoutParams().setMargins(dp * 7.5, dp * 5, 0, dp * 5);
|
||||||
|
infoLayout.addView(authorImg);
|
||||||
|
infoLayout.addView(authorText);
|
||||||
|
infoLayout.addView(noteImg);
|
||||||
|
infoLayout.addView(noteText);
|
||||||
|
infoLayout.addView(pitchImg);
|
||||||
|
infoLayout.addView(pitchText);
|
||||||
|
if(item.songNotes) {
|
||||||
|
var timeImg = new android.widget.ImageView(ctx);
|
||||||
|
timeImg.setId(16);
|
||||||
|
timeImg.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(dp * 38, dp * 38));
|
||||||
|
timeImg.getLayoutParams().addRule(android.widget.RelativeLayout.BELOW, 14);
|
||||||
|
timeImg.measure(0, 0);
|
||||||
|
timeImg.setPadding(dp * 5, dp * 5, dp * 5, dp * 5);
|
||||||
|
timeImg.setImageBitmap(config.bitmaps.clock);
|
||||||
|
timeImg.getLayoutParams().setMargins(0, dp * 5, dp * 7.5, 0);
|
||||||
|
var timeText = new android.widget.TextView(ctx);
|
||||||
|
timeText.setId(17);
|
||||||
|
timeText.setText((function(){
|
||||||
|
var time_ms = item.songNotes[item.songNotes.length - 1].time;
|
||||||
|
var second_s = Math.floor(time_ms / 1000);
|
||||||
|
|
||||||
|
var millis = time_ms - second_s * 1000;
|
||||||
|
var minute = Math.floor(second_s / 60);
|
||||||
|
var second = second_s - minute * 60;
|
||||||
|
|
||||||
|
return minute + ":" + second + "." + millis;
|
||||||
|
}()));
|
||||||
|
timeText.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(-2, dp * 38));
|
||||||
|
timeText.getLayoutParams().addRule(android.widget.RelativeLayout.RIGHT_OF, 16);
|
||||||
|
timeText.getLayoutParams().addRule(android.widget.RelativeLayout.BELOW, 15);
|
||||||
|
timeText.setPadding(0, 0, 0, 0);
|
||||||
|
timeText.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
|
||||||
|
timeText.setTextColor(gui.config.colors.text);
|
||||||
|
timeText.setTextSize(16);
|
||||||
|
timeText.getLayoutParams().setMargins(dp * 7.5, dp * 5, 0, 0);
|
||||||
|
infoLayout.addView(timeImg);
|
||||||
|
infoLayout.addView(timeText);
|
||||||
|
}
|
||||||
|
infoLayout.measure(0, 0);
|
||||||
|
layout.addView(infoLayout);
|
||||||
|
|
||||||
|
var sugPrompt = new android.widget.TextView(ctx);
|
||||||
|
sugPrompt.setText("建议弹奏地点:");
|
||||||
|
sugPrompt.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
||||||
|
sugPrompt.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
|
||||||
|
sugPrompt.setTextColor(gui.config.colors.text);
|
||||||
|
sugPrompt.setTextSize(16);
|
||||||
|
sugPrompt.getLayoutParams().setMargins(0, 5 * dp, 0, 5 * dp);
|
||||||
|
layout.addView(sugPrompt);
|
||||||
|
|
||||||
|
var sug = new android.widget.TextView(ctx);
|
||||||
|
sug.setText((function(){
|
||||||
|
var r = "";
|
||||||
|
sheetmgr.pitch_suggestion[item.pitchLevel].places.map(function(e, i) {
|
||||||
|
r += ((i == 0 ? "" : "\n") + "• " + e)
|
||||||
|
});
|
||||||
|
return r;
|
||||||
|
}()));
|
||||||
|
sug.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
||||||
|
sug.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER);
|
||||||
|
sug.setTextColor(gui.config.colors.sec_text);
|
||||||
|
sug.setTextSize(15);
|
||||||
|
sug.getLayoutParams().setMargins(7 * dp, 5 * dp, 0, 0);
|
||||||
|
layout.addView(sug);
|
||||||
|
scr.addView(layout);
|
||||||
|
return scr;
|
||||||
|
});
|
||||||
gui.main.addPage({
|
gui.main.addPage({
|
||||||
index: 0,
|
index: 0,
|
||||||
title: "本地乐谱",
|
title: "本地乐谱",
|
||||||
@@ -2088,18 +2269,47 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
element.v_play.setBackgroundDrawable(gui.utils.ripple_drawable(element.v_play.getMeasuredWidth(), element.v_play.getMeasuredHeight(), "rect"));
|
element.v_play.setBackgroundDrawable(gui.utils.ripple_drawable(element.v_play.getMeasuredWidth(), element.v_play.getMeasuredHeight(), "rect"));
|
||||||
element.v_play.setOnClickListener(new android.view.View.OnClickListener({
|
element.v_play.setOnClickListener(new android.view.View.OnClickListener({
|
||||||
onClick: function() {
|
onClick: function() {
|
||||||
if(config.values.key_coordinates.length == 15 && gui.main.isShowing) {
|
if(gui.main.isShowing) {
|
||||||
|
if(!element.keyCount) {
|
||||||
|
gui.dialogs.showConfirmDialog({
|
||||||
|
title: "设置键位数",
|
||||||
|
text: "这是一个本地乐谱,请设置这个乐谱的键位数",
|
||||||
|
canExit: true,
|
||||||
|
buttons: ["8 键位", "15 键位"],
|
||||||
|
callback: function(id) {
|
||||||
|
files.write(files.join(sheetmgr.rootDir, element.fileName), (function() {
|
||||||
|
var readable = files.open(files.join(sheetmgr.rootDir, element.fileName), "r", sheetmgr.encoding);
|
||||||
|
var parsed = eval(readable.read())[0];
|
||||||
|
readable.close();
|
||||||
|
parsed.keyCount = id == 0 ? (element.keyCount = 8) : (element.keyCount = 15)
|
||||||
|
return "[" + JSON.stringify(parsed) + "]";
|
||||||
|
}()), sheetmgr.encoding);
|
||||||
|
toast("已将 " + element.name + " 设置为 " + element.keyCount + " 键乐谱\n请再次点击弹奏按钮。\n长按乐谱以重新设置键位数。");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
switch(element.keyCount) {
|
||||||
|
case 8: {
|
||||||
|
if(config.values.key_coordinates8.length != 8) {
|
||||||
|
toast("未设置8键键位坐标或坐标数据错误,请前往设置页设置键位坐标");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};break;
|
||||||
|
case 15: {
|
||||||
|
if(config.values.key_coordinates15.length != 15) {
|
||||||
|
toast("未设置15键键位坐标或坐标数据错误,请前往设置页设置键位坐标");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};break;
|
||||||
|
}
|
||||||
gui.main.__internal_dismiss();
|
gui.main.__internal_dismiss();
|
||||||
gui.player_panel.__internal_showPanel(element);
|
gui.player_panel.__internal_showPanel(element);
|
||||||
} else {
|
}
|
||||||
toast("未设置键位坐标或坐标数据错误,请前往设置页设置键位坐标");
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
element.v_relative.addView(element.v_play);
|
element.v_relative.addView(element.v_play);
|
||||||
}
|
}
|
||||||
element.v_delete = new android.widget.ImageView(ctx);
|
element.v_delete = new android.widget.ImageView(ctx);
|
||||||
@@ -2142,7 +2352,8 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
s.ns0_listView.setAdapter(s.ns0_listAdapterController.self);
|
s.ns0_listView.setAdapter(s.ns0_listAdapterController.self);
|
||||||
s.ns0_listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener({
|
s.ns0_listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener({
|
||||||
onItemClick: function(parent, view, pos, id) {
|
onItemClick: function(parent, view, pos, id) {
|
||||||
var item = s.ns0_listAdapterController.get(pos);if(item.type == -1) {
|
var item = s.ns0_listAdapterController.get(pos);
|
||||||
|
if(item.type == -1) {
|
||||||
switch(item.index) {
|
switch(item.index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
gui.dialogs.showConfirmDialog({
|
gui.dialogs.showConfirmDialog({
|
||||||
@@ -2169,6 +2380,24 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 1: {
|
||||||
|
gui.dialogs.showConfirmDialog({
|
||||||
|
title: "修改乐谱键位数",
|
||||||
|
text: "版本15增加了对不同键位乐器(8键位和15键位)乐谱的支持,它们使用不同的坐标数据。\n" +
|
||||||
|
"当前已存储在本地的乐谱(外部导入的乐谱或在版本15之前从共享乐谱下载的乐谱),它们没有键位信息,SkyAutoPlayerScript无法确认它是8键位乐谱还是15键位乐谱。\n" +
|
||||||
|
"共享乐谱信息已更新,现在下载的共享乐谱它已经包含了乐谱键位信息,不需要再设置。\n" +
|
||||||
|
"点击开始弹奏按钮时,若无键位信息,则会弹出对话框以选择乐谱键位,SkyAutoPlayerScript会保存键位信息到乐谱。\n" +
|
||||||
|
"如果因为一些原因设置了错误的键位信息,可以长按乐谱来重新设置。\n\n" +
|
||||||
|
"p.s.: 需要重新设置15键键位坐标。",
|
||||||
|
canExit: true,
|
||||||
|
skip: function(checked) {
|
||||||
|
config.values.skipChangeKeyCountTip = config.save("skip_change_key_count_tip", checked);
|
||||||
|
if(checked) s.ns0_listAdapterController.removeByIndex(pos, true);
|
||||||
|
},
|
||||||
|
buttons: ["确认"]
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2185,71 +2414,32 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gui.dialogs.showDialog((function () {
|
gui.dialogs.showDialog(gui.getViewMaker("sheetInfo")(item), -2, -2, null, true);
|
||||||
var scr = new android.widget.ScrollView(ctx);
|
|
||||||
scr.setBackgroundColor(gui.config.colors.background);
|
|
||||||
var layout = new android.widget.LinearLayout(ctx);
|
|
||||||
layout.setLayoutParams(new android.widget.FrameLayout.LayoutParams(-2, -2));
|
|
||||||
layout.setOrientation(android.widget.LinearLayout.VERTICAL);
|
|
||||||
layout.setPadding(15 * dp, 15 * dp, 15 * dp, 5 * dp);
|
|
||||||
var title = new android.widget.TextView(ctx);
|
|
||||||
title.setText(item.name);
|
|
||||||
title.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
|
||||||
title.setPadding(0, 0, 0, 10 * dp);
|
|
||||||
title.setTextColor(gui.config.colors.text);
|
|
||||||
title.setTextSize(16);
|
|
||||||
layout.addView(title);
|
|
||||||
var text = new android.widget.TextView(ctx);
|
|
||||||
text.setText(android.text.Html.fromHtml(
|
|
||||||
"<font color=#FFFFFF>作者: " + (item.author.length == 0 ? "</font><font color=#7B7B7B>Not Provided</font><font color=#FFFFFF>" : item.author) + "</font><br>" +
|
|
||||||
"<font color=#FFFFFF>BPM: " + item.bpm + "</font><br>" +
|
|
||||||
"<font color=#FFFFFF>时长: " + (function(){
|
|
||||||
var time_ms = item.songNotes[item.songNotes.length - 1].time;
|
|
||||||
var second_s = Math.floor(time_ms / 1000);
|
|
||||||
|
|
||||||
var millis = time_ms - second_s * 1000;
|
|
||||||
var minute = Math.floor(second_s / 60);
|
|
||||||
var second = second_s - minute * 60;
|
|
||||||
|
|
||||||
return minute + ":" + second + "." + millis;
|
|
||||||
}()) + "</font><br>" +
|
|
||||||
"<br>" +
|
|
||||||
"<font color=#FFFFFF>音高: " + (function(){
|
|
||||||
var r = "</font><font color=";
|
|
||||||
switch(item.pitchLevel) {
|
|
||||||
case 0: r += "#FF6100";break;
|
|
||||||
case 1: r += "#FF9200";break;
|
|
||||||
case 2: r += "#FFC600";break;
|
|
||||||
case 3: r += "#FFFF00";break;
|
|
||||||
case 4: r += "#8CC619";break;
|
|
||||||
case 5: r += "#00815A";break;
|
|
||||||
case 6: r += "#0096B5";break;
|
|
||||||
case 7: r += "#2971B5";break;
|
|
||||||
case 8: r += "#424DA4";break;
|
|
||||||
case 9: r += "#6B3594";break;
|
|
||||||
case 10: r += "#C5047B";break;
|
|
||||||
case 11: r += "#FF0000";break;
|
|
||||||
}
|
}
|
||||||
r += ">" + sheetmgr.pitch_suggestion[item.pitchLevel].name
|
}));
|
||||||
return r;
|
s.ns0_listView.setOnItemLongClickListener(new android.widget.AdapterView.OnItemLongClickListener({
|
||||||
}()) + "</font><br>" +
|
onItemLongClick: function(parent, view, pos, id) {
|
||||||
"<font color=#FFFFFF>建议弹奏地点: " + (function(){
|
var item = s.ns0_listAdapterController.get(pos);
|
||||||
var r = "</font>";
|
if(!item.failed && item.type == 0) {
|
||||||
sheetmgr.pitch_suggestion[item.pitchLevel].places.map(function(e, i) {
|
gui.dialogs.showConfirmDialog({
|
||||||
r += "<br><font color=#FFFFFF> * </font><font color=#7B7B7B>" + e + "</font>"
|
title: "设置键位数",
|
||||||
|
text: "这是一个本地乐谱,请设置这个乐谱的键位数",
|
||||||
|
canExit: true,
|
||||||
|
buttons: ["8 键位", "15 键位"],
|
||||||
|
callback: function(id) {
|
||||||
|
files.write(files.join(sheetmgr.rootDir, item.fileName), (function() {
|
||||||
|
var readable = files.open(files.join(sheetmgr.rootDir, item.fileName), "r", sheetmgr.encoding);
|
||||||
|
var parsed = eval(readable.read())[0];
|
||||||
|
readable.close();
|
||||||
|
parsed.keyCount = id == 0 ? (item.keyCount = 8) : (item.keyCount = 15)
|
||||||
|
return "[" + JSON.stringify(parsed) + "]";
|
||||||
|
}()), sheetmgr.encoding);
|
||||||
|
toast("已将 " + item.name + " 设置为 " + item.keyCount + " 键乐谱\n请再次点击弹奏按钮。\n长按乐谱以重新设置键位数。");
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return r;
|
|
||||||
}())
|
|
||||||
));
|
|
||||||
text.setPadding(0, 0, 0, 10 * dp);
|
|
||||||
text.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
|
||||||
text.setTextColor(gui.config.colors.sec_text);
|
|
||||||
text.setTextSize(14);
|
|
||||||
layout.addView(text);
|
|
||||||
scr.addView(layout)
|
|
||||||
return scr;
|
|
||||||
}()), -2, -2, null, true);
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
s.ns0_rl.addView(s.ns0_listView);
|
s.ns0_rl.addView(s.ns0_listView);
|
||||||
|
|
||||||
@@ -2287,6 +2477,11 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
title: "如何导入本地乐谱",
|
title: "如何导入本地乐谱",
|
||||||
index: 0
|
index: 0
|
||||||
});//上传乐谱提示
|
});//上传乐谱提示
|
||||||
|
if(!config.values.skipChangeKeyCountTip) s.ns0_listAdapterController.add({
|
||||||
|
type: -1,
|
||||||
|
title: "修改乐谱键位数",
|
||||||
|
index: 1
|
||||||
|
});//修改乐谱键位提示
|
||||||
s.ns0_listAdapterController.notifyChange();
|
s.ns0_listAdapterController.notifyChange();
|
||||||
threads.start(function() {
|
threads.start(function() {
|
||||||
sheetmgr.getLocalSheetList(isForce, function(successCount, failedCount) {
|
sheetmgr.getLocalSheetList(isForce, function(successCount, failedCount) {
|
||||||
@@ -2295,10 +2490,11 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
});
|
});
|
||||||
}).map(function(e, i) {
|
}).map(function(e, i) {
|
||||||
gui.run(function(){
|
gui.run(function(){
|
||||||
if(!e.failed) {
|
if(!e.failed || config.values.showFailedSheets) {
|
||||||
s.ns0_listAdapterController.add(e);
|
s.ns0_listAdapterController.add((function(item) {
|
||||||
} else if(config.values.showFailedSheets){
|
item.type = 0;
|
||||||
s.ns0_listAdapterController.add(e);
|
return item;
|
||||||
|
}(e)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -2433,7 +2629,7 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
element.download.setBackgroundDrawable(gui.utils.ripple_drawable(element.download.getMeasuredWidth(), element.download.getMeasuredHeight(), "rect"));
|
element.download.setBackgroundDrawable(gui.utils.ripple_drawable(element.download.getMeasuredWidth(), element.download.getMeasuredHeight(), "rect"));
|
||||||
element.download.setOnClickListener(new android.view.View.OnClickListener({
|
element.download.setOnClickListener(new android.view.View.OnClickListener({
|
||||||
onClick: function() { threads.start(function() {
|
onClick: function() { threads.start(function() {
|
||||||
if(!element.isShowingStatusBar) sheetmgr.downloadAndLoad(element.file, element.author, function(r) {
|
if(!element.isShowingStatusBar) sheetmgr.downloadAndLoad(element.file, {author: element.author, keyCount: element.keyCount}, function(r) {
|
||||||
switch(r.status) {
|
switch(r.status) {
|
||||||
case 1: {
|
case 1: {
|
||||||
gui.run(function() {
|
gui.run(function() {
|
||||||
@@ -2577,64 +2773,7 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
|
|
||||||
};break;
|
};break;
|
||||||
default: {
|
default: {
|
||||||
gui.dialogs.showDialog((function () {
|
gui.dialogs.showDialog(gui.getViewMaker("sheetInfo")(item), -2, -2, null, true);
|
||||||
var scr = new android.widget.ScrollView(ctx);
|
|
||||||
scr.setBackgroundColor(gui.config.colors.background);
|
|
||||||
var layout = new android.widget.LinearLayout(ctx);
|
|
||||||
layout.setLayoutParams(new android.widget.FrameLayout.LayoutParams(-2, -2));
|
|
||||||
layout.setOrientation(android.widget.LinearLayout.VERTICAL);
|
|
||||||
layout.setPadding(15 * dp, 15 * dp, 15 * dp, 5 * dp);
|
|
||||||
var title = new android.widget.TextView(ctx);
|
|
||||||
title.setText(item.name);
|
|
||||||
title.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
|
||||||
title.setPadding(0, 0, 0, 10 * dp);
|
|
||||||
title.setTextColor(gui.config.colors.text);
|
|
||||||
title.setTextSize(16);
|
|
||||||
layout.addView(title);
|
|
||||||
var text = new android.widget.TextView(ctx);
|
|
||||||
text.setText(android.text.Html.fromHtml(
|
|
||||||
"<font color=#FFFFFF>作者: " + (item.author.length == 0 ? "</font><font color=#7B7B7B>Not Provided</font><font color=#FFFFFF>" : item.author) + "</font><br>" +
|
|
||||||
"<font color=#FFFFFF>BPM: " + item.bpm + "</font><br>" +
|
|
||||||
"<br>" +
|
|
||||||
"<font color=#FFFFFF>音高: " + (function(){
|
|
||||||
var r = "</font><font color=";
|
|
||||||
switch(item.pitchLevel) {
|
|
||||||
case 0: r += "#FF6100";break;
|
|
||||||
case 1: r += "#FF9200";break;
|
|
||||||
case 2: r += "#FFC600";break;
|
|
||||||
case 3: r += "#FFFF00";break;
|
|
||||||
case 4: r += "#8CC619";break;
|
|
||||||
case 5: r += "#00815A";break;
|
|
||||||
case 6: r += "#0096B5";break;
|
|
||||||
case 7: r += "#2971B5";break;
|
|
||||||
case 8: r += "#424DA4";break;
|
|
||||||
case 9: r += "#6B3594";break;
|
|
||||||
case 10: r += "#C5047B";break;
|
|
||||||
case 11: r += "#FF0000";break;
|
|
||||||
}
|
|
||||||
r += ">" + sheetmgr.pitch_suggestion[item.pitchLevel].name
|
|
||||||
return r;
|
|
||||||
}()) + "</font><br>" +
|
|
||||||
"<font color=#FFFFFF>建议弹奏地点: " + (function(){
|
|
||||||
var r = "</font>";
|
|
||||||
sheetmgr.pitch_suggestion[item.pitchLevel].places.map(function(e, i) {
|
|
||||||
r += "<br><font color=#FFFFFF> * </font><font color=#7B7B7B>" + e + "</font>"
|
|
||||||
});
|
|
||||||
return r;
|
|
||||||
}()) +
|
|
||||||
"<br><br>" +
|
|
||||||
"<font color=#FFFFFF>简介: </font><br><font color=#7B7B7B>" +
|
|
||||||
item.desc.replace(new RegExp("\x0a", "gi"), "<br>")
|
|
||||||
+ "</font>"
|
|
||||||
));
|
|
||||||
text.setPadding(0, 0, 0, 10 * dp);
|
|
||||||
text.setLayoutParams(new android.widget.LinearLayout.LayoutParams(-2, -2));
|
|
||||||
text.setTextColor(gui.config.colors.sec_text);
|
|
||||||
text.setTextSize(14);
|
|
||||||
layout.addView(text);
|
|
||||||
scr.addView(layout)
|
|
||||||
return scr;
|
|
||||||
}()), -2, -2, null, true);
|
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -2795,10 +2934,29 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
name: "基本设置",
|
name: "基本设置",
|
||||||
}, {
|
}, {
|
||||||
type: "default",
|
type: "default",
|
||||||
name: "设置键位坐标",
|
name: "设置8键盘键位坐标",
|
||||||
onClick: function(v) {
|
onClick: function(v) {
|
||||||
gui.main.__internal_dismiss();
|
gui.main.__internal_dismiss();
|
||||||
gui.key_coordinate_navigation.show();
|
config.values.key_coordinates8.length = 0;
|
||||||
|
gui.key_coordinate_navigation.show(8, function(value) {
|
||||||
|
config.values.key_coordinates8.push(value);
|
||||||
|
}, function() {
|
||||||
|
config.save("key_coordinates8");
|
||||||
|
toast("坐标设置已保存至存储!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: "default",
|
||||||
|
name: "设置15键盘键位坐标",
|
||||||
|
onClick: function(v) {
|
||||||
|
gui.main.__internal_dismiss();
|
||||||
|
config.values.key_coordinates15.length = 0;
|
||||||
|
gui.key_coordinate_navigation.show(15, function(value) {
|
||||||
|
config.values.key_coordinates15.push(value);
|
||||||
|
}, function() {
|
||||||
|
config.save("key_coordinates15");
|
||||||
|
toast("坐标设置已保存至存储!");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
@@ -2857,7 +3015,7 @@ gui.dialogs.showProgressDialog(function(o) {
|
|||||||
try {
|
try {
|
||||||
android.os.Build.VERSION_CODES.R
|
android.os.Build.VERSION_CODES.R
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sList.list.splice(3, 1);
|
sList.list.splice(4, 1);
|
||||||
}
|
}
|
||||||
return sList.list;
|
return sList.list;
|
||||||
}()), function self(element) {
|
}()), function self(element) {
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
|
版本: 16
|
||||||
|
更新时间: 2020.10.02 12:50
|
||||||
|
更新内容:
|
||||||
|
* 改善:乐谱详情界面
|
||||||
|
|
||||||
|
版本: 15
|
||||||
|
更新时间: 2020.10.01 00:00
|
||||||
|
更新内容:
|
||||||
|
* 新增:8键位乐谱支持
|
||||||
|
|
||||||
版本: 14
|
版本: 14
|
||||||
更新时间: 2020.09.03 20:51
|
更新时间: 2020.09.13 20:51
|
||||||
更新内容:
|
更新内容:
|
||||||
* 新增:共享乐谱支持搜索功能
|
* 新增:共享乐谱支持搜索功能
|
||||||
* 改善:窗口拓展功能
|
* 改善:窗口拓展功能
|
||||||
|
|||||||
Reference in New Issue
Block a user