From dd5618e7095c15639c97de31d437912ee0771a9d Mon Sep 17 00:00:00 2001 From: Lexi Quinn Date: Wed, 3 Apr 2024 00:25:59 +1100 Subject: [PATCH] added start menu and wait screen --- Assets/please_wait.png | Bin 0 -> 811 bytes Assets/please_wait.png.import | 34 ++++++++++ Menus/MainMenu/main_menu.gd | 12 ++-- Menus/Messages/message_preview.gd | 3 + Menus/Messages/messages_menu.gd | 7 +- Menus/PlentifulFish/PoF.tscn | 16 +++-- Menus/PlentifulFish/application.gd | 30 +++++++-- Menus/Swipe/fish_card.gd | 2 + Quinnsoft94/desktop.gd | 22 ++++++- Quinnsoft94/desktop.tscn | 44 ++++++++++++- Quinnsoft94/program_window.gd | 1 + data.gd | 15 +++++ export_presets.cfg | 102 +++++++++++++++++++++++++++++ project.godot | 4 ++ 14 files changed, 269 insertions(+), 23 deletions(-) create mode 100644 Assets/please_wait.png create mode 100644 Assets/please_wait.png.import create mode 100644 data.gd create mode 100644 export_presets.cfg diff --git a/Assets/please_wait.png b/Assets/please_wait.png new file mode 100644 index 0000000000000000000000000000000000000000..75f7bdd8ecefed75ddf556c924ce0c1fbe1d7fff GIT binary patch literal 811 zcmV+`1JwM9P)Px%lfo07aW{b&}tB9{L#z?IPeX8=45G>S|Ec~Dp zLI^SAWo^I}-rM)j(ciZBC)Bf4{#hF!#Yh~_q!A!06u_8N0z^zht_Lm&hk75JT^hGq z?L@4STp87K;2pM+w9e6V46?0RObysOWY!rHPF!hM3$rp*$_Xo# z(!M?G($z$ORp(1O%Zmu`@RLY8JyxU0IvqhHK+E}eu#N)6qRg zj+`s8Sg(oNf{fQIKv| zMARrqIUVgi3M}m7qI`$ci}GHhz{)OY&$Ql)e}tu7Ar5G0Vr`F!1FRp~lO2zJcu>@;SK|bJu*n&kC*}zuggg(g)8isYoK(5e7NQ+# zVB1p89E23h6Y4wTYFStvEcs@eq2z>rs-V})XAj=h`yB0dju=7EHQ}>e%twFUJOAw7 zHPU9qXs<)3Le&sHdXUzU`_$Ard&c>a|JSoyGu6R2W{rCJtY9Oq_Tbs5n!VpuAluVt z2I95{*6T*+3}%ikN!T87Y$>Ij54cCyjDA0As~yZ|qrtL7HXj4-mZm78*!dq%eZeAx z5JCu9=j; void: - save = SaveFile.load_profile_from_disk() - if save.catfish_name: - profile_name.text = save.catfish_name + if Data.save_file.catfish_name: + profile_name.text = Data.save_file.catfish_name enter_button.visible = true @@ -19,12 +16,11 @@ func _on_texture_button_pressed() -> void: func load_game() -> void: if profile_name.text.length() > 0: - save.catfish_name = profile_name.text - save.save_to_disk() + Data.save_file.catfish_name = profile_name.text get_tree().change_scene_to_file("res://Quinnsoft94/desktop.tscn") -func _on_line_edit_text_submitted(new_text: String) -> void: +func _on_line_edit_text_submitted(_new_text: String) -> void: load_game() diff --git a/Menus/Messages/message_preview.gd b/Menus/Messages/message_preview.gd index 69691fa..2ebd92d 100644 --- a/Menus/Messages/message_preview.gd +++ b/Menus/Messages/message_preview.gd @@ -6,8 +6,11 @@ signal open_message() @export var fish_name_label: Label @export var message_label: Label +var fish: FishProfile + func setup(profile: FishProfile, message: String): + fish = profile pfp.texture = profile.picture fish_name_label.text = profile.fish_name message_label.text = message diff --git a/Menus/Messages/messages_menu.gd b/Menus/Messages/messages_menu.gd index b54063e..f245ff2 100644 --- a/Menus/Messages/messages_menu.gd +++ b/Menus/Messages/messages_menu.gd @@ -2,9 +2,10 @@ class_name MessageMenu extends ScrollContainer @export var message_preview_scene: PackedScene @export var vbox: VBoxContainer -var save: SaveFile func _ready() -> void: - var message = message_preview_scene.instantiate() as MessagePreview - vbox.add_child(message) + for profile: FishProfile in Data.save_file.accepted_fish: + var message = message_preview_scene.instantiate() as MessagePreview + message.setup(profile, "send a first message to " + str(profile.fish_name) + "!") + vbox.add_child(message) diff --git a/Menus/PlentifulFish/PoF.tscn b/Menus/PlentifulFish/PoF.tscn index 8de1680..1d78588 100644 --- a/Menus/PlentifulFish/PoF.tscn +++ b/Menus/PlentifulFish/PoF.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=3 uid="uid://wa62w2wb4pmr"] +[gd_scene load_steps=21 format=3 uid="uid://wa62w2wb4pmr"] [ext_resource type="Script" path="res://Menus/PlentifulFish/application.gd" id="1_yl22y"] [ext_resource type="PackedScene" uid="uid://dge7ymn0yd7ry" path="res://Menus/Swipe/fish_card.tscn" id="2_uajjj"] @@ -7,6 +7,7 @@ [ext_resource type="Resource" uid="uid://co03mjgi5q1xh" path="res://Fish/Goldfish/goldfish.tres" id="5_g7gvi"] [ext_resource type="Resource" uid="uid://dun2uls53mmbq" path="res://Fish/Fishball/fishball.tres" id="6_6w8p5"] [ext_resource type="Texture2D" uid="uid://06lxb843ndgp" path="res://Assets/ocean_bg.png" id="7_o2jv7"] +[ext_resource type="Texture2D" uid="uid://dbvhhwhqxo8ee" path="res://Assets/please_wait.png" id="7_uxgnr"] [ext_resource type="Texture2D" uid="uid://co5knl5f3lui3" path="res://Assets/catfish.png" id="8_7dnbn"] [ext_resource type="StyleBox" uid="uid://bhwii0745mi6s" path="res://Assets/darkpanel.tres" id="9_d6aw3"] [ext_resource type="Texture2D" uid="uid://csowwaiokaooa" path="res://Assets/fish_icon.png" id="10_jb5xi"] @@ -19,11 +20,16 @@ [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_th770"] bg_color = Color(0.768627, 0.533333, 0.458824, 1) +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_17s8b"] +texture = ExtResource("7_uxgnr") +draw_center = false + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_pap58"] +texture = ExtResource("7_uxgnr") + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a7vhj"] bg_color = Color(0.611765, 0.392157, 0.321569, 1) -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_hehe3"] - [node name="PoF" type="PanelContainer" node_paths=PackedStringArray("player_name_text", "contents_page")] custom_minimum_size = Vector2(600, 680) anchors_preset = 5 @@ -40,6 +46,8 @@ fish_card_scene = ExtResource("2_uajjj") messages_scene = ExtResource("3_42fn6") fish_profiles = Array[Resource("res://Resources/fish_profile.gd")]([ExtResource("4_tkrdy"), ExtResource("5_g7gvi"), ExtResource("6_6w8p5")]) contents_page = NodePath("VBoxContainer/Content") +empty_panel = SubResource("StyleBoxTexture_17s8b") +wait_panel = SubResource("StyleBoxTexture_pap58") [node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 2 @@ -75,9 +83,9 @@ text = "cool name" vertical_alignment = 1 [node name="Content" type="PanelContainer" parent="VBoxContainer"] +texture_filter = 1 layout_mode = 2 size_flags_vertical = 3 -theme_override_styles/panel = SubResource("StyleBoxEmpty_hehe3") [node name="Footer" type="PanelContainer" parent="VBoxContainer"] layout_mode = 2 diff --git a/Menus/PlentifulFish/application.gd b/Menus/PlentifulFish/application.gd index d8aa0da..4acf3c4 100644 --- a/Menus/PlentifulFish/application.gd +++ b/Menus/PlentifulFish/application.gd @@ -7,8 +7,9 @@ class_name Application extends PanelContainer @export var fish_profiles: Array[FishProfile] @export var discarded_fish_profiles: Array[FishProfile] @export var contents_page: Control +@export var empty_panel: StyleBoxTexture +@export var wait_panel: StyleBoxTexture var has_current_fish: bool = false -var save_file: SaveFile var current_card: int = 0 var window: DEWindow @@ -17,14 +18,29 @@ func setup_window_integration(): pass +func set_wait_message(enable: bool) -> void: + match enable: + true: + contents_page.add_theme_stylebox_override("panel", wait_panel) + false: + contents_page.add_theme_stylebox_override("panel", empty_panel) + + func _ready() -> void: - player_name_text.text = save_file.catfish_name + player_name_text.text = Data.save_file.catfish_name + var fishes: Array[FishProfile] = [] + for fish: FishProfile in fish_profiles: + if !Data.save_file.accepted_fish.has(fish): + fishes.append(fish) + fish_profiles = fishes _on_fish_pressed() func load_profile() -> void: - if has_current_fish or fish_profiles.size() <= current_card: + if fish_profiles.size() <= current_card: + set_wait_message(true) return + set_wait_message(false) var fish_card = fish_card_scene.instantiate() as FishCard fish_card.set_display(fish_profiles[current_card]) fish_card.swiped.connect(process_fish_profile.bind(fish_card)) @@ -35,8 +51,8 @@ func load_profile() -> void: func process_fish_profile(outcome: bool, card: FishCard): current_card += 1 has_current_fish = false - if outcome: - save_file.accepted_fish.append(card.profile) + if outcome and !Data.save_file.accepted_fish.has(card.profile): + Data.save_file.accepted_fish.append(card.profile) else: discarded_fish_profiles.append(card.profile) if discarded_fish_profiles.size() > 0 and current_card >= fish_profiles.size(): @@ -50,6 +66,8 @@ func recycle_profiles() -> void: func _on_fish_pressed() -> void: + if has_current_fish: + return for node: Node in contents_page.get_children(): node.queue_free() load_profile() @@ -57,6 +75,7 @@ func _on_fish_pressed() -> void: func _on_messages_pressed() -> void: has_current_fish = false + set_wait_message(false) for node: Node in contents_page.get_children(): node.queue_free() var messages: MessageMenu = messages_scene.instantiate() as MessageMenu @@ -65,5 +84,6 @@ func _on_messages_pressed() -> void: func _on_profile_pressed() -> void: has_current_fish = false + set_wait_message(false) for node: Node in contents_page.get_children(): node.queue_free() diff --git a/Menus/Swipe/fish_card.gd b/Menus/Swipe/fish_card.gd index b9bc1f0..031079d 100644 --- a/Menus/Swipe/fish_card.gd +++ b/Menus/Swipe/fish_card.gd @@ -19,6 +19,7 @@ func _on_no_pressed() -> void: tween.set_trans(Tween.TRANS_CUBIC) var dest: Vector2 = position + Vector2(-600, 0) tween.tween_property(self, "position", dest, 0.6) + tween.tween_callback(set_visible.bind(false)) tween.tween_callback(func(): swiped.emit(false)) tween.tween_callback(queue_free) @@ -29,5 +30,6 @@ func _on_yes_pressed() -> void: tween.set_trans(Tween.TRANS_CUBIC) var dest: Vector2 = position + Vector2(600, 0) tween.tween_property(self, "position", dest, 0.6) + tween.tween_callback(set_visible.bind(false)) tween.tween_callback(func(): swiped.emit(true)) tween.tween_callback(queue_free) diff --git a/Quinnsoft94/desktop.gd b/Quinnsoft94/desktop.gd index 5c44bf7..30ab1bb 100644 --- a/Quinnsoft94/desktop.gd +++ b/Quinnsoft94/desktop.gd @@ -7,6 +7,8 @@ class_name Desktop extends ColorRect @export var pof_icon: Texture @export var pof_scene: PackedScene +@export var start_menu: PanelContainer + var window_scene = preload("res://Quinnsoft94/program_window.tscn") @@ -29,7 +31,6 @@ func spawn_program(program_scene, icon): var window = window_scene.instantiate() as DEWindow window_holder.add_child(window) var program = program_scene.instantiate() as Application - program.save_file = SaveFile.load_profile_from_disk() add_child(program) window.set_program(program) var button = Button.new() @@ -44,3 +45,22 @@ func _ready() -> void: add_desktop_icon(pof_icon, "Plentiful Fish", spawn_program.bind(pof_scene, pof_icon)) #add_desktop_icon(uno_icon, "Uno", spawn_program.bind(uno_scene, uno_icon)) #add_desktop_icon(snakes_and_ladders_icon, "Snakes and Ladders", spawn_program.bind(snakes_and_ladders_scene, snakes_and_ladders_icon)) + + +func _on_start_button_pressed() -> void: + start_menu.visible = !start_menu.visible + + +func _on_save_button_pressed() -> void: + Data.save() + start_menu.visible = false + + +func _on_reset_save_button_pressed() -> void: + Data.reset_fish() + start_menu.visible = false + + +func _on_quit_button_pressed() -> void: + Data.save() + get_tree().quit() diff --git a/Quinnsoft94/desktop.tscn b/Quinnsoft94/desktop.tscn index c59f71c..93e7814 100644 --- a/Quinnsoft94/desktop.tscn +++ b/Quinnsoft94/desktop.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://ddtcomingnoto"] +[gd_scene load_steps=10 format=3 uid="uid://ddtcomingnoto"] [ext_resource type="Script" path="res://Quinnsoft94/desktop.gd" id="1_7gagq"] [ext_resource type="Theme" uid="uid://cfsgvdm1la7nr" path="res://Quinnsoft94/quinnsoft94.tres" id="1_ipi37"] @@ -6,10 +6,11 @@ [ext_resource type="Texture2D" uid="uid://6y2jj10wkmu8" path="res://Assets/plentifulfish.png" id="3_acswl"] [ext_resource type="PackedScene" uid="uid://wa62w2wb4pmr" path="res://Menus/PlentifulFish/PoF.tscn" id="4_o0r25"] [ext_resource type="Texture2D" uid="uid://3ryvswnvtgpr" path="res://Assets/StartButton/start_button.png" id="5_0n3qh"] +[ext_resource type="Texture2D" uid="uid://c80yh0lidbpn0" path="res://Assets/OffButton/off_button.png" id="5_c2v4l"] [ext_resource type="Texture2D" uid="uid://dp5oddddyocwu" path="res://Assets/StartButton/start_button_pushed.png" id="6_7cebq"] [ext_resource type="Texture2D" uid="uid://bhvbeyk2kv2lm" path="res://Assets/StartButton/start_button_hovered.png" id="7_uy8qo"] -[node name="PanelContainer" type="ColorRect" node_paths=PackedStringArray("window_holder", "taskbar", "desktop_icon_container")] +[node name="PanelContainer" type="ColorRect" node_paths=PackedStringArray("window_holder", "taskbar", "desktop_icon_container", "start_menu")] texture_filter = 1 anchors_preset = 15 anchor_right = 1.0 @@ -25,6 +26,7 @@ taskbar = NodePath("PanelContainer/HBoxContainer/HBoxContainer") desktop_icon_container = NodePath("VBoxContainer") pof_icon = ExtResource("3_acswl") pof_scene = ExtResource("4_o0r25") +start_menu = NodePath("StartMenu") [node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 2 @@ -45,6 +47,39 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 +[node name="StartMenu" type="PanelContainer" parent="."] +visible = false +layout_mode = 1 +anchors_preset = -1 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = -100.0 +offset_right = 300.0 +offset_bottom = -40.0 +grow_vertical = 0 + +[node name="VBoxContainer" type="VBoxContainer" parent="StartMenu"] +layout_mode = 2 + +[node name="Button" type="Button" parent="StartMenu/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "save game" +alignment = 0 + +[node name="Button2" type="Button" parent="StartMenu/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "reset save file" +alignment = 0 + +[node name="Button3" type="Button" parent="StartMenu/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "quit" +icon = ExtResource("5_c2v4l") +alignment = 0 + [node name="PanelContainer" type="PanelContainer" parent="."] layout_mode = 1 anchors_preset = -1 @@ -91,3 +126,8 @@ text = "10:47pm" horizontal_alignment = 2 vertical_alignment = 1 script = ExtResource("1_vlwj3") + +[connection signal="pressed" from="StartMenu/VBoxContainer/Button" to="." method="_on_save_button_pressed"] +[connection signal="pressed" from="StartMenu/VBoxContainer/Button2" to="." method="_on_reset_save_button_pressed"] +[connection signal="pressed" from="StartMenu/VBoxContainer/Button3" to="." method="_on_quit_button_pressed"] +[connection signal="pressed" from="PanelContainer/HBoxContainer/MarginContainer/TextureButton" to="." method="_on_start_button_pressed"] diff --git a/Quinnsoft94/program_window.gd b/Quinnsoft94/program_window.gd index 60c87a6..7ee8e11 100644 --- a/Quinnsoft94/program_window.gd +++ b/Quinnsoft94/program_window.gd @@ -51,6 +51,7 @@ func minimize(): func close(): closed.emit() + Data.save() queue_free() diff --git a/data.gd b/data.gd new file mode 100644 index 0000000..3af421e --- /dev/null +++ b/data.gd @@ -0,0 +1,15 @@ +extends Node + +var save_file: SaveFile + + +func _ready() -> void: + save_file = SaveFile.load_profile_from_disk() + + +func save(): + save_file.save_to_disk() + + +func reset_fish(): + save_file.accepted_fish = [] diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..66d95d8 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,102 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../fishfest2024/Linux/fishbowl.x86_64" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=true +texture_format/bptc=true +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/architecture="x86_64" +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="#!/usr/bin/env bash +export DISPLAY=:0 +unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\" +\"{temp_dir}/{exe_name}\" {cmd_args}" +ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash +kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") +rm -rf \"{temp_dir}\"" + +[preset.1] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../fishfest2024/Windows/fishbowl.exe" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false + +[preset.1.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=false +texture_format/bptc=true +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" diff --git a/project.godot b/project.godot index 74a1970..bb7d304 100644 --- a/project.godot +++ b/project.godot @@ -14,6 +14,10 @@ config/name="Fishjam" run/main_scene="res://Menus/MainMenu/main_menu.tscn" config/features=PackedStringArray("4.2", "GL Compatibility") +[autoload] + +Data="*res://data.gd" + [debug] gdscript/warnings/inferred_declaration=2