-
Notifications
You must be signed in to change notification settings - Fork 2
/
Options.gd
51 lines (39 loc) · 1.54 KB
/
Options.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
extends HBoxContainer
signal color_changed(color)
signal additive_text(toggle)
signal pre_animation(toggle)
signal flip(toggle)
signal no_interrupt(toggle)
onready var additive_button: CheckBox = $AdditiveButton as CheckBox
onready var option_button: OptionButton = $OptionButton as OptionButton
var colorlist = [{"name": "White", "color": ColorN("white")},
{"name": "Red", "color": ColorN("red")},
{"name": "Orange", "color": Color("#ffa500")},
{"name": "Yellow", "color": ColorN("yellow")},
{"name": "Green", "color": ColorN("green")},
{"name": "Blue", "color": Color("#0088ff")},
{"name": "Aqua", "color": ColorN("aqua")},
{"name": "Purple", "color": Color("#ff55ff")}]
func _ready():
var i = 0
for color in colorlist:
option_button.add_item(color["name"], i)
option_button.set_item_metadata(i, color["color"])
i += 1
func _on_OptionButton_item_selected(ID):
emit_signal("color_changed", option_button.get_item_metadata(ID))
print(option_button.get_item_metadata(ID))
func _on_AdditiveButton_toggled(button_pressed):
emit_signal("additive_text", button_pressed)
func _on_Pre_toggled(button_pressed):
emit_signal("pre_animation", button_pressed)
func _on_Toggle_pre():
$PreButton.pressed = !$PreButton.pressed
emit_signal("pre_animation", $PreButton.pressed)
func _on_Pre_off():
$PreButton.pressed = false
emit_signal("pre_animation", false)
func _on_Flip_toggled(button_pressed):
emit_signal("flip", button_pressed)
func _on_NoInterruptButton_toggled(button_pressed):
emit_signal("no_interrupt", button_pressed)