【发布时间】:2021-07-20 22:24:36
【问题描述】:
我正在开发一个具有关卡的应用程序,每个关卡都有不同的符号和背景颜色。例如,级别 1 将具有 R.drawable.circle、R.drawable.red_background。 是否可以使用范围存储在枚举中
enum class LevelEnum(levelSymbol: Int, levelColor: Int) {
1..21(R.drawable.circle, R.drawable.red_background),
22..50(R.drawable.rectangle, R.drawable.blue_background),
....
}
【问题讨论】:
-
你有什么特别要求枚举类的原因吗?