临时添加文本
This commit is contained in:
parent
bd214c1560
commit
d3436101f8
3 changed files with 38 additions and 24 deletions
|
@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.client.screens;
|
||||||
import com.atsuishio.superbwarfare.config.client.ModSellWarningConfig;
|
import com.atsuishio.superbwarfare.config.client.ModSellWarningConfig;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.components.AbstractButton;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
|
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
|
||||||
|
@ -61,11 +62,9 @@ public class ModSellWarningScreen extends WarningScreen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 正确实现提示文本
|
private static final Component TITLE = Component.translatable("multiplayer.superbwarfare.warning.title").withStyle(ChatFormatting.BOLD);
|
||||||
// private static final Component TITLE = Component.translatable("multiplayerWarning.header").withStyle(ChatFormatting.BOLD);
|
private static final Component CONTENT = Component.translatable("multiplayer.superbwarfare.warning.content");
|
||||||
private static final Component TITLE = Component.literal("test").withStyle(ChatFormatting.BOLD);
|
private static final Component CHECK = Component.translatable("multiplayer.superbwarfare.warning.check");
|
||||||
private static final Component CONTENT = Component.literal("这里应该写个多人游戏警告");
|
|
||||||
private static final Component CHECK = Component.literal("这里应该是确认勾选框");
|
|
||||||
private static final Component NARRATION = TITLE.copy().append("\n").append(CONTENT);
|
private static final Component NARRATION = TITLE.copy().append("\n").append(CONTENT);
|
||||||
private final Screen lastScreen;
|
private final Screen lastScreen;
|
||||||
|
|
||||||
|
@ -74,6 +73,30 @@ public class ModSellWarningScreen extends WarningScreen {
|
||||||
this.lastScreen = lastScreen;
|
this.lastScreen = lastScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initButtons(int pYOffset) {
|
||||||
|
this.addRenderableWidget(this.createProceedButton(pYOffset));
|
||||||
|
|
||||||
|
this.addRenderableWidget(
|
||||||
|
Button.builder(CommonComponents.GUI_BACK, button -> Minecraft.getInstance().setScreen(this.lastScreen))
|
||||||
|
.bounds(this.width / 2 - 155 + 160, 100 + pYOffset, 150, 20)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 实现按钮状态刷新
|
||||||
|
private AbstractButton createProceedButton(int pYOffset) {
|
||||||
|
boolean flag = this.stopShowing != null && this.stopShowing.selected();
|
||||||
|
var proceedButton = Button.builder(CommonComponents.GUI_PROCEED, button -> {
|
||||||
|
if (flag) {
|
||||||
|
ModSellWarningConfig.ENVIRONMENT_CHECKSUM.set(ENVIRONMENT_CHECKSUM);
|
||||||
|
ModSellWarningConfig.ENVIRONMENT_CHECKSUM.save();
|
||||||
|
}
|
||||||
|
Minecraft.getInstance().setScreen(new JoinMultiplayerScreen(this.lastScreen));
|
||||||
|
}).bounds(this.width / 2 - 155, 100 + pYOffset, 150, 20).build();
|
||||||
|
proceedButton.active = flag;
|
||||||
|
return proceedButton;
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||||
public static void onGuiOpen(ScreenEvent.Opening event) {
|
public static void onGuiOpen(ScreenEvent.Opening event) {
|
||||||
|
@ -86,21 +109,4 @@ public class ModSellWarningScreen extends WarningScreen {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
Minecraft.getInstance().setScreen(new ModSellWarningScreen(event.getCurrentScreen()));
|
Minecraft.getInstance().setScreen(new ModSellWarningScreen(event.getCurrentScreen()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initButtons(int pYOffset) {
|
|
||||||
this.addRenderableWidget(Button.builder(CommonComponents.GUI_PROCEED, button -> {
|
|
||||||
if (this.stopShowing.selected()) {
|
|
||||||
ModSellWarningConfig.ENVIRONMENT_CHECKSUM.set(ENVIRONMENT_CHECKSUM);
|
|
||||||
ModSellWarningConfig.ENVIRONMENT_CHECKSUM.save();
|
|
||||||
}
|
|
||||||
Minecraft.getInstance().setScreen(new JoinMultiplayerScreen(this.lastScreen));
|
|
||||||
}).bounds(this.width / 2 - 155, 100 + pYOffset, 150, 20).build());
|
|
||||||
|
|
||||||
this.addRenderableWidget(
|
|
||||||
Button.builder(CommonComponents.GUI_BACK, button -> Minecraft.getInstance().setScreen(this.lastScreen))
|
|
||||||
.bounds(this.width / 2 - 155 + 160, 100 + pYOffset, 150, 20)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,5 +525,9 @@
|
||||||
|
|
||||||
"config.jade.plugin_superbwarfare.vehicle_energy": "Vehicle Energy",
|
"config.jade.plugin_superbwarfare.vehicle_energy": "Vehicle Energy",
|
||||||
"config.jade.plugin_superbwarfare.vehicle_health": "Vehicle Health",
|
"config.jade.plugin_superbwarfare.vehicle_health": "Vehicle Health",
|
||||||
"config.jade.plugin_superbwarfare.container_entity": "Container Entity"
|
"config.jade.plugin_superbwarfare.container_entity": "Container Entity",
|
||||||
|
|
||||||
|
"multiplayer.superbwarfare.warning.title": "【卓越前线 警示声明】",
|
||||||
|
"multiplayer.superbwarfare.warning.content": "== 本模组完全免费开源,禁止用于任何商业行为 ==\n本模组代码采用GPL-3协议开源,美术资源私有禁止商用\n禁止付费下载、充值获取道具等违反协议和Mojang EULA的行为\n如遇以上行为,请到本模组仓库处提交Issue进行举报",
|
||||||
|
"multiplayer.superbwarfare.warning.check": "我已阅读并同意,不再显示此警告"
|
||||||
}
|
}
|
|
@ -525,5 +525,9 @@
|
||||||
|
|
||||||
"config.jade.plugin_superbwarfare.vehicle_energy": "载具能量",
|
"config.jade.plugin_superbwarfare.vehicle_energy": "载具能量",
|
||||||
"config.jade.plugin_superbwarfare.vehicle_health": "载具血量",
|
"config.jade.plugin_superbwarfare.vehicle_health": "载具血量",
|
||||||
"config.jade.plugin_superbwarfare.container_entity": "集装箱实体"
|
"config.jade.plugin_superbwarfare.container_entity": "集装箱实体",
|
||||||
|
|
||||||
|
"multiplayer.superbwarfare.warning.title": "【卓越前线 警示声明】",
|
||||||
|
"multiplayer.superbwarfare.warning.content": "== 本模组完全免费开源,禁止用于任何商业行为 ==\n本模组代码采用GPL-3协议开源,美术资源私有禁止商用\n禁止付费下载、充值获取道具等违反协议和Mojang EULA的行为\n如遇以上行为,请到本模组仓库处提交Issue进行举报",
|
||||||
|
"multiplayer.superbwarfare.warning.check": "我已阅读并同意,不再显示此警告"
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue