From c11e0a8187cd5875fe8fd91ca00ba8668d6de9af Mon Sep 17 00:00:00 2001 From: Username404-59 <w.iron.zombie@gmail.com> Date: Sat, 15 May 2021 00:21:48 +0200 Subject: [PATCH] Use the category colors in buttons --- .../kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt index 5c83069..a9b8f81 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt @@ -16,7 +16,6 @@ import kotlin.reflect.full.findAnnotation @ApiStatus.Internal abstract class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { private val info = this::class.findAnnotation<ButtonInfo>() ?: throw Exception("Missing @Button annotaton") - override var color: Colors = info.color val title = this@ButtonImpl::class.simpleName protected open fun execAction() = Unit private var wasWithinBounds: Boolean = false @@ -60,7 +59,8 @@ abstract class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { } } ClickGui.components.filterIsInstance<ClickBox>().find { + this.color = info.parent.categoryColor it.name!!.key == info.parent.translationKey }?.buttons!!.add(this) } -} +} \ No newline at end of file