Add auto play randomly.

This commit is contained in:
tiaod
2020-12-01 18:22:39 +08:00
parent caa9364e28
commit 4a333ab0b2

View File

@@ -285,7 +285,23 @@ sheetplayer = {
java.lang.Thread.sleep(sheetplayer.nextInterval = Math.round(sheetplayer.nextInterval * sheetplayer.speed));
sheetplayer.currentNote ++;
}
if(!(sheetplayer.currentNote < sheetplayer.noteCount)) sheetplayer.stop();
// 播放完自动下一首
if(config.values.autoPlay && !(sheetplayer.currentNote < sheetplayer.noteCount) && gui.player_panel.isShowing) {
gui.player_panel.__internal_dismiss();
sheetplayer.stop();
// gui.main.show(0);
if(sheetmgr.cachedLocalSheetList.length>0){
setTimeout(function(){
gui.player_panel.__internal_showPanel(
sheetmgr.cachedLocalSheetList[random(0, sheetmgr.cachedLocalSheetList.length-1)]
);
sheetplayer.stop();
setTimeout(function(){
sheetplayer.play(gui.player_panel.refreshStatus);
}, 1500)
}, 500)
}
}
});
},
@@ -363,6 +379,7 @@ config = {
showFailedSheets: true,
tipOnAndroidR: true,
theme: "dark",
autoPlay: false
},
bitmaps: {},
@@ -382,7 +399,7 @@ config = {
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.theme = this._global_storage.get("theme", this.values.theme);
this.values.autoPlay = this._global_storage.get("auto_play", this.values.autoPlay);
try {
android.os.Build.VERSION_CODES.R
sheetmgr.rootDir = android.os.Environment.getExternalStorageDirectory() + "/Documents/SkyAutoPlayer/sheets/";
@@ -3082,6 +3099,13 @@ gui.dialogs.showProgressDialog(function(o) {
toast("坐标设置已保存至存储!");
});
}
}, {
type: "checkbox",
name: "连续随机播放",
check: config.values.autoPlay,
onClick: function(checked) {
config.values.autoPlay = config.save("auto_play", checked);
}
}, {
type: "checkbox",
name: "显示加载失败的乐谱",
@@ -3172,7 +3196,7 @@ gui.dialogs.showProgressDialog(function(o) {
try {
android.os.Build.VERSION_CODES.R
} catch (e) {
sList.list.splice(4, 1);
sList.list.splice(5, 1);
}
return sList.list;
}()), function self(element) {