added start menu and wait screen

This commit is contained in:
2024-04-03 00:25:59 +11:00
parent 5f9db2d250
commit dd5618e709
14 changed files with 269 additions and 23 deletions

View File

@ -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

View File

@ -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()