Stats.gd 958 B

1234567891011121314151617181920212223242526
  1. extends PanelContainer
  2. #
  3. @onready var levelLabel : Label = $Margin/VBox/Level/Value
  4. @onready var locationLabel : Label = $Margin/VBox/Location/Value
  5. @onready var selection : Control = $Margin/VBox/Selection
  6. @onready var previousButton : Button = $Margin/VBox/Selection/Previous
  7. @onready var nextButton : Button = $Margin/VBox/Selection/Next
  8. #
  9. func SetInfo(info : Dictionary):
  10. levelLabel.set_text(str(info["level"]))
  11. var mapData : FileData = DB.MapsDB.get(info["pos_map"], null)
  12. if mapData:
  13. locationLabel.set_text(mapData._name)
  14. #
  15. func _unhandled_input(event : InputEvent):
  16. if visible:
  17. if previousButton and previousButton.is_visible() and event.is_action("ui_left"):
  18. if Launcher.Action.TryPressed(event, "ui_left", true):
  19. previousButton.pressed.emit()
  20. elif nextButton and nextButton.is_visible() and event.is_action("ui_right"):
  21. if Launcher.Action.TryPressed(event, "ui_right", true):
  22. nextButton.pressed.emit()