-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NodeRule.gd
86 lines (77 loc) · 1.82 KB
/
NodeRule.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
extends Resource
class_name NodeRule
enum COLORS {
black,
blue,
yellow,
green,
purple,
}
@export var color : COLORS = COLORS.black
func _init():
resource_local_to_scene = true
func check_correctness(_local_node: PuzzleNode) -> bool:
return true
static func get_default_color(c: COLORS) -> Color:
var preset: String
if not Engine.is_editor_hint():
preset = SaveData.save_handler.vget_value(["options", "accessibility", "preset"], "default")
else:
preset = "default"
match preset:
"tritanopia":
match c:
NodeRule.COLORS.black:
return Color(0, 0, 0)
NodeRule.COLORS.blue:
return Color("#87FF00")
NodeRule.COLORS.yellow:
return Color("FFAA46")
NodeRule.COLORS.green:
return Color("#C52525")
NodeRule.COLORS.purple:
return Color("#44A059")
_:
return Color("#ff00ff")
"deuteranopia":
match c:
NodeRule.COLORS.black:
return Color(0, 0, 0)
NodeRule.COLORS.blue:
return Color("#71b1ff")
NodeRule.COLORS.yellow:
return Color("ffaa46")
NodeRule.COLORS.green:
return Color("#004D92")
NodeRule.COLORS.purple:
return Color("#ff7bb7")
_:
return Color("#ff00ff")
"protanopia":
match c:
NodeRule.COLORS.black:
return Color(0, 0, 0)
NodeRule.COLORS.blue:
return Color("#71b1ff")
NodeRule.COLORS.yellow:
return Color("ffaa46")
NodeRule.COLORS.green:
return Color("#D63636")
NodeRule.COLORS.purple:
return Color("#ff7bb7")
_:
return Color("#ff00ff")
_:
match c:
NodeRule.COLORS.black:
return Color(0, 0, 0)
NodeRule.COLORS.blue:
return Color("#71b1ff")
NodeRule.COLORS.yellow:
return Color("ffaa46")
NodeRule.COLORS.green:
return Color("#72c157")
NodeRule.COLORS.purple:
return Color("#ff7bb7")
_:
return Color("#ff00ff")