You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.4 KiB
63 lines
1.4 KiB
extends Resource
|
|
class_name MajorityJudgmentGrading
|
|
|
|
"""
|
|
An ordered list of grades, from worst to best.
|
|
|
|
It's VERY IMPORTANT that the grades be NON-AMBIGUOUS,
|
|
that everyone would sort the grades in the same order
|
|
if they were given shuffled.
|
|
"""
|
|
|
|
|
|
# Array of MajorityJudgmentGrade
|
|
# From worst to best
|
|
export(Array) var grades:Array setget set_grades, get_grades
|
|
|
|
|
|
static func make_empty():
|
|
return load("res://addons/majority_judgment/MajorityJudgmentGrading.gd").new()
|
|
|
|
|
|
static func make_quality_6():
|
|
var grading = make_empty()
|
|
grading.set_grades([
|
|
MajorityJudgmentGrade.make("To Reject"),
|
|
MajorityJudgmentGrade.make("Poor"),
|
|
MajorityJudgmentGrade.make("Passable"),
|
|
MajorityJudgmentGrade.make("Good"),
|
|
MajorityJudgmentGrade.make("Very Good"),
|
|
MajorityJudgmentGrade.make("Excellent"),
|
|
])
|
|
return grading
|
|
|
|
|
|
func set_grades(_grades:Array):
|
|
assert(_grades, "Provide an array of MajorityJudgmentGrade")
|
|
grades = _grades
|
|
for i in range(grades.size()):
|
|
grades[i].worth = i
|
|
|
|
|
|
func get_grades() -> Array:
|
|
return grades
|
|
|
|
|
|
func get_colors() -> Array:
|
|
assert(grades.size() == 6, "WIP")
|
|
return [
|
|
Color("#e0361c"),
|
|
Color("#ee6e00"),
|
|
Color("#fdb200"),
|
|
Color("#c6d700"),
|
|
Color("#7ec239"),
|
|
Color("#02ab58"),
|
|
# Color("#007e3d"),
|
|
]
|
|
|
|
|
|
func get_color_of_grade(grade_index:int):
|
|
var colors = get_colors()
|
|
grade_index = clamp(grade_index, 0, colors.size()-1)
|
|
return colors[grade_index]
|