From 6ef0b0b64522ae45bf3747b26bd6dc5f58358f82 Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Sun, 6 Feb 2022 10:39:36 +0700 Subject: 1.3.0 --- .../kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt | 8 +++----- .../kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt | 12 ++++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src/main/kotlin/cc/woverflow/chatting/gui') diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt index d75339b..983e2ed 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutEditGui.kt @@ -8,10 +8,7 @@ import gg.essential.elementa.WindowScreen import gg.essential.elementa.components.UIBlock import gg.essential.elementa.constraints.CenterConstraint import gg.essential.elementa.constraints.SiblingConstraint -import gg.essential.elementa.dsl.childOf -import gg.essential.elementa.dsl.constrain -import gg.essential.elementa.dsl.percent -import gg.essential.elementa.dsl.pixels +import gg.essential.elementa.dsl.* import gg.essential.vigilance.gui.VigilancePalette import gg.essential.vigilance.gui.settings.ButtonComponent import gg.essential.vigilance.gui.settings.TextComponent @@ -24,7 +21,8 @@ class ChatShortcutEditGui(private var alias: String, private var command: String override fun initScreen(width: Int, height: Int) { super.initScreen(width, height) - val block = UIBlock(VigilancePalette.getBackground()).constrain { + window.clearChildren() // make sure everything is cleared, sometimes the shortcuts duplicated + val block by UIBlock(VigilancePalette.getBackground()).constrain { this.x = CenterConstraint() this.y = CenterConstraint() this.width = 100.pixels() diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt index a4a9f70..0fa2ef7 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt @@ -5,6 +5,7 @@ import cc.woverflow.chatting.gui.components.TextBlock import gg.essential.api.EssentialAPI import gg.essential.elementa.ElementaVersion import gg.essential.elementa.WindowScreen +import gg.essential.elementa.components.ScrollComponent import gg.essential.elementa.components.UIBlock import gg.essential.elementa.constraints.CenterConstraint import gg.essential.elementa.constraints.RelativeWindowConstraint @@ -16,13 +17,20 @@ import gg.essential.vigilance.gui.settings.ButtonComponent class ChatShortcutViewGui : WindowScreen(version = ElementaVersion.V1) { override fun initScreen(width: Int, height: Int) { super.initScreen(width, height) + window.clearChildren() // make sure everything is cleared, sometimes the shortcuts duplicated + val container by ScrollComponent() constrain { + x = 0.pixels() + y = 0.pixels() + this.width = 85.percent() + this.height = 85.percent() + } childOf window for ((index, shortcut) in ChatShortcuts.shortcuts.withIndex()) { val block = UIBlock(VigilancePalette.getBackground()).constrain { x = 3.percent() y = (index * 12).percent() this.width = 94.percent() this.height = 25.pixels() - } childOf this.window + } childOf container TextBlock(shortcut.first).constrain { x = RelativeWindowConstraint(0.05F) y = CenterConstraint() @@ -51,7 +59,7 @@ class ChatShortcutViewGui : WindowScreen(version = ElementaVersion.V1) { EssentialAPI.getGuiUtil().openScreen(ChatShortcutEditGui("", "", false)) } constrain { x = CenterConstraint() - y = 80.percent() + y = 90.percent() } childOf window } } \ No newline at end of file -- cgit