Browse Source

Adding a (hacky) method for generating the save icon and hiding the UI

pull/16/head
Ryan Reed 1 month ago
parent
commit
59f8346774
3 changed files with 13 additions and 0 deletions
  1. +2
    -0
      save_load/components/save_level_data_component.gd
  2. +6
    -0
      save_load/ui/save_load_ui.gd
  3. +5
    -0
      scenes/root.tscn

+ 2
- 0
save_load/components/save_level_data_component.gd View File

@ -3,7 +3,9 @@
class_name SaveLevelDataComponent
extends Node
@export var settings: SaveGameSettings ## The SaveGameSettings resource
@export var ui_node: CanvasLayer ## The UI to Show/Hide when taking screenshot (e.g. save icon generation)
func _ready() -> void:


+ 6
- 0
save_load/ui/save_load_ui.gd View File

@ -22,8 +22,14 @@ func _on_create_save_button_pressed() -> void:
if save_name.strip_edges() == "":
save_name = Time.get_datetime_string_from_system().replace(":", "")
var _save_level_data_component: SaveLevelDataComponent = get_tree().get_first_node_in_group("save_level_data_component")
if _save_level_data_component.ui_node != null:
_save_level_data_component.ui_node.visible = false
await get_tree().create_timer(.150).timeout # A hack to delay to allow UI to hide before taking screenshot
SaveGameManager.create_save_file.emit(save_name)
SaveGameManager.refresh_saves_list.emit()
if _save_level_data_component.ui_node != null:
_save_level_data_component.ui_node.visible = true
new_save_ui.hide()
SignalManager.resume_game.emit()


+ 5
- 0
scenes/root.tscn View File

@ -9,4 +9,9 @@ script = ExtResource("1_lrqlo")
[node name="World" parent="." instance=ExtResource("2_vvh5c")]
[node name="SaveLevelDataComponent" parent="World" index="3" node_paths=PackedStringArray("ui_node")]
ui_node = NodePath("../../UI")
[node name="UI" parent="." instance=ExtResource("3_vvh5c")]
[editable path="World"]

Loading…
Cancel
Save