Skip to content

Commit

Permalink
feat: 让“游戏已启动”选项有真实作用
Browse files Browse the repository at this point in the history
  • Loading branch information
Zebartin committed Apr 5, 2023
1 parent e523101 commit c30f656
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion NIKKE/NIKKEutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var {
requestScreenCaptureAuto, getDisplaySize,
killApp, findImageByFeature, findContoursRect
} = require('./utils.js');
var firstBoot = true;
if (typeof module === 'undefined') {
auto.waitFor();
unlockIfNeed();
Expand All @@ -29,8 +30,16 @@ else {
};
}
function 启动NIKKE() {
let NIKKEstorage = storages.create("NIKKEconfig");
if (firstBoot && NIKKEstorage.get('alreadyInGame', false)) {
toastLog('已勾选“游戏已启动”选项\n请确保游戏此时正处于前台画面');
firstBoot = false;
return;
}
firstBoot = false;
unlockIfNeed();
home();
sleep(500);
// 保证错误截图不要过多
let maxErr = 20;
let errorPath = files.path('./images/nikkerror/');
Expand All @@ -41,7 +50,6 @@ function 启动NIKKE() {
for (let f of errorImages.slice(maxErr))
files.remove(files.join(errorPath, f));
}
let NIKKEstorage = storages.create("NIKKEconfig");
if (NIKKEstorage.get('mute', false)) {
try {
device.setMusicVolume(0);
Expand Down
2 changes: 1 addition & 1 deletion NIKKE/NIKKE日常.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (typeof module === 'undefined') {
checkConfig();
启动NIKKE();
// 保证申请截屏权限时,屏幕是游戏画面
sleep(5000);
sleep(1000);
if (NIKKEstorage.get('alreadyInGame', false) == false) {
for (let i = 0; i < 3; ++i) {
toast('脚本等待中...');
Expand Down

0 comments on commit c30f656

Please sign in to comment.