Add a addBox() method to the Category enum class and complete the constructor that uses a ClickBox
This commit is contained in:
parent
dbc7f6b8bf
commit
1ac22a7e97
|
@ -36,13 +36,18 @@ annotation class ButtonInfo(
|
|||
name = TranslatableComponent(translationKey),
|
||||
color = categoryColor
|
||||
); private set
|
||||
private fun addBox() = ClickGui.components.add(box.apply { if (shouldHide) hidden = true })
|
||||
constructor(
|
||||
translationKey: String, categoryColor: Colors, condition: Boolean = false
|
||||
): this(translationKey, categoryColor.hexValue, condition)
|
||||
constructor(box: ClickBox): this(translationKey = box.name.key, categoryColor = box.color) { this.box = box }
|
||||
init {
|
||||
ClickGui.components.add(box.apply { if (shouldHide) hidden = true })
|
||||
constructor(categoryBox: ClickBox): this(translationKey = categoryBox.name.key, categoryColor = categoryBox.color) {
|
||||
with(ClickGui.components) {
|
||||
remove(this@Category.box)
|
||||
this@Category.box = categoryBox
|
||||
addBox()
|
||||
}
|
||||
}
|
||||
init { addBox() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue