From 2625eeb7dedb05b524b08721e1267acdcd93e5c1 Mon Sep 17 00:00:00 2001 From: nea Date: Wed, 3 Aug 2022 02:31:05 +0200 Subject: scuffed config screen --- .../nea/notenoughupdates/gui/RepoManagementGui.kt | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 src/main/kotlin/moe/nea/notenoughupdates/gui/RepoManagementGui.kt (limited to 'src/main/kotlin/moe/nea/notenoughupdates/gui') diff --git a/src/main/kotlin/moe/nea/notenoughupdates/gui/RepoManagementGui.kt b/src/main/kotlin/moe/nea/notenoughupdates/gui/RepoManagementGui.kt new file mode 100644 index 0000000..115b9f8 --- /dev/null +++ b/src/main/kotlin/moe/nea/notenoughupdates/gui/RepoManagementGui.kt @@ -0,0 +1,77 @@ +package moe.nea.notenoughupdates.gui + +import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription +import io.github.cottonmc.cotton.gui.widget.WGridPanel +import io.github.cottonmc.cotton.gui.widget.WLabel +import io.github.cottonmc.cotton.gui.widget.WTextField +import io.github.cottonmc.cotton.gui.widget.WToggleButton +import io.github.cottonmc.cotton.gui.widget.data.Insets +import moe.nea.notenoughupdates.repo.RepoManager +import net.minecraft.network.chat.Component +import java.util.function.Consumer + +class RepoManagementGui : LightweightGuiDescription() { + init { + val root = WGridPanel() + setRootPanel(root) + + root.setSize(256, 240) + root.insets = Insets.ROOT_PANEL + + WLabel(Component.literal("Auto Update")).apply { + root.add(this, 0, 1, 5, 1) + } + + WToggleButton(Component.literal("Auto Update")).apply { + this.toggle = RepoManager.config.autoUpdate + this.onToggle = Consumer { + RepoManager.config.autoUpdate = it + RepoManager.markDirty() + } + root.add(this, 5, 1, 1, 1) + } + + + WLabel(Component.literal("Repo Username")).apply { + root.add(this, 0, 2, 5, 1) + } + + WTextField(Component.literal("username")).apply { + this.isEditable = true + this.text = RepoManager.config.user + this.setChangedListener { + RepoManager.config.user = it + RepoManager.markDirty() + } + root.add(this, 5, 2, 6, 1) + } + + WLabel(Component.literal("Repo Name")).apply { + root.add(this, 0, 3, 5, 1) + } + + WTextField(Component.literal("repo name")).apply { + this.isEditable = true + this.text = RepoManager.config.repo + this.setChangedListener { + RepoManager.config.repo = it + RepoManager.markDirty() + } + root.add(this, 5, 3, 6, 1) + } + + WLabel(Component.literal("Repo Branch")).apply { + root.add(this, 0, 4, 5, 1) + } + + WTextField(Component.literal("repo name")).apply { + this.isEditable = true + this.text = RepoManager.config.branch + this.setChangedListener { + RepoManager.config.branch = it + RepoManager.markDirty() + } + root.add(this, 5, 4, 6, 1) + } + } +} \ No newline at end of file -- cgit