-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTitle.gd
45 lines (37 loc) · 1.35 KB
/
Title.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
extends Panel
const LogLine = preload("res://playback/log_line.tscn")
signal select
func set_victory(is_victory: bool):
if get_node_or_null("Title"): $Title.visible = !is_victory
if get_node_or_null("victorytext"): $victorytext.visible = is_victory
func mark_won(i: int):
for unlockline in get_node("%unlocks").get_children():
if unlockline.payload == i:
unlockline.modulate = Color(0.623529, 0.788235, 0.035294)
func clear_unlocks():
var unlocks = get_node("%unlocks")
for child in unlocks.get_children():
child.queue_free()
unlocks.remove_child(child)
func add_unlocked_line(i: int, did_win: bool):
var unlocks = get_node("%unlocks")
var unlockline = LogLine.instance()
unlocks.add_child(unlockline)
var treename = Meta.tree_name(i)
unlockline.set_label(str(Meta.display_date_index(i)," ", treename))
unlockline.connect("pressed", self, "log_click", [i, unlockline])
unlockline.payload = i
if did_win:
unlockline.modulate = Color(0.623529, 0.788235, 0.035294)
func log_click(id: int, node: Node):
emit_signal("select", id)
for logline in get_node("%unlocks").get_children():
logline.highlighted = false
if node:
node.highlighted = true
func pick_something():
var unlocks = get_node("%unlocks")
if unlocks.get_child_count() > 0:
log_click(unlocks.get_child(0).payload,unlocks.get_child(0))
else:
log_click(Meta.get_date_index(), null)