diff --git a/addons/escoria-core/game/core-scripts/behaviors/esc_movable.gd b/addons/escoria-core/game/core-scripts/behaviors/esc_movable.gd index 3b4be513..5fbcd0a0 100644 --- a/addons/escoria-core/game/core-scripts/behaviors/esc_movable.gd +++ b/addons/escoria-core/game/core-scripts/behaviors/esc_movable.gd @@ -432,7 +432,7 @@ func set_angle(deg: int, immediate = true) -> void: # Returns the angle that corresponds to the current direction of the object. func _get_angle() -> int: - return parent.animations.dir_angles[last_dir].animation + return parent.animations.dir_angles[last_dir].angle_start # Return the shortest way to turn from a direction to another. Returned way is diff --git a/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd b/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd index 18c7512f..4ea9ad5a 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd @@ -14,6 +14,10 @@ var events_queue: Array = [] var scheduled_events: Array = [] +func _ready(): + self.pause_mode = Node.PAUSE_MODE_STOP + + # Handle the events queue and scheduled events func _process(delta: float) -> void: if events_queue.size() > 0: diff --git a/addons/escoria-core/game/core-scripts/esc/types/esc_object.gd b/addons/escoria-core/game/core-scripts/esc/types/esc_object.gd index 1bc2cb8e..cf90970c 100644 --- a/addons/escoria-core/game/core-scripts/esc/types/esc_object.gd +++ b/addons/escoria-core/game/core-scripts/esc/types/esc_object.gd @@ -40,7 +40,7 @@ func set_state(p_state: String, immediate: bool = false): if node.has_method("get_animation_player"): var animation_node: ESCAnimationPlayer = node.get_animation_player() - if animation_node: + if animation_node.is_valid(): animation_node.stop() var actual_animator if animation_node.has_animation(p_state): diff --git a/addons/escoria-core/game/core-scripts/esc_animation_player.gd b/addons/escoria-core/game/core-scripts/esc_animation_player.gd index 84d7271d..ed45e97f 100644 --- a/addons/escoria-core/game/core-scripts/esc_animation_player.gd +++ b/addons/escoria-core/game/core-scripts/esc_animation_player.gd @@ -137,3 +137,11 @@ func seek_end(name: String): # - name: Name of the animation played func _on_animation_finished(name: String): emit_signal("animation_finished", name) + + +# Return true if the ESCAnimationPlayer node is valid, ie. it has a valid player +# node. +# **Returns: true if the ESCAnimationPlayer has a valid player node, +# else false** +func is_valid() -> bool: + return _player_node != null and _player_node is Node diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index 2ec06b35..3518e820 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -154,6 +154,7 @@ var _animation_player: ESCAnimationPlayer = null # Add the movable node, connect signals, detect child nodes # and register this item func _ready(): + self.pause_mode = Node.PAUSE_MODE_STOP _detect_children() @@ -214,7 +215,7 @@ func get_animation_player() -> Node: child is AnimationPlayer: player_node_path = child.get_path() if not has_node(player_node_path): - escoria.logger.error( + escoria.logger.warning( "Can not find node at path %s" % player_node_path ) _animation_player = ESCAnimationPlayer.new(get_node(player_node_path)) diff --git a/addons/escoria-core/game/core-scripts/save_data/esc_save_manager.gd b/addons/escoria-core/game/core-scripts/save_data/esc_save_manager.gd index f69382fb..ecfae3f0 100644 --- a/addons/escoria-core/game/core-scripts/save_data/esc_save_manager.gd +++ b/addons/escoria-core/game/core-scripts/save_data/esc_save_manager.gd @@ -169,6 +169,9 @@ func load_game(id: int): ) load_event.statements = load_statements + + escoria.set_game_paused(false) + escoria.event_manager.queue_event(load_event) diff --git a/addons/escoria-core/game/escoria.gd b/addons/escoria-core/game/escoria.gd index fffd528c..0efd4c56 100644 --- a/addons/escoria-core/game/escoria.gd +++ b/addons/escoria-core/game/escoria.gd @@ -1,6 +1,10 @@ # The escoria main script extends Node +# Signal sent when pause menu has to be displayed +signal request_pause_menu + + # Escoria version number const ESCORIA_VERSION = "0.1.0" @@ -97,6 +101,7 @@ func _init(): # Load settings func _ready(): + inputs_manager.register_core() settings = ESCSaveSettings.new() settings = save_manager.load_settings() escoria._on_settings_loaded(escoria.settings) @@ -388,3 +393,25 @@ func _on_settings_loaded(p_settings: ESCSaveSettings) -> void: ) TranslationServer.set_locale(settings.text_lang) + +# Input function to manage specific input keys +func _input(event): + if event.is_action_pressed("esc_show_debug_prompt"): + escoria.main.get_node("layers/debug_layer/esc_prompt_popup").popup() + + if event.is_action_pressed("ui_cancel"): + emit_signal("request_pause_menu") + + if ProjectSettings.get_setting("escoria/ui/tooltip_follows_mouse"): + if escoria.main.current_scene and escoria.main.current_scene.game: + if event is InputEventMouseMotion: + escoria.main.current_scene.game. \ + update_tooltip_following_mouse_position(event.position) + + +# Pauses or unpause the game +# +# #### Parameters +# - p_paused: if true, pauses the game. If false, unpauses the game. +func set_game_paused(p_paused: bool): + get_tree().paused = p_paused diff --git a/addons/escoria-core/game/escoria.tscn b/addons/escoria-core/game/escoria.tscn index 00ec7ac0..bf76e585 100644 --- a/addons/escoria-core/game/escoria.tscn +++ b/addons/escoria-core/game/escoria.tscn @@ -4,6 +4,7 @@ [ext_resource path="res://addons/escoria-core/game/escoria.gd" type="Script" id=3] [node name="escoria" type="Node"] +pause_mode = 2 script = ExtResource( 3 ) [node name="main" parent="." instance=ExtResource( 2 )] diff --git a/addons/escoria-core/game/inputs_manager.gd b/addons/escoria-core/game/inputs_manager.gd index 6bb467e9..50f49d7e 100644 --- a/addons/escoria-core/game/inputs_manager.gd +++ b/addons/escoria-core/game/inputs_manager.gd @@ -18,7 +18,6 @@ enum { # The current input mode var input_mode = INPUT_ALL - # A LIFO stack of hovered items var hover_stack: Array = [] @@ -26,6 +25,15 @@ var hover_stack: Array = [] var hotspot_focused: String = "" +# Register core signals (from escoria.gd) +func register_core(): + escoria.connect( + "request_pause_menu", + self, + "_on_pause_menu_requested" + ) + + # Connect the item signals to the local methods func register_inventory_item(item: Node): item.connect( @@ -86,24 +94,6 @@ func register_background(background: ESCBackground): ) -# Input event handler -# -# #### Parameters -# -# - event: Godot input event received -func _input(event: InputEvent) -> void: - if event.is_action_pressed("esc_show_debug_prompt"): - escoria.main.get_node("layers/debug_layer/esc_prompt_popup").popup() - - if input_mode == INPUT_ALL and event.is_action_pressed("ui_cancel"): - _on_pause_menu_requested() - - if ProjectSettings.get_setting("escoria/ui/tooltip_follows_mouse"): - if escoria.main.current_scene and escoria.main.current_scene.game: - if event is InputEventMouseMotion: - escoria.main.current_scene.game.update_tooltip_following_mouse_position(event.position) - - # The background was clicked with the LMB # # #### Parameters diff --git a/addons/escoria-ui-9verbs/game.gd b/addons/escoria-ui-9verbs/game.gd index 28573708..60c2b958 100644 --- a/addons/escoria-ui-9verbs/game.gd +++ b/addons/escoria-ui-9verbs/game.gd @@ -166,8 +166,10 @@ func pause_game(): escoria.main.current_scene.game.get_node("camera").current = true escoria.main.current_scene.game.show_ui() escoria.main.current_scene.show() + escoria.set_game_paused(false) else: $ui/pause_menu.show() escoria.main.current_scene.game.get_node("camera").current = false escoria.main.current_scene.game.hide_ui() escoria.main.current_scene.hide() + escoria.set_game_paused(true) diff --git a/docs/api/ESCAnimationPlayer.md b/docs/api/ESCAnimationPlayer.md index f67a27f6..1c3a47d9 100644 --- a/docs/api/ESCAnimationPlayer.md +++ b/docs/api/ESCAnimationPlayer.md @@ -108,6 +108,17 @@ Play an animation and directly skip to the end - name: Name of the animation to play +### is\_valid + +```gdscript +func is_valid() -> bool +``` + +Return true if the ESCAnimationPlayer node is valid, ie. it has a valid player +node. +**Returns: true if the ESCAnimationPlayer has a valid player node, +else false** + ## Signals - signal animation_finished(name): diff --git a/docs/api/escoria.gd.md b/docs/api/escoria.gd.md index b592cffe..54d022c4 100644 --- a/docs/api/escoria.gd.md +++ b/docs/api/escoria.gd.md @@ -214,4 +214,17 @@ Run a generic action #### Parameters - action: type of the action to run -- params: Parameters for the action \ No newline at end of file +- params: Parameters for the action + +### set\_game\_paused + +```gdscript +func set_game_paused() +``` + +### set\_game\_unpaused + +```gdscript +func set_game_unpaused() +``` + diff --git a/game/characters/mark/mark.tscn b/game/characters/mark/mark.tscn index 2b8931eb..b5b8dcc1 100644 --- a/game/characters/mark/mark.tscn +++ b/game/characters/mark/mark.tscn @@ -13,121 +13,121 @@ atlas = ExtResource( 4 ) region = Rect2( 120, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=2] -atlas = ExtResource( 4 ) -region = Rect2( 24, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=3] -atlas = ExtResource( 5 ) +atlas = ExtResource( 2 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=4] -atlas = ExtResource( 5 ) +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 2 ) region = Rect2( 24, 0, 24, 70 ) +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 2 ) +region = Rect2( 48, 0, 24, 70 ) + [sub_resource type="AtlasTexture" id=5] -atlas = ExtResource( 5 ) +atlas = ExtResource( 4 ) region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=6] -atlas = ExtResource( 6 ) +atlas = ExtResource( 7 ) region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=7] -atlas = ExtResource( 6 ) +atlas = ExtResource( 7 ) region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=8] -atlas = ExtResource( 2 ) -region = Rect2( 0, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=9] -atlas = ExtResource( 2 ) -region = Rect2( 24, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 72, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=10] -atlas = ExtResource( 2 ) -region = Rect2( 48, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 96, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=11] atlas = ExtResource( 4 ) -region = Rect2( 48, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=12] -atlas = ExtResource( 7 ) -region = Rect2( 0, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=13] -atlas = ExtResource( 7 ) -region = Rect2( 24, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=14] -atlas = ExtResource( 7 ) -region = Rect2( 48, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=15] -atlas = ExtResource( 7 ) -region = Rect2( 72, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=16] -atlas = ExtResource( 7 ) -region = Rect2( 96, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=17] -atlas = ExtResource( 4 ) region = Rect2( 144, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=18] +[sub_resource type="AtlasTexture" id=12] atlas = ExtResource( 4 ) region = Rect2( 168, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=19] +[sub_resource type="AtlasTexture" id=13] atlas = ExtResource( 4 ) region = Rect2( 192, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=20] +[sub_resource type="AtlasTexture" id=14] atlas = ExtResource( 4 ) region = Rect2( 216, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=21] +[sub_resource type="AtlasTexture" id=15] atlas = ExtResource( 4 ) region = Rect2( 240, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=22] +[sub_resource type="AtlasTexture" id=16] atlas = ExtResource( 4 ) region = Rect2( 264, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=23] +[sub_resource type="AtlasTexture" id=17] atlas = ExtResource( 4 ) region = Rect2( 288, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=24] +[sub_resource type="AtlasTexture" id=18] atlas = ExtResource( 4 ) region = Rect2( 312, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=25] +[sub_resource type="AtlasTexture" id=19] atlas = ExtResource( 4 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=26] +[sub_resource type="AtlasTexture" id=20] atlas = ExtResource( 4 ) region = Rect2( 336, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=27] +[sub_resource type="AtlasTexture" id=21] atlas = ExtResource( 4 ) region = Rect2( 360, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=28] +[sub_resource type="AtlasTexture" id=22] atlas = ExtResource( 4 ) region = Rect2( 384, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=29] +[sub_resource type="AtlasTexture" id=23] atlas = ExtResource( 4 ) region = Rect2( 72, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=30] +[sub_resource type="AtlasTexture" id=24] atlas = ExtResource( 4 ) region = Rect2( 96, 0, 24, 70 ) +[sub_resource type="AtlasTexture" id=25] +atlas = ExtResource( 4 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=26] +atlas = ExtResource( 5 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=27] +atlas = ExtResource( 5 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=28] +atlas = ExtResource( 5 ) +region = Rect2( 48, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=29] +atlas = ExtResource( 6 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=30] +atlas = ExtResource( 6 ) +region = Rect2( 24, 0, 24, 70 ) + [sub_resource type="SpriteFrames" id=31] animations = [ { "frames": [ SubResource( 1 ) ], @@ -135,65 +135,65 @@ animations = [ { "name": "idle_down_left", "speed": 5.0 }, { -"frames": [ SubResource( 2 ) ], -"loop": true, -"name": "idle_down_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ], -"loop": true, -"name": "speak_down_right", -"speed": 6.0 -}, { -"frames": [ SubResource( 6 ), SubResource( 7 ), SubResource( 6 ), SubResource( 7 ), SubResource( 7 ) ], -"loop": true, -"name": "speak_up", -"speed": 3.0 -}, { -"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 9 ), SubResource( 10 ) ], +"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 3 ), SubResource( 4 ) ], "loop": true, "name": "speak_down", "speed": 6.0 }, { -"frames": [ SubResource( 11 ) ], +"frames": [ SubResource( 5 ) ], "loop": true, "name": "idle_right", "speed": 5.0 }, { -"frames": [ SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ) ], +"frames": [ SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ) ], "loop": true, "name": "speak_right", "speed": 5.0 }, { -"frames": [ SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 18 ) ], +"frames": [ SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 12 ) ], "loop": true, "name": "walk_down", "speed": 6.0 }, { -"frames": [ SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ], +"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ) ], "loop": true, "name": "walk_right", "speed": 6.0 }, { -"frames": [ SubResource( 25 ) ], +"frames": [ SubResource( 19 ) ], "loop": true, "name": "idle_down", "speed": 5.0 }, { -"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 27 ) ], +"frames": [ SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 21 ) ], "loop": true, "name": "walk_up", "speed": 6.0 }, { -"frames": [ SubResource( 29 ) ], +"frames": [ SubResource( 23 ) ], "loop": true, "name": "idle_up", "speed": 5.0 }, { -"frames": [ SubResource( 30 ) ], +"frames": [ SubResource( 24 ) ], "loop": true, "name": "idle_left", "speed": 5.0 +}, { +"frames": [ SubResource( 25 ) ], +"loop": true, +"name": "idle_down_right", +"speed": 5.0 +}, { +"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ) ], +"loop": true, +"name": "speak_down_right", +"speed": 6.0 +}, { +"frames": [ SubResource( 29 ), SubResource( 30 ), SubResource( 29 ), SubResource( 30 ), SubResource( 30 ) ], +"loop": true, +"name": "speak_up", +"speed": 3.0 } ] [sub_resource type="CapsuleShape2D" id=32] diff --git a/game/rooms/room01/room01.tscn b/game/rooms/room01/room01.tscn index 8804e5fa..bcf5dd15 100644 --- a/game/rooms/room01/room01.tscn +++ b/game/rooms/room01/room01.tscn @@ -48,6 +48,7 @@ position = Vector2( 3.5636, 0 ) [node name="Hotspots" type="Node2D" parent="."] [node name="r_door" type="Area2D" parent="Hotspots"] +pause_mode = 1 script = ExtResource( 5 ) __meta__ = { "_editor_description_": "" @@ -68,6 +69,7 @@ position = Vector2( 1225.47, 353.99 ) script = ExtResource( 7 ) [node name="item" type="Area2D" parent="Hotspots"] +pause_mode = 1 position = Vector2( -217.19, 0 ) script = ExtResource( 5 ) global_id = "r1_wall_item1" @@ -104,6 +106,7 @@ __meta__ = { } [node name="item2" type="Area2D" parent="Hotspots"] +pause_mode = 1 position = Vector2( 189.644, 0 ) script = ExtResource( 5 ) global_id = "r1_wall_item2" diff --git a/game/translations/main_menu.csv b/game/translations/main_menu.csv index 0eb1c2e6..93e893b2 100644 --- a/game/translations/main_menu.csv +++ b/game/translations/main_menu.csv @@ -12,3 +12,6 @@ CANCEL,Cancel,Annuler OK,OK,OK ENTER_SAVE_NAME,Enter the save name:,Entrez un nom de sauvegarde APPLY,Apply,Appliquer +CONFIRM_OVERWRITE,Overwrite the savegame?,Écraser la sauvegarde ? +YES,Yes,Oui +NO,No,Non diff --git a/game/translations/main_menu.en.translation b/game/translations/main_menu.en.translation index 88ff5a35..f5f9c946 100644 Binary files a/game/translations/main_menu.en.translation and b/game/translations/main_menu.en.translation differ diff --git a/game/translations/main_menu.fr.translation b/game/translations/main_menu.fr.translation index 78833c03..f11330de 100644 Binary files a/game/translations/main_menu.fr.translation and b/game/translations/main_menu.fr.translation differ diff --git a/game/ui/commons/pause_menu/pause_menu.gd b/game/ui/commons/pause_menu/pause_menu.gd index 9bf7256c..274fb60b 100644 --- a/game/ui/commons/pause_menu/pause_menu.gd +++ b/game/ui/commons/pause_menu/pause_menu.gd @@ -2,6 +2,7 @@ extends Control func _ready(): + self.pause_mode = Node.PAUSE_MODE_PROCESS hide() diff --git a/game/ui/commons/save/overwrite_confirm_popup.gd b/game/ui/commons/save/overwrite_confirm_popup.gd new file mode 100644 index 00000000..ce7b090f --- /dev/null +++ b/game/ui/commons/save/overwrite_confirm_popup.gd @@ -0,0 +1,12 @@ +extends PopupDialog + +signal confirm_yes + +func _on_no_pressed(): + hide() + + +func _on_yes_pressed(): + emit_signal("confirm_yes") + hide() + diff --git a/game/ui/commons/save/overwrite_confirm_popup.tscn b/game/ui/commons/save/overwrite_confirm_popup.tscn new file mode 100644 index 00000000..459576e2 --- /dev/null +++ b/game/ui/commons/save/overwrite_confirm_popup.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1] +[ext_resource path="res://game/ui/commons/save/overwrite_confirm_popup.gd" type="Script" id=2] + +[node name="overwrite_confirm_popup" type="PopupDialog"] +margin_left = 429.0 +margin_top = 281.0 +margin_right = 863.0 +margin_bottom = 442.0 +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +custom_constants/margin_right = 30 +custom_constants/margin_top = 30 +custom_constants/margin_left = 30 +custom_constants/margin_bottom = 30 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +margin_left = 30.0 +margin_top = 30.0 +margin_right = 404.0 +margin_bottom = 131.0 + +[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"] +margin_right = 374.0 +margin_bottom = 21.0 +custom_fonts/font = ExtResource( 1 ) +text = "CONFIRM_OVERWRITE" + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -224.0 +margin_top = -56.0 +margin_right = -30.0 +margin_bottom = -20.0 +custom_constants/separation = 10 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="yes" type="Button" parent="HBoxContainer"] +margin_right = 92.0 +margin_bottom = 36.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 1 ) +text = "YES" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="no" type="Button" parent="HBoxContainer"] +margin_left = 102.0 +margin_right = 194.0 +margin_bottom = 36.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 1 ) +text = "NO" +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="pressed" from="HBoxContainer/yes" to="." method="_on_yes_pressed"] +[connection signal="pressed" from="HBoxContainer/no" to="." method="_on_no_pressed"] diff --git a/game/ui/commons/save/save_game.gd b/game/ui/commons/save/save_game.gd index 27d12b64..6791bcb7 100644 --- a/game/ui/commons/save/save_game.gd +++ b/game/ui/commons/save/save_game.gd @@ -13,7 +13,7 @@ func _ready(): func _on_slot_pressed(p_slot_n: int): slot_pressed = p_slot_n if escoria.save_manager.save_game_exists(p_slot_n): - pass + $overwrite_confirm_popup.popup() else: $save_name_popup.popup() @@ -56,3 +56,7 @@ func _on_save_name_popup_savegame_name_ok(p_savename: String): func _on_save_name_popup_savegame_cancel(): pass + + +func _on_overwrite_confirm_popup_confirm_yes(): + $save_name_popup.popup() diff --git a/game/ui/commons/save/save_game.tscn b/game/ui/commons/save/save_game.tscn index fb0c7974..784e56ea 100644 --- a/game/ui/commons/save/save_game.tscn +++ b/game/ui/commons/save/save_game.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.tscn" type="PackedScene" id=1] [ext_resource path="res://game/ui/commons/save/save_game.gd" type="Script" id=2] [ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3] [ext_resource path="res://game/ui/commons/save/save_name_popup.tscn" type="PackedScene" id=4] +[ext_resource path="res://game/ui/commons/save/overwrite_confirm_popup.tscn" type="PackedScene" id=5] [node name="save_game" type="Control"] anchor_right = 1.0 @@ -49,6 +50,9 @@ __meta__ = { [node name="save_name_popup" parent="." instance=ExtResource( 4 )] +[node name="overwrite_confirm_popup" parent="." instance=ExtResource( 5 )] + [connection signal="pressed" from="back" to="." method="_on_back_pressed"] [connection signal="savegame_cancel" from="save_name_popup" to="." method="_on_save_name_popup_savegame_cancel"] [connection signal="savegame_name_ok" from="save_name_popup" to="." method="_on_save_name_popup_savegame_name_ok"] +[connection signal="confirm_yes" from="overwrite_confirm_popup" to="." method="_on_overwrite_confirm_popup_confirm_yes"] diff --git a/saves/save_001.tres b/saves/save_001.tres new file mode 100644 index 00000000..839b17f6 --- /dev/null +++ b/saves/save_001.tres @@ -0,0 +1,89 @@ +[gd_resource type="Resource" load_steps=2 format=2] + +[ext_resource path="res://addons/escoria-core/game/core-scripts/save_data/esc_savegame.gd" type="Script" id=1] + +[resource] +script = ExtResource( 1 ) +escoria_version = "0.1.0" +game_version = "0.1.0" +name = "3" +date = "11/08/2021 21:14" +main = { +"current_scene_filename": "res://game/rooms/room01/room01.tscn", +"last_scene_global_id": "" +} +globals = { +"dialog_advance": 0, +"dialog_popup_advance": 0, +"room1_visited": true +} +objects = { +"bg_music": { +"active": true, +"interactive": true, +"state": "res://game/sfx/contemplation.ogg" +}, +"bg_sound": { +"active": true, +"interactive": true, +"state": "default" +}, +"camera": { +"active": true, +"interactive": true, +"state": "default" +}, +"player": { +"active": true, +"global_transform": Transform2D( 1, 0, 0, 1, 621.898, 479.227 ), +"interactive": true, +"last_deg": 71, +"last_dir": 2, +"state": "default" +}, +"player_start": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_destination_point": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_destination_point2": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_left_object_interaction": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_r_exit": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_start": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_wall_item1": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_wall_item2": { +"active": true, +"interactive": true, +"state": "default" +}, +"r2_left_object_interaction": { +"active": true, +"interactive": true, +"state": "default" +} +} diff --git a/saves/save_002.tres b/saves/save_002.tres new file mode 100644 index 00000000..5530a9d5 --- /dev/null +++ b/saves/save_002.tres @@ -0,0 +1,89 @@ +[gd_resource type="Resource" load_steps=2 format=2] + +[ext_resource path="res://addons/escoria-core/game/core-scripts/save_data/esc_savegame.gd" type="Script" id=1] + +[resource] +script = ExtResource( 1 ) +escoria_version = "0.1.0" +game_version = "0.1.0" +name = "4" +date = "11/08/2021 21:20" +main = { +"current_scene_filename": "res://game/rooms/room01/room01.tscn", +"last_scene_global_id": "" +} +globals = { +"dialog_advance": 0, +"dialog_popup_advance": 0, +"room1_visited": true +} +objects = { +"bg_music": { +"active": true, +"interactive": true, +"state": "res://game/sfx/contemplation.ogg" +}, +"bg_sound": { +"active": true, +"interactive": true, +"state": "default" +}, +"camera": { +"active": true, +"interactive": true, +"state": "default" +}, +"player": { +"active": true, +"global_transform": Transform2D( 1, 0, 0, 1, 994.586, 458.862 ), +"interactive": true, +"last_deg": 71, +"last_dir": 2, +"state": "default" +}, +"player_start": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_destination_point": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_destination_point2": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_left_object_interaction": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_r_exit": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_start": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_wall_item1": { +"active": true, +"interactive": true, +"state": "default" +}, +"r1_wall_item2": { +"active": true, +"interactive": true, +"state": "default" +}, +"r2_left_object_interaction": { +"active": true, +"interactive": true, +"state": "default" +} +}