mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-15 03:23:22 +08:00
自动修改画质与音量v1.2.1 (#2922)
* Add JS AutoSwitchGraphicsSettings * fix: 修复manifest.json版本号 * 修复若干问题 * fix: 识别结果是undefined时跳过此选项
This commit is contained in:
@@ -62,9 +62,16 @@ const findOption = async (optionName) => {
|
||||
let gameRegion = captureGameRegion();
|
||||
let ocrList = gameRegion.findMulti(RecognitionObject.ocrThis);
|
||||
gameRegion.Dispose();
|
||||
for(let i = 0;i < ocrList.count; i++)
|
||||
if(ocrList[i].Text === optionName)
|
||||
if(!ocrList || ocrList.count === 0) {
|
||||
log.error("未能找到选项:{name}", optionName);
|
||||
return null;
|
||||
}
|
||||
for (let i = 0; i < ocrList.count; i++) {
|
||||
if (ocrList[i].Text === optionName)
|
||||
return ocrList[i];
|
||||
}
|
||||
log.error("未能找到选项:{name}", optionName);
|
||||
return null;
|
||||
};
|
||||
|
||||
// 普通模式点击选项
|
||||
@@ -72,6 +79,8 @@ const chooseOption = async (optionName, order) => {
|
||||
if(order === 0)
|
||||
return; // 默认选项,跳过
|
||||
let res = await findOption(optionName);
|
||||
if(!res)
|
||||
return; // 未找到此选项
|
||||
let x = res.x, y = res.y;
|
||||
click(x + 1000, y + 25); // 点击选项的下拉栏,依赖选项名称的相对位置
|
||||
await sleep(100);
|
||||
@@ -111,6 +120,8 @@ const dragOption = async (optionName, size) => {
|
||||
if(Number.isNaN(size) || size < 0 || size > 10)
|
||||
return; // 音量大小不合法,跳过
|
||||
let res = await findOption(optionName);
|
||||
if(!res)
|
||||
return; // 未找到此选项
|
||||
let x = res.x, y = res.y;
|
||||
for(let i = 25;i <= 39;++i) // 鲁棒性
|
||||
click(x + 955 + 32 * size, y + i);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "自动修改画质与音量",
|
||||
"version": "1.2",
|
||||
"version": "1.2.1",
|
||||
"bgi_version": "0.57.0",
|
||||
"description": "自动调整画质和音量,用于便捷切换锄地省电画质和游戏体验画质",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user