update:优化脚本执行

This commit is contained in:
Yutousama 2022-07-27 01:22:32 +08:00
parent 21dd8033d1
commit 5209843e86
3 changed files with 25 additions and 10 deletions

View File

@ -22,5 +22,6 @@ public class JianRScriptV2Data {
public static final String formationType = "formationType"; public static final String formationType = "formationType";
public static final String dialog_go = "dialog_go"; public static final String dialog_go = "dialog_go";
public static final String dialog_back = "dialog_back"; public static final String dialog_back = "dialog_back";
public static final String dialog_assets = "dialog_assets";
} }
} }

View File

@ -101,6 +101,9 @@ public class JianRTaskManager {
case JianRScriptV2Data.ScriptModel.dialog_back: case JianRScriptV2Data.ScriptModel.dialog_back:
vector2D = getDialogCoords(device, gameDisplay, true); vector2D = getDialogCoords(device, gameDisplay, true);
break; break;
case JianRScriptV2Data.ScriptModel.dialog_assets:
vector2D = getDialogAssetsCoords(device, gameDisplay);
break;
default: default:
if (script.getActivity().startsWith(JianRScriptV2Data.ScriptModel.formationType)) { if (script.getActivity().startsWith(JianRScriptV2Data.ScriptModel.formationType)) {
vector2D = getNextFormationCoords(device, gameDisplay, Integer.parseInt(script.getActivity().split("#")[1])); vector2D = getNextFormationCoords(device, gameDisplay, Integer.parseInt(script.getActivity().split("#")[1]));
@ -233,6 +236,18 @@ public class JianRTaskManager {
return v2d; return v2d;
} }
/**
* 获取资源对抗确定坐标
*
* @return 坐标
*/
private Vector2D getDialogAssetsCoords(AndroidDevice device, AndroidDevice.GameDisplay gameDisplay) {
Vector2D v2d = new Vector2D();
v2d.setX(gameDisplay.getWidth() * 0.5 + gameDisplay.getStart().getX());
v2d.setY(gameDisplay.getHeight() * 0.5433 + gameDisplay.getStart().getY());
return v2d;
}
public static void main(String[] args) { public static void main(String[] args) {
AndroidDevice device = new AndroidDevice(); AndroidDevice device = new AndroidDevice();
AndroidDevice.DeviceDisplay deviceDisplay = new AndroidDevice.DeviceDisplay(); AndroidDevice.DeviceDisplay deviceDisplay = new AndroidDevice.DeviceDisplay();
@ -274,7 +289,6 @@ public class JianRTaskManager {
device.getDeviceId(), device.getDeviceId(),
v2d.getX(), v2d.getX(),
v2d.getY()); v2d.getY());
System.out.println(exec);
AppTools.exec(exec AppTools.exec(exec
, null, false, false); , null, false, false);
} }

View File

@ -48,7 +48,7 @@
' "script":[\n' + ' "script":[\n' +
' {\n' + ' {\n' +
' "title":"",\n' + ' "title":"",\n' +
' "activity":"map|attack|formationType#{0-4}|dialog_go|dialog_back",\n' + ' "activity":"map|attack|formationType#{0-4}|dialog_go|dialog_back|dialog_assets",\n' +
' "nextWaitTime": 0,\n' + ' "nextWaitTime": 0,\n' +
' "randomNextWaitTime": 0\n' + ' "randomNextWaitTime": 0\n' +
' }\n' + ' }\n' +