RealmsParentalConsentScreen.java
com.mojang.realmsclient.gui.screens.RealmsParentalConsentScreen
信息
- 全限定名:com.mojang.realmsclient.gui.screens.RealmsParentalConsentScreen
- 类型:public class
- 包:com.mojang.realmsclient.gui.screens
- 源码路径:src/main/java/com/mojang/realmsclient/gui/screens/RealmsParentalConsentScreen.java
- 起始行号:L19
- 继承:RealmsScreen
- 职责:
TODO
字段/常量
-
MESSAGE- 类型:
Component - 修饰符:
private static final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
SPACING- 类型:
int - 修饰符:
private static final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
layout- 类型:
LinearLayout - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
lastScreen- 类型:
Screen - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
-
textWidget- 类型:
MultiLineTextWidget - 修饰符:
private - 源码定位:
L24 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public RealmsParentalConsentScreen(Screen lastScreen) @ L26
- 构造器名:RealmsParentalConsentScreen
- 源码定位:L26
- 修饰符:public
参数:
- lastScreen: Screen
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void init() @ L31
- 方法名:init
- 源码定位:L31
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void onClose() @ L44
- 方法名:onClose
- 源码定位:L44
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
protected void repositionElements() @ L49
- 方法名:repositionElements
- 源码定位:L49
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
public Component getNarrationMessage() @ L59
- 方法名:getNarrationMessage
- 源码定位:L59
- 返回类型:Component
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class RealmsParentalConsentScreen extends RealmsScreen {
private static final Component MESSAGE = Component.translatable("mco.account.privacy.information");
private static final int SPACING = 15;
private final LinearLayout layout = LinearLayout.vertical();
private final Screen lastScreen;
private @Nullable MultiLineTextWidget textWidget;
public RealmsParentalConsentScreen(Screen lastScreen) {
super(GameNarrator.NO_TITLE);
this.lastScreen = lastScreen;
}
@Override
public void init() {
this.layout.spacing(15).defaultCellSetting().alignHorizontallyCenter();
this.textWidget = new MultiLineTextWidget(MESSAGE, this.font).setCentered(true);
this.layout.addChild(this.textWidget);
LinearLayout buttonLayout = this.layout.addChild(LinearLayout.horizontal().spacing(8));
Component privacyInfo = Component.translatable("mco.account.privacy.info.button");
buttonLayout.addChild(Button.builder(privacyInfo, ConfirmLinkScreen.confirmLink(this, CommonLinks.GDPR)).build());
buttonLayout.addChild(Button.builder(CommonComponents.GUI_BACK, button -> this.onClose()).build());
this.layout.visitWidgets(x$0 -> this.addRenderableWidget(x$0));
this.repositionElements();
}
@Override
public void onClose() {
this.minecraft.setScreen(this.lastScreen);
}
@Override
protected void repositionElements() {
if (this.textWidget != null) {
this.textWidget.setMaxWidth(this.width - 15);
}
this.layout.arrangeElements();
FrameLayout.centerInRectangle(this.layout, this.getRectangle());
}
@Override
public Component getNarrationMessage() {
return MESSAGE;
}
}引用的其他类
-
- 引用位置:
方法调用 - 关联成员:
Button.builder()
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
MultiLineTextWidget()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
FrameLayout.centerInRectangle()
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
LinearLayout.horizontal(), LinearLayout.vertical()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ConfirmLinkScreen.confirmLink()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段/方法调用/返回值 - 关联成员:
Component.translatable()
- 引用位置:
-
- 引用位置:
继承
- 引用位置: