Added some important stuff again
This commit is contained in:
@@ -294,7 +294,51 @@ public class MyScreen extends BaseOwoScreen<FlowLayout> {
|
||||
}
|
||||
|
||||
private void buildSettingsPanel(FlowLayout content) {
|
||||
content.child(UIComponents.label(Component.literal("Settings tab - coming soon")));
|
||||
content.child(UIComponents.label(Component.literal("Settings")));
|
||||
content.child(makeCyclingButton());
|
||||
}
|
||||
|
||||
private record ButtonState(String label, Runnable onSelect) {}
|
||||
|
||||
private FlowLayout makeCyclingButton() { // muss ich noch fertig machen, bitte es geht mir nd gut, es ist 23:00
|
||||
List<ButtonState> states = List.of(
|
||||
new ButtonState("Off", () -> {
|
||||
}),
|
||||
new ButtonState("Low", () -> {
|
||||
}),
|
||||
new ButtonState("Medium", () -> {
|
||||
}),
|
||||
new ButtonState("High", () -> {
|
||||
|
||||
})
|
||||
);
|
||||
|
||||
int[] currentIndex = {0};
|
||||
|
||||
FlowLayout button = UIContainers.verticalFlow(Sizing.fixed(60), Sizing.fixed(20));
|
||||
button.verticalAlignment(VerticalAlignment.CENTER);
|
||||
button.horizontalAlignment(HorizontalAlignment.CENTER);
|
||||
button.surface(FLAT);
|
||||
|
||||
var label = UIComponents.label(Component.literal(states.get(0).label()))
|
||||
.color(Color.ofRgb(0xFFFFFF));
|
||||
button.child(label);
|
||||
|
||||
button.mouseDown().subscribe((click, doubled) -> {
|
||||
Minecraft.getInstance().getSoundManager().play(
|
||||
SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK.value(), 2.0F, 2)
|
||||
);
|
||||
|
||||
currentIndex[0] = (currentIndex[0] + 1) % states.size();
|
||||
ButtonState newState = states.get(currentIndex[0]);
|
||||
|
||||
label.text(Component.literal(newState.label()));
|
||||
newState.onSelect().run();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
private FlowLayout makeSmallButton(Surface baseSurface, Identifier texture, Runnable onClick) {
|
||||
|
||||
Reference in New Issue
Block a user