introducing dynamic scene loading, main scene rework

This commit is contained in:
betalars 2024-10-02 01:30:03 +02:00
parent db4dea4dcf
commit 1c1262af82
12 changed files with 570 additions and 59 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://flisupth27th"]
[ext_resource type="PackedScene" uid="uid://fcxu7diwgr4c" path="res://base-environments/volunteer_room/import/volunteer_room.glb" id="1_qf4mf"]
[ext_resource type="PackedScene" uid="uid://fcxu7diwgr4c" path="res://base-environments/volunteer_room/import/volunteer_room.glb" id="1_o6q23"]
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_8h7yl"]
@ -42,7 +42,7 @@ adjustment_enabled = true
[node name="Node3D" type="Node3D"]
[node name="volunteer_room" parent="." instance=ExtResource("1_qf4mf")]
[node name="volunteer_room" parent="." instance=ExtResource("1_o6q23")]
[node name="OmniLight3D2" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 6.70552e-08, 0, -6.70552e-08, 1, 1.8719, 1.58367, -5.11048)

BIN
src/import/interface-elements/loading_rect_clip.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d031kxe5m4ihh"
path="res://.godot/imported/loading_rect_clip.png-d6c6f5676ae4dd43e8d3a04873327a56.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://import/interface-elements/loading_rect_clip.png"
dest_files=["res://.godot/imported/loading_rect_clip.png-d6c6f5676ae4dd43e8d3a04873327a56.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

BIN
src/import/interface-elements/loading_rect_deco.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dpftqdvtrkioh"
path="res://.godot/imported/loading_rect_deco.png-0a6f5c768c825bbd169367e1ed426907.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://import/interface-elements/loading_rect_deco.png"
dest_files=["res://.godot/imported/loading_rect_deco.png-0a6f5c768c825bbd169367e1ed426907.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

BIN
src/import/interface-elements/loading_rect_frame.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bqf82f8dk4yun"
path="res://.godot/imported/loading_rect_frame.png-165c087a2ed93fd586d0158dd66f4cfc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://import/interface-elements/loading_rect_frame.png"
dest_files=["res://.godot/imported/loading_rect_frame.png-165c087a2ed93fd586d0158dd66f4cfc.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

Binary file not shown.

View File

@ -1,9 +1,39 @@
extends Node3D
@export_file(".tscn") var youth_room_path: String
@export_file(".tscn") var voluntary_room: String
@export_file(".tscn") var study_room: String
@onready var loading_player: AnimationPlayer = %MenuAnimationPlayer
var last_progress_state: float = 0
var current_loaded_room: Node3D
var currently_loading_room: String = "":
set(path):
if path != "":
ResourceLoader.load_threaded_request(path, "PackedScene")
currently_loading_room = path
last_progress_state
loading_player.queue("loading")
else:
loading_player.queue("loading_done")
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
currently_loading_room = youth_room_path
func _process(delta: float) -> void:
if currently_loading_room != "":
var progress:Array
if ResourceLoader.load_threaded_get_status(youth_room_path, progress) == 3:
current_loaded_room = ResourceLoader.load_threaded_get(youth_room_path).instantiate()
add_child(current_loaded_room)
move_child(current_loaded_room, 0)
currently_loading_room = ""
elif last_progress_state != progress[0]:
loading_player.seek(progress[0])
last_progress_state = progress[0]
func debug_youth():
get_child(1).hide()
@ -11,7 +41,3 @@ func debug_youth():
get_child(3).hide()
get_child(0).get_ready()
get_child(0).start()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

View File

@ -1,10 +1,15 @@
[gd_scene load_steps=7 format=3 uid="uid://befxf8uruwnrl"]
[gd_scene load_steps=20 format=3 uid="uid://befxf8uruwnrl"]
[ext_resource type="Script" path="res://main.gd" id="1_rqkns"]
[ext_resource type="PackedScene" uid="uid://gldtxysavetf" path="res://logic-scenes/startup/startup.tscn" id="1_v5rpm"]
[ext_resource type="PackedScene" uid="uid://b3b0gyvklqn50" path="res://base-environments/youth_room/youth_room.tscn" id="2_23ia3"]
[ext_resource type="PackedScene" uid="uid://b51wdql4mby47" path="res://main_menu.tscn" id="3_ik73t"]
[ext_resource type="Texture2D" uid="uid://d031kxe5m4ihh" path="res://import/interface-elements/loading_rect_clip.png" id="5_sr555"]
[ext_resource type="Texture2D" uid="uid://bqf82f8dk4yun" path="res://import/interface-elements/loading_rect_frame.png" id="6_aaaxa"]
[ext_resource type="Texture2D" uid="uid://dpftqdvtrkioh" path="res://import/interface-elements/loading_rect_deco.png" id="7_koraw"]
[ext_resource type="PackedScene" uid="uid://6aaxpvoepqrm" path="res://disclaimer.tscn" id="7_t45fc"]
[ext_resource type="Script" path="res://logic-scenes/main menu/save_game_list.gd" id="8_jecj3"]
[ext_resource type="Script" path="res://dev-util/savegame.gd" id="9_7v45a"]
[ext_resource type="Texture2D" uid="uid://bk5ja14r7r6i4" path="res://import/interface-elements/empty_save_slot.png" id="10_l87ac"]
[sub_resource type="GDScript" id="GDScript_8sq0u"]
script/source = "extends Label
@ -13,10 +18,282 @@ func _process(_delta):
text = str(Engine.get_frames_per_second())
"
[node name="root" type="Node3D"]
script = ExtResource("1_rqkns")
[sub_resource type="Animation" id="Animation_y6s08"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.5708]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("frame/deco:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [-0.314159]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("frame/deco:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("../../Panel:modulate")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(0, 0, 0, 1)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("../../Main Menu:modulate")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[node name="youth room" parent="." instance=ExtResource("2_23ia3")]
[sub_resource type="Animation" id="Animation_l5ynk"]
resource_name = "init"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../../Panel:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0, 0, 0, 1), Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("../../Main Menu:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.166667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_k667j"]
resource_name = "loading"
length = 2.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.0333333, 1.76667),
"transitions": PackedFloat32Array(0.406126, 1),
"update": 0,
"values": [1.5708, 0.261799]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("frame/deco:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.0333368, 1.76667),
"transitions": PackedFloat32Array(0.406126, 1),
"update": 0,
"values": [-1.5708, -0.261799]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("frame/deco:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.366667, 1.66667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_nuxr6"]
resource_name = "loading_done"
length = 1.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1.4),
"transitions": PackedFloat32Array(2.2974, 1),
"update": 0,
"values": [0.261799, -1.5708]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("frame/deco:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1.4),
"transitions": PackedFloat32Array(2.2974, 1),
"update": 0,
"values": [-0.261799, 1.5708]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.933333, 1.36667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("../../Panel:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.566667, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ogbs1"]
_data = {
"RESET": SubResource("Animation_y6s08"),
"init": SubResource("Animation_l5ynk"),
"loading": SubResource("Animation_k667j"),
"loading_done": SubResource("Animation_nuxr6")
}
[sub_resource type="Resource" id="Resource_u1xhm"]
script = ExtResource("9_7v45a")
current_room = 0
mementos_complete = 0
thumbnail = ExtResource("10_l87ac")
last_saved = {
"day": 1,
"dst": true,
"hour": 15,
"minute": 7,
"month": 10,
"second": 31,
"weekday": 2,
"year": 2024
}
[sub_resource type="Resource" id="Resource_2d1xt"]
script = ExtResource("9_7v45a")
current_room = 0
mementos_complete = 0
thumbnail = ExtResource("10_l87ac")
last_saved = {
"day": 1,
"dst": true,
"hour": 15,
"minute": 7,
"month": 10,
"second": 31,
"weekday": 2,
"year": 2024
}
[sub_resource type="Resource" id="Resource_slmss"]
script = ExtResource("9_7v45a")
current_room = 0
mementos_complete = 0
thumbnail = ExtResource("10_l87ac")
last_saved = {
"day": 1,
"dst": true,
"hour": 15,
"minute": 7,
"month": 10,
"second": 31,
"weekday": 2,
"year": 2024
}
[node name="main" type="Node3D"]
script = ExtResource("1_rqkns")
youth_room_path = "res://base-environments/youth_room/youth_room.tscn"
voluntary_room = "res://base-environments/volunteer_room/volunteer_room.tscn"
[node name="Panel" type="Panel" parent="."]
modulate = Color(0, 0, 0, 1)
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="Main Menu" parent="." instance=ExtResource("3_ik73t")]
@ -31,4 +308,49 @@ visible = false
[node name="Disclaimer" parent="." instance=ExtResource("7_t45fc")]
visible = false
[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -40.0
offset_right = 40.0
grow_vertical = 0
[node name="mask" type="Sprite2D" parent="Control"]
modulate = Color(1, 1, 1, 0)
clip_children = 1
position = Vector2(98, -47)
rotation = 1.5708
texture = ExtResource("5_sr555")
[node name="frame" type="Sprite2D" parent="Control/mask"]
clip_children = 1
texture = ExtResource("6_aaaxa")
[node name="deco" type="Sprite2D" parent="Control/mask/frame"]
modulate = Color(1, 1, 1, 0)
rotation = -0.314159
texture = ExtResource("7_koraw")
[node name="MenuAnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
root_node = NodePath("../Control/mask")
libraries = {
"": SubResource("AnimationLibrary_ogbs1")
}
autoplay = "init"
[node name="SaveGameHandle" type="CenterContainer" parent="."]
visible = false
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("8_jecj3")
save_1 = SubResource("Resource_u1xhm")
save_2 = SubResource("Resource_2d1xt")
save_3 = SubResource("Resource_slmss")
[connection signal="on_read" from="Disclaimer" to="Startup Menu" method="starting"]