|
|
|
@@ -44,13 +44,6 @@ extends Screen {
|
|
|
|
|
// ---- 输入控件 ----
|
|
|
|
|
private TextFieldWidget stateField;
|
|
|
|
|
private TextFieldWidget targetCountField;
|
|
|
|
|
private TextFieldWidget waitTimeoutField;
|
|
|
|
|
private TextFieldWidget retriesField;
|
|
|
|
|
private TextFieldWidget regionXField;
|
|
|
|
|
private TextFieldWidget regionZField;
|
|
|
|
|
private TextFieldWidget regionRadiusField;
|
|
|
|
|
private TextFieldWidget ringsField;
|
|
|
|
|
private TextFieldWidget refreshIntervalField;
|
|
|
|
|
private CheckboxWidget sprintBox;
|
|
|
|
|
private CheckboxWidget jumpBox;
|
|
|
|
|
private CheckboxWidget avoidBox;
|
|
|
|
@@ -64,7 +57,6 @@ extends Screen {
|
|
|
|
|
private int rectStartZ;
|
|
|
|
|
private int rectEndX;
|
|
|
|
|
private int rectEndZ;
|
|
|
|
|
private boolean updatingFields;
|
|
|
|
|
// ---- 布局尺寸 ----
|
|
|
|
|
private int mapX = 12;
|
|
|
|
|
private int mapY = 40;
|
|
|
|
@@ -74,7 +66,6 @@ extends Screen {
|
|
|
|
|
private int advancedY = 208;
|
|
|
|
|
private int stateFieldY = 84;
|
|
|
|
|
private int targetFieldY = 116;
|
|
|
|
|
private int advRowGap = 24;
|
|
|
|
|
// ---- 地图视图 ----
|
|
|
|
|
private double scale = 5.0;
|
|
|
|
|
private int viewCenterX;
|
|
|
|
@@ -104,7 +95,6 @@ extends Screen {
|
|
|
|
|
// 屏幕较矮时压缩垂直间距,保证右侧面板内容不被截断
|
|
|
|
|
boolean compact = this.height < 480;
|
|
|
|
|
int rowGap = compact ? 24 : 28; // 主字段行间距
|
|
|
|
|
this.advRowGap = compact ? 20 : 24; // 高级面板字段行间距
|
|
|
|
|
int advCheckGap = compact ? 16 : 18; // 高级面板复选框行间距
|
|
|
|
|
|
|
|
|
|
// ===== 顶部控制按钮 =====
|
|
|
|
@@ -140,41 +130,9 @@ extends Screen {
|
|
|
|
|
this.addDrawableChild(this.strategyButton("\u73a9\u5bb6\u5468\u56f4", 3, left, strategyY + 24, 90));
|
|
|
|
|
this.addDrawableChild(this.strategyButton("\u7ed5\u56fd\u4e00\u5708", 4, left + 96, strategyY + 24, 90));
|
|
|
|
|
|
|
|
|
|
// ===== 高级设置面板:直接显示(无展开/收起按钮),紧贴策略按钮下方 =====
|
|
|
|
|
this.updateRegionButtons();
|
|
|
|
|
// 策略按钮第二行底部 + 8px 间距,作为高级面板起始位置
|
|
|
|
|
this.advancedY = strategyY + 24 + 8;
|
|
|
|
|
int advFieldX1 = this.panelX + 62;
|
|
|
|
|
int advFieldX2 = this.panelX + 178;
|
|
|
|
|
int advFieldWidth = Math.max(46, panelWidth - 184);
|
|
|
|
|
this.waitTimeoutField = this.numberField(this.config.waitTimeoutSeconds, advFieldX1, this.advancedY, advFieldWidth);
|
|
|
|
|
this.retriesField = this.numberField(this.config.retries, advFieldX2, this.advancedY, advFieldWidth);
|
|
|
|
|
this.regionXField = this.numberField(this.config.regionCenterX, advFieldX1, this.advancedY + this.advRowGap, advFieldWidth);
|
|
|
|
|
this.regionZField = this.numberField(this.config.regionCenterZ, advFieldX2, this.advancedY + this.advRowGap, advFieldWidth);
|
|
|
|
|
this.regionRadiusField = this.numberField(this.config.regionRadius, advFieldX1, this.advancedY + this.advRowGap * 2, advFieldWidth);
|
|
|
|
|
this.ringsField = this.numberField(this.config.maxRings, advFieldX2, this.advancedY + this.advRowGap * 2, advFieldWidth);
|
|
|
|
|
this.refreshIntervalField = this.numberField(this.config.refreshIntervalSeconds, advFieldX1, this.advancedY + this.advRowGap * 3, advFieldWidth);
|
|
|
|
|
this.addDrawableChild(this.waitTimeoutField);
|
|
|
|
|
this.addDrawableChild(this.retriesField);
|
|
|
|
|
this.addDrawableChild(this.regionXField);
|
|
|
|
|
this.addDrawableChild(this.regionZField);
|
|
|
|
|
this.addDrawableChild(this.regionRadiusField);
|
|
|
|
|
this.addDrawableChild(this.ringsField);
|
|
|
|
|
this.addDrawableChild(this.refreshIntervalField);
|
|
|
|
|
// 用户手动编辑中心/半径时,清除圈选矩形(避免边界与输入框不一致)
|
|
|
|
|
Consumer<String> clearRectOnEdit = s -> {
|
|
|
|
|
if (!this.updatingFields) {
|
|
|
|
|
this.config.regionMinX = 0;
|
|
|
|
|
this.config.regionMaxX = -1;
|
|
|
|
|
this.config.regionMinZ = 0;
|
|
|
|
|
this.config.regionMaxZ = -1;
|
|
|
|
|
this.updateRegionButtons();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
this.regionXField.setChangedListener(clearRectOnEdit);
|
|
|
|
|
this.regionZField.setChangedListener(clearRectOnEdit);
|
|
|
|
|
this.regionRadiusField.setChangedListener(clearRectOnEdit);
|
|
|
|
|
int checkY1 = this.advancedY + this.advRowGap * 3 + 20 + 8;
|
|
|
|
|
this.advancedY = strategyY + 24 + 20 + 8;
|
|
|
|
|
// ===== 只保留五个权限选择框:疾跑、跳跃、避怪、破坏、放置 =====
|
|
|
|
|
int checkY1 = this.advancedY + 14;
|
|
|
|
|
int checkY2 = checkY1 + advCheckGap;
|
|
|
|
|
int checkX = left;
|
|
|
|
|
this.sprintBox = this.checkbox("\u75be\u8dd1", checkX, checkY1, this.config.allowSprint, value -> {
|
|
|
|
@@ -260,7 +218,7 @@ extends Screen {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 将当前拖拽的矩形提交到配置,并更新高级面板的输入框 */
|
|
|
|
|
/** 将当前拖拽的矩形提交到配置 */
|
|
|
|
|
private void finalizeRegion() {
|
|
|
|
|
if (this.rectStartX == this.rectEndX && this.rectStartZ == this.rectEndZ) {
|
|
|
|
|
// 单点无效,清空
|
|
|
|
@@ -274,18 +232,6 @@ extends Screen {
|
|
|
|
|
this.selectingRegion = false;
|
|
|
|
|
this.draggingRect = false;
|
|
|
|
|
this.updateRegionButtons();
|
|
|
|
|
// 同步更新中心+半径输入框,使高级面板保持一致
|
|
|
|
|
int centerX = (this.config.regionMinX + this.config.regionMaxX) / 2;
|
|
|
|
|
int centerZ = (this.config.regionMinZ + this.config.regionMaxZ) / 2;
|
|
|
|
|
int radius = Math.max(
|
|
|
|
|
this.config.regionMaxX - this.config.regionMinX,
|
|
|
|
|
this.config.regionMaxZ - this.config.regionMinZ
|
|
|
|
|
) / 2 + 1;
|
|
|
|
|
this.updatingFields = true;
|
|
|
|
|
this.regionXField.setText(Integer.toString(centerX));
|
|
|
|
|
this.regionZField.setText(Integer.toString(centerZ));
|
|
|
|
|
this.regionRadiusField.setText(Integer.toString(radius));
|
|
|
|
|
this.updatingFields = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 绘制区域圈选矩形(覆盖层 + 边框);仅区域扩地模式下绘制 */
|
|
|
|
@@ -479,13 +425,7 @@ extends Screen {
|
|
|
|
|
int shown;
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u90a6\u56fd", this.panelX + 4, this.stateFieldY + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u76ee\u6807\u6570\u91cf", this.panelX + 4, this.targetFieldY + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u7b49\u5f85\u8d85\u65f6", this.panelX + 4, this.advancedY + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u91cd\u8bd5\u6b21\u6570", this.panelX + 116, this.advancedY + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u533a\u57df\u4e2d\u5fc3X", this.panelX + 4, this.advancedY + this.advRowGap + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u533a\u57df\u4e2d\u5fc3Z", this.panelX + 116, this.advancedY + this.advRowGap + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u533a\u57df\u534a\u5f84", this.panelX + 4, this.advancedY + this.advRowGap * 2 + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u6269\u5708\u4e0a\u9650", this.panelX + 116, this.advancedY + this.advRowGap * 2 + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u5237\u65b0\u95f4\u9694", this.panelX + 4, this.advancedY + this.advRowGap * 3 + 4, -5592406);
|
|
|
|
|
context.drawTextWithShadow(this.textRenderer, "\u6743\u9650\u8bbe\u7f6e", this.panelX + 4, this.advancedY, -5592406);
|
|
|
|
|
int belowY = this.mapY + this.mapH + 12;
|
|
|
|
|
int logWidth = Math.max(120, (int)(this.mapW * 0.52));
|
|
|
|
|
int statusX = this.mapX + logWidth + 20;
|
|
|
|
@@ -542,13 +482,6 @@ extends Screen {
|
|
|
|
|
private void parseToConfig() {
|
|
|
|
|
this.config.stateName = this.stateField.getText().trim();
|
|
|
|
|
this.config.targetCount = this.parseInt(this.targetCountField.getText(), 20);
|
|
|
|
|
this.config.waitTimeoutSeconds = this.parseInt(this.waitTimeoutField.getText(), 60);
|
|
|
|
|
this.config.retries = this.parseInt(this.retriesField.getText(), 2);
|
|
|
|
|
this.config.regionCenterX = this.parseInt(this.regionXField.getText(), this.playerChunk().x());
|
|
|
|
|
this.config.regionCenterZ = this.parseInt(this.regionZField.getText(), this.playerChunk().z());
|
|
|
|
|
this.config.regionRadius = this.parseInt(this.regionRadiusField.getText(), 5);
|
|
|
|
|
this.config.maxRings = this.parseInt(this.ringsField.getText(), 0);
|
|
|
|
|
this.config.refreshIntervalSeconds = this.parseInt(this.refreshIntervalField.getText(), 30);
|
|
|
|
|
this.config.allowSprint = this.sprintBox.isChecked();
|
|
|
|
|
this.config.allowJump = this.jumpBox.isChecked();
|
|
|
|
|
this.config.avoidMobs = this.avoidBox.isChecked();
|
|
|
|
@@ -562,17 +495,6 @@ extends Screen {
|
|
|
|
|
target.strategy = this.config.strategy;
|
|
|
|
|
target.stateName = this.config.stateName;
|
|
|
|
|
target.targetCount = this.config.targetCount;
|
|
|
|
|
target.waitTimeoutSeconds = this.config.waitTimeoutSeconds;
|
|
|
|
|
target.retries = this.config.retries;
|
|
|
|
|
target.regionCenterX = this.config.regionCenterX;
|
|
|
|
|
target.regionCenterZ = this.config.regionCenterZ;
|
|
|
|
|
target.regionRadius = this.config.regionRadius;
|
|
|
|
|
target.regionMinX = this.config.regionMinX;
|
|
|
|
|
target.regionMaxX = this.config.regionMaxX;
|
|
|
|
|
target.regionMinZ = this.config.regionMinZ;
|
|
|
|
|
target.regionMaxZ = this.config.regionMaxZ;
|
|
|
|
|
target.maxRings = this.config.maxRings;
|
|
|
|
|
target.refreshIntervalSeconds = this.config.refreshIntervalSeconds;
|
|
|
|
|
target.allowSprint = this.config.allowSprint;
|
|
|
|
|
target.allowJump = this.config.allowJump;
|
|
|
|
|
target.avoidMobs = this.config.avoidMobs;
|
|
|
|
|