update:优化脚本执行
This commit is contained in:
parent
5209843e86
commit
d737730768
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
<script src="layui/layui.js"></script>
|
||||
<script src="layui/jquery-3.2.1.js"></script>
|
||||
<script>
|
||||
let homeUrl="http://127.0.0.1:8002";
|
||||
let homeUrl="";
|
||||
let device;
|
||||
let deviceModel=[];
|
||||
|
||||
@ -144,7 +144,22 @@
|
||||
//菜单被点击的事件
|
||||
,click: function(obj){
|
||||
console.log(obj);
|
||||
runTask(name,obj.title)
|
||||
if(obj.title==='查看'){
|
||||
$.post(homeUrl+"/jianr/task/get.do",{task:name},function (json) {
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value: json.data,
|
||||
title: '脚本内容',
|
||||
area: ['800px', '350px'] //自定义文本域宽高
|
||||
}, function(value, index, elem){
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
}else{
|
||||
runTask(name,obj.title)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -223,6 +238,11 @@
|
||||
deviceModel.push({
|
||||
title:item.title
|
||||
})
|
||||
deviceModel.push({type: '-'})
|
||||
|
||||
})
|
||||
deviceModel.push({
|
||||
title:"查看",
|
||||
})
|
||||
$('#deviceName')[0].innerHTML=obj.device.title;
|
||||
}else if (obj.data==='edit'){
|
||||
|
Loading…
Reference in New Issue
Block a user