diff options
author | jacopograndi <jacopo.grandi@outlook.it> | 2021-12-24 21:11:39 +0100 |
---|---|---|
committer | jacopograndi <jacopo.grandi@outlook.it> | 2021-12-24 21:11:39 +0100 |
commit | 7cb4290601010459b09376396c7833ec391c25bf (patch) | |
tree | be6243e49ad764f90418e6d41641f99209da2b29 /scripts/gui_top_bar.gd | |
parent | e9598b88841374301646a7115253ab38ac904e4c (diff) |
working on it
Diffstat (limited to 'scripts/gui_top_bar.gd')
-rw-r--r-- | scripts/gui_top_bar.gd | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/gui_top_bar.gd b/scripts/gui_top_bar.gd new file mode 100644 index 0000000..a002e87 --- /dev/null +++ b/scripts/gui_top_bar.gd @@ -0,0 +1,31 @@ +extends Control + +var _in_editor : bool +var _editor_button : Button +var _hbox : HBoxContainer + +var _resources : Node +var _gui : Control + +func refresh (in_editor : bool): + _in_editor = in_editor + + var root = get_tree().root.get_child(0) + _resources = root.get_node("player").get_node("resources") + + if _gui == null: _gui = get_parent() + if _hbox == null: _hbox = $panel/resources/HBoxContainer + if _editor_button == null: _editor_button = $panel/editor_button + + if _in_editor: _editor_button.text = "Editor" + else: _editor_button.text = "Playmode" + +func _process (_delta): + for r in _resources.get_names(): + _hbox.get_node(r).text = str(_resources[r]) + r + +func _on_editor_button_down(): + _gui.player.gui_editor_toggle_event() + +func _on_wave_button_pressed(): + _gui.player.gui_start_wave_event() |