diff --git a/src/main/kotlin/codes/som/hibiscus/api/feature/values/EnumValue.kt b/src/main/kotlin/codes/som/hibiscus/api/feature/values/EnumValue.kt index 4522c35..d7f4768 100644 --- a/src/main/kotlin/codes/som/hibiscus/api/feature/values/EnumValue.kt +++ b/src/main/kotlin/codes/som/hibiscus/api/feature/values/EnumValue.kt @@ -8,12 +8,12 @@ class EnumValue>(name: String, value: E) : RegisteredValue(name, return value .javaClass .enumConstants - .first { it.name.equals(representation, ignoreCase = true) } + .first { it.toString().equals(representation, ignoreCase = true) } } override fun drawUIControl() { val selectedValue = ImInt(value.ordinal ?: -1) - ImGui.combo(name, selectedValue, value.javaClass.enumConstants.map { it.name }.toTypedArray()) + ImGui.combo(name, selectedValue, value.javaClass.enumConstants.map { it.toString() }.toTypedArray()) value = value.javaClass.enumConstants[selectedValue.get()] } } @@ -24,12 +24,16 @@ class OptionalEnumValue>( value: E? ) : RegisteredValue(name, value) { override fun convertValueFromString(representation: String): E { - return enumType.enumConstants.first { it.name.equals(representation, ignoreCase = true) } + return enumType.enumConstants.first { it.toString().equals(representation, ignoreCase = true) } } override fun drawUIControl() { val selectedValue = ImInt(value?.ordinal ?: -1) - ImGui.combo(name, selectedValue, arrayOf("") + enumType.enumConstants.map { it.name }.toTypedArray()) + ImGui.combo( + name, + selectedValue, + arrayOf("") + enumType.enumConstants.map { it.toString() }.toTypedArray() + ) value = enumType.enumConstants.getOrNull(selectedValue.get() - 1) } }