1.5.4.1
This commit is contained in:
parent
5c1f44c4ac
commit
ebbc0f2464
|
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## [1.5.4.1]
|
||||
|
||||
### Added / 新增
|
||||
- 样板终端按钮显示新增开关控制按钮
|
||||
- Added a toggle button to control Pattern Terminal button visibility.
|
||||
|
||||
## [1.5.4]
|
||||
|
||||
### Added / 新增
|
||||
|
|
|
|||
|
|
@ -48,8 +48,10 @@ public class ProviderSelectScreen extends Screen {
|
|||
private static final Set<String> pinnedProviders = new HashSet<>();
|
||||
private static final String PINNED_CONFIG_PATH = "extendedae_plus/pinned_providers.json";
|
||||
private static final String AUTO_UPLOAD_UNIQUE_MATCH_KEY = "auto_upload_unique_match";
|
||||
private static final String SHOW_PROCESSING_BUTTONS_KEY = "show_processing_buttons";
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
private static boolean autoUploadUniqueMatchEnabled = true;
|
||||
private static boolean showProcessingButtonsEnabled = true;
|
||||
|
||||
// 静态初始化块:加载置顶配置
|
||||
static {
|
||||
|
|
@ -64,6 +66,7 @@ public class ProviderSelectScreen extends Screen {
|
|||
private EditBox searchBox;
|
||||
// 中文名输入框(用于添加映射)
|
||||
private EditBox cnInput;
|
||||
private Button processingButtonsToggleButton;
|
||||
private Button autoUploadToggleButton;
|
||||
private String query = "";
|
||||
// 翻页按钮
|
||||
|
|
@ -171,8 +174,16 @@ public class ProviderSelectScreen extends Screen {
|
|||
int totalWidth = btnWidth2 + btnGap + inputWidth + btnGap + btnWidth2 * 2 + btnGap + btnWidth2;
|
||||
int startX = centerX - totalWidth / 2;
|
||||
|
||||
int toggleX = startX + btnWidth2 + btnGap + inputWidth + btnGap + btnWidth2 + btnGap;
|
||||
int toggleY = navY + 30;
|
||||
|
||||
this.processingButtonsToggleButton = Button.builder(buildProcessingButtonsToggleLabel(), b -> toggleProcessingButtons())
|
||||
.bounds(toggleX, toggleY, btnWidth2, 20)
|
||||
.build();
|
||||
this.addRenderableWidget(this.processingButtonsToggleButton);
|
||||
|
||||
this.autoUploadToggleButton = Button.builder(buildAutoUploadToggleLabel(), b -> toggleAutoUploadUniqueMatch())
|
||||
.bounds(startX + btnWidth2 + btnGap + inputWidth + btnGap + btnWidth2 + btnGap, navY + 30, btnWidth2 * 2 + btnGap, 20)
|
||||
.bounds(toggleX + btnWidth2 + btnGap, toggleY, btnWidth2, 20)
|
||||
.build();
|
||||
this.addRenderableWidget(this.autoUploadToggleButton);
|
||||
|
||||
|
|
@ -260,6 +271,26 @@ public class ProviderSelectScreen extends Screen {
|
|||
Component.translatable(stateKey));
|
||||
}
|
||||
|
||||
private Component buildProcessingButtonsToggleLabel() {
|
||||
String stateKey = showProcessingButtonsEnabled
|
||||
? "config.extendedae_plus.option.state_on"
|
||||
: "config.extendedae_plus.option.state_off";
|
||||
return Component.translatable("extendedae_plus.screen.show_processing_buttons",
|
||||
Component.translatable(stateKey));
|
||||
}
|
||||
|
||||
public static boolean isProcessingButtonsEnabled() {
|
||||
return showProcessingButtonsEnabled;
|
||||
}
|
||||
|
||||
private void toggleProcessingButtons() {
|
||||
showProcessingButtonsEnabled = !showProcessingButtonsEnabled;
|
||||
savePinnedProviders();
|
||||
if (this.processingButtonsToggleButton != null) {
|
||||
this.processingButtonsToggleButton.setMessage(buildProcessingButtonsToggleLabel());
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleAutoUploadUniqueMatch() {
|
||||
autoUploadUniqueMatchEnabled = !autoUploadUniqueMatchEnabled;
|
||||
savePinnedProviders();
|
||||
|
|
@ -665,6 +696,11 @@ public class ProviderSelectScreen extends Screen {
|
|||
if (autoUploadElement != null && autoUploadElement.isJsonPrimitive()) {
|
||||
autoUploadUniqueMatchEnabled = autoUploadElement.getAsBoolean();
|
||||
}
|
||||
|
||||
JsonElement showProcessingButtonsElement = obj.get(SHOW_PROCESSING_BUTTONS_KEY);
|
||||
if (showProcessingButtonsElement != null && showProcessingButtonsElement.isJsonPrimitive()) {
|
||||
showProcessingButtonsEnabled = showProcessingButtonsElement.getAsBoolean();
|
||||
}
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
// 加载失败时静默处理
|
||||
}
|
||||
|
|
@ -685,6 +721,7 @@ public class ProviderSelectScreen extends Screen {
|
|||
}
|
||||
obj.add("pinned", arr);
|
||||
obj.addProperty(AUTO_UPLOAD_UNIQUE_MATCH_KEY, autoUploadUniqueMatchEnabled);
|
||||
obj.addProperty(SHOW_PROCESSING_BUTTONS_KEY, showProcessingButtonsEnabled);
|
||||
|
||||
Files.writeString(cfgPath, GSON.toJson(obj));
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import appeng.client.gui.me.items.PatternEncodingTermScreen;
|
|||
import appeng.client.gui.me.items.ProcessingEncodingPanel;
|
||||
import appeng.client.gui.widgets.ActionButton;
|
||||
import com.extendedae_plus.ExtendedAEPlus;
|
||||
import com.extendedae_plus.client.screen.ProviderSelectScreen;
|
||||
import com.extendedae_plus.client.gui.widgets.ScaledTextureButton;
|
||||
import com.extendedae_plus.init.ModNetwork;
|
||||
import com.extendedae_plus.mixin.minecraft.accessor.AbstractContainerScreenAccessor;
|
||||
|
|
@ -126,7 +127,8 @@ public abstract class ProcessingEncodingPanelMixin extends EncodingModePanel {
|
|||
|
||||
@Inject(method = "setVisible", at = @At("TAIL"), remap = false)
|
||||
private void eap$updateInjectedButtons(boolean visible, CallbackInfo ci) {
|
||||
this.cycleOutputBtn.setVisibility(false);
|
||||
boolean showInjectedButtons = visible && ProviderSelectScreen.isProcessingButtonsEnabled();
|
||||
this.cycleOutputBtn.setVisibility(visible && !showInjectedButtons);
|
||||
|
||||
if (this.eap$mul2Button == null) {
|
||||
return;
|
||||
|
|
@ -141,16 +143,16 @@ public abstract class ProcessingEncodingPanelMixin extends EncodingModePanel {
|
|||
eap$ensureAdded(this.eap$swapOutputsButton);
|
||||
eap$ensureAdded(this.eap$restoreRatioButton);
|
||||
|
||||
this.eap$mul2Button.setVisibility(visible);
|
||||
this.eap$mul3Button.setVisibility(visible);
|
||||
this.eap$mul5Button.setVisibility(visible);
|
||||
this.eap$div2Button.setVisibility(visible);
|
||||
this.eap$div3Button.setVisibility(visible);
|
||||
this.eap$div5Button.setVisibility(visible);
|
||||
this.eap$swapOutputsButton.setVisibility(visible);
|
||||
this.eap$restoreRatioButton.setVisibility(visible);
|
||||
this.eap$mul2Button.setVisibility(showInjectedButtons);
|
||||
this.eap$mul3Button.setVisibility(showInjectedButtons);
|
||||
this.eap$mul5Button.setVisibility(showInjectedButtons);
|
||||
this.eap$div2Button.setVisibility(showInjectedButtons);
|
||||
this.eap$div3Button.setVisibility(showInjectedButtons);
|
||||
this.eap$div5Button.setVisibility(showInjectedButtons);
|
||||
this.eap$swapOutputsButton.setVisibility(showInjectedButtons);
|
||||
this.eap$restoreRatioButton.setVisibility(showInjectedButtons);
|
||||
|
||||
if (!visible) {
|
||||
if (!showInjectedButtons) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@
|
|||
"extendedae_plus.screen.reload_mapping_fail": "Overloading mapping failed: %s",
|
||||
"extendedae_plus.screen.add_mapping": "Add Mapping",
|
||||
"extendedae_plus.screen.delete_mapping": "Delete Mapping",
|
||||
"extendedae_plus.screen.show_processing_buttons": "Pattern Terminal Button Display: %s",
|
||||
"extendedae_plus.screen.auto_upload_unique_match": "Auto Upload on Unique Match: %s",
|
||||
"extendedae_plus.screen.upload.enter_search_key": "Please enter a search keyword before adding a mapping",
|
||||
"extendedae_plus.screen.upload.enter_name": "Please enter a name",
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@
|
|||
"extendedae_plus.screen.reload_mapping_fail": "重载映射失败: %s",
|
||||
"extendedae_plus.screen.add_mapping": "增加映射",
|
||||
"extendedae_plus.screen.delete_mapping": "删除映射",
|
||||
"extendedae_plus.screen.show_processing_buttons": "样板终端按钮显示: %s",
|
||||
"extendedae_plus.screen.auto_upload_unique_match": "唯一匹配时自动上传: %s",
|
||||
"extendedae_plus.screen.upload.enter_search_key": "请输入搜索关键字后再添加映射",
|
||||
"extendedae_plus.screen.upload.enter_name": "请输入名称",
|
||||
|
|
|
|||
|
|
@ -122,7 +122,8 @@
|
|||
"extendedae_plus.screen.reload_mapping_fail": "重新載入對映失敗: %s",
|
||||
"extendedae_plus.screen.add_mapping": "增加對映",
|
||||
"extendedae_plus.screen.delete_mapping": "刪除對映",
|
||||
"extendedae_plus.screen.auto_upload_unique_match": "唯一匹配時自動上傳: %s",
|
||||
"extendedae_plus.screen.show_processing_buttons": "樣板終端按鈕顯示: %s",
|
||||
"extendedae_plus.screen.auto_upload_unique_match": "唯一匹配時自動上傳: %s",
|
||||
"extendedae_plus.screen.upload.enter_search_key": "請輸入搜尋關鍵字後再新增對映",
|
||||
"extendedae_plus.screen.upload.enter_name": "請輸入名稱",
|
||||
"extendedae_plus.screen.upload.mapping_added": "已新增/更新對映: %s -> %s",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user