From d7377307689b671c95e54d87d74863d9be8dde23 Mon Sep 17 00:00:00 2001
From: Yutousama <583819556@qq.com>
Date: Wed, 27 Jul 2022 09:35:04 +0800
Subject: [PATCH] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E8=84=9A=E6=9C=AC?=
=?UTF-8?q?=E6=89=A7=E8=A1=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../qqbot/data/jianr/JianRScriptV2Data.java | 1 +
.../yutou/qqbot/utlis/JianRTaskManager.java | 19 ++++++++++++---
web/jianrTask.html | 24 +++++++++++++++++--
3 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/yutou/qqbot/data/jianr/JianRScriptV2Data.java b/src/main/java/com/yutou/qqbot/data/jianr/JianRScriptV2Data.java
index 25184a0..55582b3 100644
--- a/src/main/java/com/yutou/qqbot/data/jianr/JianRScriptV2Data.java
+++ b/src/main/java/com/yutou/qqbot/data/jianr/JianRScriptV2Data.java
@@ -23,5 +23,6 @@ public class JianRScriptV2Data {
public static final String dialog_go = "dialog_go";
public static final String dialog_back = "dialog_back";
public static final String dialog_assets = "dialog_assets";
+ public static final String none = "none";
}
}
diff --git a/src/main/java/com/yutou/qqbot/utlis/JianRTaskManager.java b/src/main/java/com/yutou/qqbot/utlis/JianRTaskManager.java
index 43e9c3a..a218c35 100644
--- a/src/main/java/com/yutou/qqbot/utlis/JianRTaskManager.java
+++ b/src/main/java/com/yutou/qqbot/utlis/JianRTaskManager.java
@@ -18,6 +18,7 @@ public class JianRTaskManager {
private JianRScriptV2Data task;
private AndroidDevice device;
private boolean running = false;
+ private boolean runStatus = false;
private int runIndex = 0;
private String log;
private int modelId;
@@ -48,9 +49,10 @@ public class JianRTaskManager {
}
public void start() {
- if (running) {
+ if (running||runStatus) {
return;
}
+ runStatus=true;
running = true;
new Thread(new Runnable() {
@@ -60,7 +62,7 @@ public class JianRTaskManager {
try {
log("已运行: " + runIndex + " 次");
for (JianRScriptV2Data.Script script : task.getScript()) {
- if (!isRunning()) {
+ if (!running) {
log("任务已停止");
break;
}
@@ -80,6 +82,7 @@ public class JianRTaskManager {
}
}
+ runStatus=false;
log("终止任务");
}
}).start();
@@ -104,6 +107,9 @@ public class JianRTaskManager {
case JianRScriptV2Data.ScriptModel.dialog_assets:
vector2D = getDialogAssetsCoords(device, gameDisplay);
break;
+ case JianRScriptV2Data.ScriptModel.none:
+ vector2D=getNoneCoords(device, gameDisplay);
+ break;
default:
if (script.getActivity().startsWith(JianRScriptV2Data.ScriptModel.formationType)) {
vector2D = getNextFormationCoords(device, gameDisplay, Integer.parseInt(script.getActivity().split("#")[1]));
@@ -124,7 +130,7 @@ public class JianRTaskManager {
}
public boolean isRunning() {
- return running;
+ return runStatus;
}
/**
@@ -247,6 +253,12 @@ public class JianRTaskManager {
v2d.setY(gameDisplay.getHeight() * 0.5433 + gameDisplay.getStart().getY());
return v2d;
}
+ private Vector2D getNoneCoords(AndroidDevice device, AndroidDevice.GameDisplay gameDisplay){
+ Vector2D v2d = new Vector2D();
+ v2d.setX(gameDisplay.getWidth() * 0.1 + gameDisplay.getStart().getX());
+ v2d.setY(gameDisplay.getHeight() * 0.1 + gameDisplay.getStart().getY());
+ return v2d;
+ }
public static void main(String[] args) {
AndroidDevice device = new AndroidDevice();
@@ -289,6 +301,7 @@ public class JianRTaskManager {
device.getDeviceId(),
v2d.getX(),
v2d.getY());
+ System.out.println(exec);
AppTools.exec(exec
, null, false, false);
}
diff --git a/web/jianrTask.html b/web/jianrTask.html
index 39584fb..133e504 100644
--- a/web/jianrTask.html
+++ b/web/jianrTask.html
@@ -32,7 +32,7 @@