-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverviewTable.gd
63 lines (47 loc) · 1.92 KB
/
OverviewTable.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
extends PanelContainer
@onready var item_list = $VBoxContainer/ItemList
var toggled := false
signal ftyfty
signal phone
signal audience
func _ready():
position.x = get_viewport_rect().size.x - size.x
get_tree().get_root().size_changed.connect(_adapt_size)
item_list.select(item_list.get_item_count() - 1)
$VBoxContainer/JokerContainer/FtyFtyButton.pressed.connect(emit_signal.bind("ftyfty"))
$VBoxContainer/JokerContainer/CallButton.pressed.connect(emit_signal.bind("ftyfty"))
$VBoxContainer/JokerContainer/AudienceButton.pressed.connect(emit_signal.bind("ftyfty"))
$VBoxContainer/JokerContainer/FtyFtyButton.pressed.connect(_disable_button.bind($VBoxContainer/JokerContainer/FtyFtyButton))
$VBoxContainer/JokerContainer/CallButton.pressed.connect(_disable_button.bind($VBoxContainer/JokerContainer/CallButton))
$VBoxContainer/JokerContainer/AudienceButton.pressed.connect(_disable_button.bind($VBoxContainer/JokerContainer/AudienceButton))
func _disable_button(button):
button.disabled = true
func _adapt_size():
visible = false
toggled = false
func on_question_no_changed(no):
item_list.select(item_list.get_item_count() - no)
func _input(event):
if event.is_action_pressed("toggle_overview"):
visible = true
if !toggled:
var interpolation_tween = get_tree().create_tween()
interpolation_tween.set_trans(Tween.TRANS_CUBIC)
interpolation_tween.set_ease(Tween.EASE_IN_OUT)
interpolation_tween.tween_property(
self, "position:x",
get_viewport_rect().size.x - size.x, 0.5
)
interpolation_tween.play()
await interpolation_tween.finished
else:
var interpolation_tween = get_tree().create_tween()
interpolation_tween.set_trans(Tween.TRANS_CUBIC)
interpolation_tween.set_ease(Tween.EASE_IN_OUT)
interpolation_tween.tween_property(
self, "position:x",
get_viewport_rect().size.x, 0.5
)
interpolation_tween.play()
await interpolation_tween.finished
toggled = !toggled