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),
|
name = TranslatableComponent(translationKey),
|
||||||
color = categoryColor
|
color = categoryColor
|
||||||
); private set
|
); private set
|
||||||
|
private fun addBox() = ClickGui.components.add(box.apply { if (shouldHide) hidden = true })
|
||||||
constructor(
|
constructor(
|
||||||
translationKey: String, categoryColor: Colors, condition: Boolean = false
|
translationKey: String, categoryColor: Colors, condition: Boolean = false
|
||||||
): this(translationKey, categoryColor.hexValue, condition)
|
): this(translationKey, categoryColor.hexValue, condition)
|
||||||
constructor(box: ClickBox): this(translationKey = box.name.key, categoryColor = box.color) { this.box = box }
|
constructor(categoryBox: ClickBox): this(translationKey = categoryBox.name.key, categoryColor = categoryBox.color) {
|
||||||
init {
|
with(ClickGui.components) {
|
||||||
ClickGui.components.add(box.apply { if (shouldHide) hidden = true })
|
remove(this@Category.box)
|
||||||
|
this@Category.box = categoryBox
|
||||||
|
addBox()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
init { addBox() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue