ChatReportScreen.java
net.minecraft.client.gui.screens.reporting.ChatReportScreen
信息
- 全限定名:net.minecraft.client.gui.screens.reporting.ChatReportScreen
- 类型:public class
- 包:net.minecraft.client.gui.screens.reporting
- 源码路径:src/main/java/net/minecraft/client/gui/screens/reporting/ChatReportScreen.java
- 起始行号:L19
- 继承:AbstractReportScreen<ChatReport.Builder>
- 职责:
TODO
字段/常量
-
TITLE- 类型:
Component - 修饰符:
private static final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
SELECT_CHAT_MESSAGE- 类型:
Component - 修饰符:
private static final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
commentBox- 类型:
MultiLineEditBox - 修饰符:
private - 源码定位:
L22 - 说明:
TODO
- 类型:
-
selectMessagesButton- 类型:
Button - 修饰符:
private - 源码定位:
L23 - 说明:
TODO
- 类型:
-
selectReasonButton- 类型:
Button - 修饰符:
private - 源码定位:
L24 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
private ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, ChatReport.Builder reportBuilder) @ L26
- 构造器名:ChatReportScreen
- 源码定位:L26
- 修饰符:private
参数:
- lastScreen: Screen
- reportingContext: ReportingContext
- reportBuilder: ChatReport.Builder
说明:
TODO
public ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID playerId) @ L30
- 构造器名:ChatReportScreen
- 源码定位:L30
- 修饰符:public
参数:
- lastScreen: Screen
- reportingContext: ReportingContext
- playerId: UUID
说明:
TODO
public ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, ChatReport draft) @ L34
- 构造器名:ChatReportScreen
- 源码定位:L34
- 修饰符:public
参数:
- lastScreen: Screen
- reportingContext: ReportingContext
- draft: ChatReport
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected void addContent() @ L38
- 方法名:addContent
- 源码定位:L38
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
protected void onReportChanged() @ L68
- 方法名:onReportChanged
- 源码定位:L68
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
public boolean mouseReleased(MouseButtonEvent event) @ L87
- 方法名:mouseReleased
- 源码定位:L87
- 返回类型:boolean
- 修饰符:public
参数:
- event: MouseButtonEvent
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class ChatReportScreen extends AbstractReportScreen<ChatReport.Builder> {
private static final Component TITLE = Component.translatable("gui.chatReport.title");
private static final Component SELECT_CHAT_MESSAGE = Component.translatable("gui.chatReport.select_chat");
private MultiLineEditBox commentBox;
private Button selectMessagesButton;
private Button selectReasonButton;
private ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, ChatReport.Builder reportBuilder) {
super(TITLE, lastScreen, reportingContext, reportBuilder);
}
public ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, UUID playerId) {
this(lastScreen, reportingContext, new ChatReport.Builder(playerId, reportingContext.sender().reportLimits()));
}
public ChatReportScreen(Screen lastScreen, ReportingContext reportingContext, ChatReport draft) {
this(lastScreen, reportingContext, new ChatReport.Builder(draft, reportingContext.sender().reportLimits()));
}
@Override
protected void addContent() {
this.selectMessagesButton = this.layout
.addChild(
Button.builder(
SELECT_CHAT_MESSAGE,
b -> this.minecraft.setScreen(new ChatSelectionScreen(this, this.reportingContext, this.reportBuilder, updatedReport -> {
this.reportBuilder = updatedReport;
this.onReportChanged();
}))
)
.width(280)
.build()
);
this.selectReasonButton = Button.builder(
SELECT_REASON, b -> this.minecraft.setScreen(new ReportReasonSelectionScreen(this, this.reportBuilder.reason(), ReportType.CHAT, reason -> {
this.reportBuilder.setReason(reason);
this.onReportChanged();
}))
)
.width(280)
.build();
this.layout.addChild(CommonLayouts.labeledElement(this.font, this.selectReasonButton, OBSERVED_WHAT_LABEL));
this.commentBox = this.createCommentBox(280, 9 * 8, comments -> {
this.reportBuilder.setComments(comments);
this.onReportChanged();
});
this.layout.addChild(CommonLayouts.labeledElement(this.font, this.commentBox, MORE_COMMENTS_LABEL, s -> s.paddingBottom(12)));
}
@Override
protected void onReportChanged() {
IntSet reportedMessages = this.reportBuilder.reportedMessages();
if (reportedMessages.isEmpty()) {
this.selectMessagesButton.setMessage(SELECT_CHAT_MESSAGE);
} else {
this.selectMessagesButton.setMessage(Component.translatable("gui.chatReport.selected_chat", reportedMessages.size()));
}
ReportReason reportReason = this.reportBuilder.reason();
if (reportReason != null) {
this.selectReasonButton.setMessage(reportReason.title());
} else {
this.selectReasonButton.setMessage(SELECT_REASON);
}
super.onReportChanged();
}
@Override
public boolean mouseReleased(MouseButtonEvent event) {
return super.mouseReleased(event) ? true : this.commentBox.mouseReleased(event);
}
}引用的其他类
-
- 引用位置:
字段/方法调用 - 关联成员:
Button.builder()
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CommonLayouts.labeledElement()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
ChatSelectionScreen()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
ReportReasonSelectionScreen()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/方法调用/构造调用/继承 - 关联成员:
Builder(), ChatReport.Builder()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
Component.translatable()
- 引用位置: