From 862b399fa37e6ca692d38177a22ee34860d2251e Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 15 Sep 2025 20:00:47 -0300 Subject: Menu principal --- assets/bg.png | Bin 0 -> 998257 bytes assets/bg.png.import | 34 +++++++++ project.godot | 2 +- scenes/GUI/main_menu.tscn | 91 +++++++++++++++++++++++++ scenes/Game.tscn | 3 +- scenes/game_manager.tscn | 6 ++ scripts/Entities/Actions/EscapeAction.cs | 13 ++++ scripts/Entities/Actions/EscapeAction.cs.uid | 1 + scripts/GUI/Details.cs | 34 +++++++-- scripts/GUI/MainMenu.cs | 46 +++++++++++++ scripts/GUI/MainMenu.cs.uid | 1 + scripts/GUI/MessageLog.cs | 17 ++++- scripts/Game.cs | 21 ++++++ scripts/GameManager.cs | 59 ++++++++++++++++ scripts/GameManager.cs.uid | 1 + scripts/InputHandling/CastSpellInputHandler.cs | 17 ++++- scripts/InputHandling/GameOverInputHandler.cs | 8 ++- scripts/InputHandling/InputHandler.cs | 9 +++ scripts/InputHandling/MainGameInputHandler.cs | 5 ++ scripts/Utils/MessageLogData.cs | 2 +- scripts/Utils/SignalBus.cs | 3 + 21 files changed, 361 insertions(+), 12 deletions(-) create mode 100644 assets/bg.png create mode 100644 assets/bg.png.import create mode 100644 scenes/GUI/main_menu.tscn create mode 100644 scenes/game_manager.tscn create mode 100644 scripts/Entities/Actions/EscapeAction.cs create mode 100644 scripts/Entities/Actions/EscapeAction.cs.uid create mode 100644 scripts/GUI/MainMenu.cs create mode 100644 scripts/GUI/MainMenu.cs.uid create mode 100644 scripts/GameManager.cs create mode 100644 scripts/GameManager.cs.uid diff --git a/assets/bg.png b/assets/bg.png new file mode 100644 index 0000000..6729cf4 Binary files /dev/null and b/assets/bg.png differ diff --git a/assets/bg.png.import b/assets/bg.png.import new file mode 100644 index 0000000..1975e68 --- /dev/null +++ b/assets/bg.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bxjwbucke02gl" +path="res://.godot/imported/bg.png-23a59c2e9cba2223a50fa3fe41b70b25.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/bg.png" +dest_files=["res://.godot/imported/bg.png-23a59c2e9cba2223a50fa3fe41b70b25.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/project.godot b/project.godot index ccb3ac6..ad54fc4 100644 --- a/project.godot +++ b/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="projeto-fantasia" config/tags=PackedStringArray("based") -run/main_scene="uid://u5h6iqyi8wd0" +run/main_scene="uid://cqrq8cosoge7i" config/features=PackedStringArray("4.4", "C#", "Forward Plus") config/icon="res://icon.svg" diff --git a/scenes/GUI/main_menu.tscn b/scenes/GUI/main_menu.tscn new file mode 100644 index 0000000..2794830 --- /dev/null +++ b/scenes/GUI/main_menu.tscn @@ -0,0 +1,91 @@ +[gd_scene load_steps=10 format=3 uid="uid://cppjdsdfkkxtm"] + +[ext_resource type="Script" uid="uid://dx0fxht2oadb6" path="res://scripts/GUI/MainMenu.cs" id="1_b4h60"] +[ext_resource type="Texture2D" uid="uid://bxjwbucke02gl" path="res://assets/bg.png" id="1_tbt31"] + +[sub_resource type="LabelSettings" id="LabelSettings_b4h60"] +font_size = 32 + +[sub_resource type="InputEventKey" id="InputEventKey_tbt31"] +device = -1 +keycode = 78 +unicode = 110 + +[sub_resource type="Shortcut" id="Shortcut_b4h60"] +events = [SubResource("InputEventKey_tbt31")] + +[sub_resource type="InputEventKey" id="InputEventKey_kebck"] +device = -1 +keycode = 67 +unicode = 99 + +[sub_resource type="Shortcut" id="Shortcut_1ei6q"] +events = [SubResource("InputEventKey_kebck")] + +[sub_resource type="InputEventKey" id="InputEventKey_xm7ak"] +device = -1 +keycode = 83 +unicode = 115 + +[sub_resource type="Shortcut" id="Shortcut_h03jd"] +events = [SubResource("InputEventKey_xm7ak")] + +[node name="MainMenu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_b4h60") + +[node name="Background" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("1_tbt31") +stretch_mode = 6 + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/CenterContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="VBoxContainer/CenterContainer/VBoxContainer"] +layout_mode = 2 +text = "The Legend of Gustav" +label_settings = SubResource("LabelSettings_b4h60") + +[node name="neogame" type="Button" parent="VBoxContainer/CenterContainer/VBoxContainer"] +layout_mode = 2 +shortcut = SubResource("Shortcut_b4h60") +shortcut_feedback = false +text = "[N] Novo jogo" + +[node name="continue" type="Button" parent="VBoxContainer/CenterContainer/VBoxContainer"] +layout_mode = 2 +shortcut = SubResource("Shortcut_1ei6q") +shortcut_feedback = false +text = "[C] Continuar" + +[node name="quit" type="Button" parent="VBoxContainer/CenterContainer/VBoxContainer"] +layout_mode = 2 +shortcut = SubResource("Shortcut_h03jd") +text = "[S] Sair" + +[node name="Label" type="Label" parent="VBoxContainer"] +layout_mode = 2 +text = "Não temo a morte, temo o tempo." diff --git a/scenes/Game.tscn b/scenes/Game.tscn index 96ba3c0..e53783b 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -33,8 +33,9 @@ script = ExtResource("5_s0nni") [node name="Entities" type="Node2D" parent="Map"] -[node name="InspectDetails" parent="Map" instance=ExtResource("5_qy1jj")] +[node name="InspectDetails" parent="Map" node_paths=PackedStringArray("map") instance=ExtResource("5_qy1jj")] visible = false +map = NodePath("..") [node name="InputHandler" type="Node" parent="."] script = ExtResource("3_s0nni") diff --git a/scenes/game_manager.tscn b/scenes/game_manager.tscn new file mode 100644 index 0000000..db916d5 --- /dev/null +++ b/scenes/game_manager.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://cqrq8cosoge7i"] + +[ext_resource type="Script" uid="uid://hya6i6i11teo" path="res://scripts/GameManager.cs" id="1_hwd4i"] + +[node name="GameManager" type="Node"] +script = ExtResource("1_hwd4i") diff --git a/scripts/Entities/Actions/EscapeAction.cs b/scripts/Entities/Actions/EscapeAction.cs new file mode 100644 index 0000000..cc5d289 --- /dev/null +++ b/scripts/Entities/Actions/EscapeAction.cs @@ -0,0 +1,13 @@ +using TheLegendOfGustav.Entities.Actors; +using TheLegendOfGustav.Utils; + +namespace TheLegendOfGustav.Entities.Actions; + +public partial class EscapeAction(Actor actor) : Action(actor) +{ + public override bool Perform() + { + SignalBus.Instance.EmitSignal(SignalBus.SignalName.EscapeRequested); + return false; + } +} \ No newline at end of file diff --git a/scripts/Entities/Actions/EscapeAction.cs.uid b/scripts/Entities/Actions/EscapeAction.cs.uid new file mode 100644 index 0000000..380f369 --- /dev/null +++ b/scripts/Entities/Actions/EscapeAction.cs.uid @@ -0,0 +1 @@ +uid://dtxw6x1naf3oc diff --git a/scripts/GUI/Details.cs b/scripts/GUI/Details.cs index 3c64427..3ead3a9 100644 --- a/scripts/GUI/Details.cs +++ b/scripts/GUI/Details.cs @@ -8,31 +8,53 @@ namespace TheLegendOfGustav.GUI; public partial class Details : CanvasLayer { private static readonly LabelSettings lblSettings = GD.Load("res://assets/definitions/message_label_settings.tres"); - - private Map.Map Map { get; set; } + + [Export] + private Map.Map map; private VBoxContainer EntityNames { get; set; } private Godot.Collections.Array Entities { get; set; } = []; private Godot.Collections.Array