Fix the ClickBoxes not being positioned correctly when one of them is hidden
This commit is contained in:
parent
1aa4c374d1
commit
674d630db0
|
@ -18,7 +18,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
|
||||||
ClickGui.clickBoxes.find { box ->
|
ClickGui.clickBoxes.find { box ->
|
||||||
it.let { impl ->
|
it.let { impl ->
|
||||||
with(impl) {
|
with(impl) {
|
||||||
if (info.kind == Type.TOGGLE) {
|
if (info.kind == Type.TOGGLE && !info.parent.shouldHide) {
|
||||||
Configuration.enabledFeatures[title]?.let { bool ->
|
Configuration.enabledFeatures[title]?.let { bool ->
|
||||||
toggled = bool
|
toggled = bool
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,6 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
|
||||||
it.getDeclaredField("INSTANCE").get(null)
|
it.getDeclaredField("INSTANCE").get(null)
|
||||||
} catch (e: NoSuchFieldException) {}
|
} catch (e: NoSuchFieldException) {}
|
||||||
} as? ButtonImpl
|
} as? ButtonImpl
|
||||||
}.filterNot {
|
|
||||||
(it.info.parent == Category.RISKY) && !riskyCheats
|
|
||||||
}.plus(Configuration.foundMacros).toTypedArray()
|
}.plus(Configuration.foundMacros).toTypedArray()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,9 @@ annotation class ButtonInfo(
|
||||||
CLICK
|
CLICK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}; enum class Category(val translationKey: String, val categoryColor: Int) {
|
}; enum class Category(val translationKey: String, val categoryColor: Int, val shouldHide: Boolean = false) {
|
||||||
MISC("snowy.clickbox.misc", Colors.BLUE),
|
MISC("snowy.clickbox.misc", Colors.BLUE),
|
||||||
RISKY("snowy.clickbox.risky", Colors.RED),
|
RISKY("snowy.clickbox.risky", Colors.RED, !riskyCheats),
|
||||||
MACROS("snowy.clickbox.macros", Colors.GREEN);
|
MACROS("snowy.clickbox.macros", Colors.GREEN);
|
||||||
companion object {
|
companion object {
|
||||||
fun fromBox(box: ClickBox): Category? = values().find {
|
fun fromBox(box: ClickBox): Category? = values().find {
|
||||||
|
@ -41,9 +41,11 @@ annotation class ButtonInfo(
|
||||||
name = TranslatableComponent(translationKey),
|
name = TranslatableComponent(translationKey),
|
||||||
color = categoryColor
|
color = categoryColor
|
||||||
); private set
|
); private set
|
||||||
constructor(translationKey: String, categoryColor: Colors): this(translationKey, categoryColor.hexValue)
|
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 }
|
constructor(box: ClickBox): this(translationKey = box.name.key, categoryColor = box.color) { this.box = box }
|
||||||
init {
|
init {
|
||||||
ClickGui.components.add(box)
|
ClickGui.components.add(box.apply { if (shouldHide) hidden = true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue