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

    • 引用位置: 方法调用
    • 关联成员: Button.builder()
  • MultiLineTextWidget

    • 引用位置: 字段/构造调用
    • 关联成员: MultiLineTextWidget()
  • FrameLayout

    • 引用位置: 方法调用
    • 关联成员: FrameLayout.centerInRectangle()
  • LinearLayout

    • 引用位置: 字段/方法调用
    • 关联成员: LinearLayout.horizontal(), LinearLayout.vertical()
  • ConfirmLinkScreen

    • 引用位置: 方法调用
    • 关联成员: ConfirmLinkScreen.confirmLink()
  • Screen

    • 引用位置: 参数/字段
  • Component

    • 引用位置: 字段/方法调用/返回值
    • 关联成员: Component.translatable()
  • RealmsScreen

    • 引用位置: 继承