Squashed commit
This commit is contained in:
parent
c713781de4
commit
c3d8ff6989
14 changed files with 308 additions and 120 deletions
|
|
@ -1,38 +1,4 @@
|
|||
extends MarginContainer
|
||||
|
||||
var _displayed_floor := -1
|
||||
|
||||
func _ready():
|
||||
$StatsColumn/FloorLabel.text = "FLOOR: 10"
|
||||
$StatsColumn/SavedLabel.text = "SAVED: 0"
|
||||
$StatsColumn/PeopleLabel.text = "PEOPLE: 0/2"
|
||||
$StatsColumn/ScoreLabel.text = "SCORE: 0"
|
||||
|
||||
EventBus.floor_changed.connect(update_floor)
|
||||
EventBus.saved_changed.connect(update_saved)
|
||||
EventBus.people_changed.connect(update_people)
|
||||
EventBus.score_changed.connect(update_score)
|
||||
|
||||
func update_floor(floor_num: int):
|
||||
if _displayed_floor == floor_num:
|
||||
return
|
||||
var label = $StatsColumn/FloorLabel
|
||||
var new_text = "FLOOR: " + str(floor_num)
|
||||
if _displayed_floor == -1:
|
||||
label.text = new_text
|
||||
_displayed_floor = floor_num
|
||||
return
|
||||
_displayed_floor = floor_num
|
||||
UIUtils.flip_label_text(label, new_text)
|
||||
|
||||
func update_saved(count: int):
|
||||
$StatsColumn/SavedLabel.text = "SAVED: " + str(count)
|
||||
|
||||
func update_people(count: int, threshold: int):
|
||||
var label = $StatsColumn/PeopleLabel
|
||||
label.text = "PEOPLE: " + str(count) + "/" + str(threshold)
|
||||
var color = Color(0.4, 1.0, 0.4) if count >= threshold else Color(1.0, 0.4, 0.4)
|
||||
label.add_theme_color_override("font_color", color)
|
||||
|
||||
func update_score(new_score: int):
|
||||
$StatsColumn/ScoreLabel.text = "SCORE: " + str(new_score)
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue