自动采集

wjdr
wangbing 11 months ago
parent a3f40a9683
commit 0354ebb5d9

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

@ -311,11 +311,7 @@ public abstract class JMacro {
* *
*/ */
public ViewRect getFocusRect() { public ViewRect getFocusRect() {
if (focusRect != null) { return focusRect;
return focusRect;
}
// 返回屏幕区域
return getScreenRect();
} }
/** /**

@ -4,7 +4,8 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.caller.CallerUtil; import cn.hutool.core.lang.caller.CallerUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import xyz.wbsite.jmacro.JMainService; import cn.hutool.log.level.Level;
import xyz.wbsite.jmacro.ex.MacroErrorException;
/** /**
* *
@ -15,9 +16,10 @@ import xyz.wbsite.jmacro.JMainService;
*/ */
public class Logger { public class Logger {
public static void info(String format, Object... arg) { public static void info(String format, Object... arg) {
DateTime date = DateUtil.date(); DateTime date = DateUtil.date();
String level = "INFO"; String level = Level.INFO.toString();
String log = StrUtil.format(format, arg); String log = StrUtil.format(format, arg);
String name = CallerUtil.getCallerCaller().getSimpleName(); String name = CallerUtil.getCallerCaller().getSimpleName();
// 获取当前线程的堆栈追踪 // 获取当前线程的堆栈追踪
@ -27,17 +29,16 @@ public class Logger {
System.out.println(StrUtil.format("[{}] [{}] {} [{}:{}]", date, level, log, name, lineNumber)); System.out.println(StrUtil.format("[{}] [{}] {} [{}:{}]", date, level, log, name, lineNumber));
} }
public static void error(String log, Object... arg) { public static void error(String format, Object... arg) {
info(log, arg); DateTime date = DateUtil.date();
// 中断1分钟 String level = Level.ERROR.toString();
for (int i = 0; i < 60; i++) { String log = StrUtil.format(format, arg);
if (JMainService.getInstance().run) { String name = CallerUtil.getCallerCaller().getSimpleName();
try { // 获取当前线程的堆栈追踪
Thread.sleep(1000); StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
} catch (InterruptedException e) { // 通常堆栈追踪数组的第三个元素是logMessage方法的调用者
throw new RuntimeException(e); int lineNumber = stackTrace[2].getLineNumber();
} System.out.println(StrUtil.format("[{}] [{}] {} [{}:{}]", date, level, log, name, lineNumber));
} throw new MacroErrorException(StrUtil.format(format, arg));
}
} }
} }

@ -35,12 +35,21 @@ public class MacroForWJDR extends JMacro {
@Override @Override
public synchronized ViewRect focus() { public synchronized ViewRect focus() {
Logger.info("请确保MuMu显示分辨率为540 x 960(DPI 240)"); Logger.info("请确保MuMu配置如下");
Logger.info("显卡渲染模式Vulkan模式");
Logger.info("性能配置:中性能");
Logger.info("显卡使用策略:画面标签更好");
Logger.info("其他优化:强制使用独立显卡");
Logger.info("分辨率设置显示分辨率为540 x 960(DPI 240)");
Logger.info("画面设置画面亮度【50】画面风格【普通】");
Logger.info("帧率设置60");
Logger.info("技术上次关闭时的窗口位置和大小60");
Logger.info("固定窗口大小,禁止手动拉伸");
ViewRect rect = getScreenRect(); ViewRect rect = getScreenRect();
Logger.info("查找定位MuMu工具栏"); Logger.info("查找定位MuMu工具栏");
ViewRect mumu = findLegend("慕慕_工具栏", 0.95d); ViewRect mumu = findLegend("慕慕_工具栏", 0.98d);
if (mumu == null) { if (mumu == null) {
Logger.info("聚焦窗口失败,默认全屏"); Logger.error("聚焦窗口失败");
} else { } else {
// 计算应用窗口返回 // 计算应用窗口返回
rect.setLeft(mumu.getLeft() - 428); rect.setLeft(mumu.getLeft() - 428);

Loading…
Cancel
Save

Powered by TurnKey Linux.