Merge pull request #76 from Nitwel/tweaks

Tweaks to design and minor code changes
This commit is contained in:
Nitwel 2023-12-11 15:24:56 +01:00 committed by GitHub
commit eda7328ebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 101 additions and 34 deletions

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92f36b94bc49caee6ea06bae49983840ce37d27c0e38309038c20163c8b1c7b4
size 1035

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4a64ff479a30fbf4433998ba63f47e35fc731c5fbc22ab54524fdcbee9528755
size 1031

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7f2e541d2068e21b4d90ea607a31c35e958323a6a2bf0c819bc61ac1ee730c88
size 1035

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a5e6a3196f918f129fd1510750002b50eebce47f0bec850695552864f067db06
size 1028

View File

@ -21,7 +21,14 @@ func _ready():
func set_state(state): func set_state(state):
if state.attributes.has("friendly_name"): if state.attributes.has("friendly_name"):
button.label = state.attributes["friendly_name"] var name = state.attributes["friendly_name"]
if name.begins_with("icon:"):
name = name.substr(5)
button.icon = true
else:
button.icon = false
button.label = name
func _save(): func _save():
return { return {

View File

@ -5,6 +5,7 @@ extends StaticBody3D
@onready var view = $View @onready var view = $View
@onready var http_request = $HTTPRequest @onready var http_request = $HTTPRequest
@onready var mesh = $MeshInstance3D
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
@ -20,12 +21,14 @@ func _ready():
func set_state(stateInfo): func set_state(stateInfo):
if stateInfo == null: if stateInfo == null:
view.texture = null view.texture = null
mesh.visible = true
return return
var state = stateInfo["state"] var state = stateInfo["state"]
if state == "unavailable": if state == "unavailable":
view.texture = null view.texture = null
mesh.visible = true
return return
if stateInfo["attributes"].has("entity_picture"): if stateInfo["attributes"].has("entity_picture"):
@ -53,6 +56,7 @@ func load_image(url: String):
var texture = ImageTexture.create_from_image(image) var texture = ImageTexture.create_from_image(image)
view.texture = texture view.texture = texture
view.pixel_size = pixel_size view.pixel_size = pixel_size
mesh.visible = false
func _save(): func _save():
return { return {

View File

@ -1,9 +1,12 @@
[gd_scene load_steps=5 format=3 uid="uid://b0nq4wjfckxsa"] [gd_scene load_steps=6 format=3 uid="uid://b0nq4wjfckxsa"]
[ext_resource type="Script" path="res://content/entities/camera/camera.gd" id="1_htxq3"] [ext_resource type="Script" path="res://content/entities/camera/camera.gd" id="1_htxq3"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_e2u6o"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="2_e2u6o"]
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="3_jheyx"] [ext_resource type="Script" path="res://content/functions/occludable.gd" id="3_jheyx"]
[sub_resource type="QuadMesh" id="QuadMesh_830bv"]
size = Vector2(0.15, 0.15)
[sub_resource type="BoxShape3D" id="BoxShape3D_te0pn"] [sub_resource type="BoxShape3D" id="BoxShape3D_te0pn"]
size = Vector3(0.15, 0.15, 0.01) size = Vector3(0.15, 0.15, 0.01)
@ -13,6 +16,8 @@ script = ExtResource("1_htxq3")
[node name="View" type="Sprite3D" parent="."] [node name="View" type="Sprite3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.00451169)
mesh = SubResource("QuadMesh_830bv")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_te0pn") shape = SubResource("BoxShape3D_te0pn")

View File

@ -1,9 +1,11 @@
[gd_scene load_steps=7 format=3 uid="uid://lrehk38exd5n"] [gd_scene load_steps=9 format=3 uid="uid://lrehk38exd5n"]
[ext_resource type="Script" path="res://content/system/keyboard/keyboard.gd" id="1_maojw"] [ext_resource type="Script" path="res://content/system/keyboard/keyboard.gd" id="1_maojw"]
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_xdpwr"] [ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_xdpwr"]
[ext_resource type="Script" path="res://content/ui/menu/grid.gd" id="3_mx544"] [ext_resource type="Script" path="res://content/ui/menu/grid.gd" id="3_mx544"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_86fct"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="4_86fct"]
[ext_resource type="Material" uid="uid://bnwimm214q67g" path="res://assets/materials/sec-500.material" id="5_8c8rc"]
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="6_y4sdl"]
[sub_resource type="BoxShape3D" id="BoxShape3D_k5ib7"] [sub_resource type="BoxShape3D" id="BoxShape3D_k5ib7"]
size = Vector3(0.79, 0.01, 0.26) size = Vector3(0.79, 0.01, 0.26)
@ -52,4 +54,8 @@ shape = SubResource("BoxShape3D_k5ib7")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.300719, -0.009645, 0.0928761) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.300719, -0.009645, 0.0928761)
material_override = ExtResource("5_8c8rc")
mesh = SubResource("BoxMesh_7rntc") mesh = SubResource("BoxMesh_7rntc")
[node name="Occludable" type="Node" parent="."]
script = ExtResource("6_y4sdl")

View File

@ -11,7 +11,7 @@ const wall_edge_scene = preload("./wall_edge.tscn")
@onready var ground = $Ground/Clickable @onready var ground = $Ground/Clickable
var moving = null var moving = null
var editable := true: var editable := false:
set(value): set(value):
if value == editable: if value == editable:
return return
@ -36,6 +36,10 @@ func _start_edit_mode():
wall_corners.visible = true wall_corners.visible = true
wall_edges.visible = true wall_edges.visible = true
wall_mesh.visible = false wall_mesh.visible = false
wall_mesh.mesh = null
for old_coll in wall_collisions.get_children():
old_coll.queue_free()
func _end_edit_mode(): func _end_edit_mode():
wall_corners.visible = false wall_corners.visible = false
@ -47,9 +51,6 @@ func _end_edit_mode():
var collisions = generate_collision(wall_mesh.mesh) var collisions = generate_collision(wall_mesh.mesh)
for old_coll in wall_collisions.get_children():
old_coll.queue_free()
for collision in collisions: for collision in collisions:
var static_body = StaticBody3D.new() var static_body = StaticBody3D.new()
static_body.set_collision_layer_value(4, true) static_body.set_collision_layer_value(4, true)
@ -196,6 +197,8 @@ func _save():
} }
func _load(data): func _load(data):
await ready
for corner in data["corners"]: for corner in data["corners"]:
add_corner(corner) add_corner(corner)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://bswgmclohuqui"] [gd_scene load_steps=7 format=3 uid="uid://bswgmclohuqui"]
[ext_resource type="Script" path="res://content/system/room/room.gd" id="1_fccq0"] [ext_resource type="Script" path="res://content/system/room/room.gd" id="1_fccq0"]
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="1_ugebq"] [ext_resource type="Script" path="res://content/functions/clickable.gd" id="1_ugebq"]
@ -8,6 +8,8 @@
[sub_resource type="ArrayMesh" id="ArrayMesh_7dibq"] [sub_resource type="ArrayMesh" id="ArrayMesh_7dibq"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_ap613"]
[node name="Room" type="Node3D"] [node name="Room" type="Node3D"]
script = ExtResource("1_fccq0") script = ExtResource("1_fccq0")
@ -30,3 +32,11 @@ material_override = ExtResource("3_al1ev")
mesh = SubResource("ArrayMesh_7dibq") mesh = SubResource("ArrayMesh_7dibq")
[node name="WallCollisions" type="Node3D" parent="."] [node name="WallCollisions" type="Node3D" parent="."]
[node name="Celing" type="StaticBody3D" parent="."]
transform = Transform3D(-1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0, 3.07, 0)
collision_layer = 0
collision_mask = 0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Celing"]
shape = SubResource("WorldBoundaryShape3D_ap613")

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:44ea33f724141838db4ace01175c71088af8994891a20c7fdc9bb3ac36dac9aa oid sha256:fe7c098cfc9adadb447df0230eba8a81f1825dd3c0cf4e654ebf98ca2314c8cc
size 160 size 151

View File

@ -2,10 +2,7 @@
[ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"] [ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"]
[ext_resource type="ArrayMesh" uid="uid://iv4lk77axlk4" path="res://assets/immersive_home/button.obj" id="2_cve3l"] [ext_resource type="ArrayMesh" uid="uid://iv4lk77axlk4" path="res://assets/immersive_home/button.obj" id="2_cve3l"]
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_wx7av"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8s8ln"]
transparency = 1
albedo_color = Color(0, 0.501961, 0.886275, 1)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_o4j7g"] [sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_o4j7g"]
points = PackedVector3Array(-0.025, -0.01, -0.025, -0.025, 0.01, -0.025, 0.025, -0.01, -0.025, -0.025, -0.01, 0.025, -0.025, 0.01, 0.025, 0.025, 0.01, -0.025, 0.025, -0.01, 0.025, 0.025, 0.01, 0.025) points = PackedVector3Array(-0.025, -0.01, -0.025, -0.025, 0.01, -0.025, 0.025, -0.01, -0.025, -0.025, -0.01, 0.025, -0.025, 0.01, 0.025, 0.025, 0.01, -0.025, 0.025, -0.01, 0.025, 0.025, 0.01, 0.025)
@ -82,15 +79,15 @@ collision_mask = 0
[node name="MeshInstance3D" type="MeshInstance3D" parent="Body"] [node name="MeshInstance3D" type="MeshInstance3D" parent="Body"]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.005, 0) transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.005, 0)
material_override = ExtResource("2_wx7av")
mesh = ExtResource("2_cve3l") mesh = ExtResource("2_cve3l")
skeleton = NodePath("../..") skeleton = NodePath("../..")
surface_material_override/0 = SubResource("StandardMaterial3D_8s8ln")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
shape = SubResource("ConvexPolygonShape3D_o4j7g") shape = SubResource("ConvexPolygonShape3D_o4j7g")
[node name="Label" type="Label3D" parent="Body"] [node name="Label" type="Label3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.005, 0) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.0107199, 0)
pixel_size = 0.001 pixel_size = 0.001
text = "Example Text" text = "Example Text"
font_size = 10 font_size = 10

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=10 format=3 uid="uid://blrhy2uccrdn4"] [gd_scene load_steps=10 format=3 uid="uid://blrhy2uccrdn4"]
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/ui_element.material" id="1_0kd7r"] [ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="1_0kd7r"]
[ext_resource type="Script" path="res://content/ui/components/input/input.gd" id="1_uml3t"] [ext_resource type="Script" path="res://content/ui/components/input/input.gd" id="1_uml3t"]
[ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="3_ij5fh"] [ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="3_ij5fh"]

View File

@ -16,7 +16,6 @@ size = Vector3(0.24, 0.1, 0.1)
[node name="PageNumberLabel" type="Label3D" parent="."] [node name="PageNumberLabel" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.01, 0.27) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.01, 0.27)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "0 / 0" text = "0 / 0"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -25,12 +24,10 @@ outline_size = 0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, 0.01, 0.27) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, 0.01, 0.27)
[node name="NextPageButton" parent="Buttons" instance=ExtResource("4_tvimg")] [node name="NextPageButton" parent="Buttons" instance=ExtResource("4_tvimg")]
focusable = true
label = "navigate_next" label = "navigate_next"
icon = true icon = true
[node name="PreviousPageButton" parent="Buttons" instance=ExtResource("4_tvimg")] [node name="PreviousPageButton" parent="Buttons" instance=ExtResource("4_tvimg")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.08, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.08, 0, 0)
focusable = true
label = "navigate_before" label = "navigate_before"
icon = true icon = true

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=13 format=3 uid="uid://c3kdssrmv84kv"] [gd_scene load_steps=14 format=3 uid="uid://c3kdssrmv84kv"]
[ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"] [ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"]
[ext_resource type="Material" uid="uid://bnwimm214q67g" path="res://assets/materials/sec-500.material" id="2_0x5at"]
[ext_resource type="PackedScene" uid="uid://crrb0l3ekuotj" path="res://content/ui/menu/edit/edit_menu.tscn" id="4_r2raj"] [ext_resource type="PackedScene" uid="uid://crrb0l3ekuotj" path="res://content/ui/menu/edit/edit_menu.tscn" id="4_r2raj"]
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_w4i01"] [ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_w4i01"]
[ext_resource type="ArrayMesh" uid="uid://cbqhhnknyium2" path="res://assets/immersive_home_panels/immersive_home_panels.obj" id="7_f4u4o"] [ext_resource type="ArrayMesh" uid="uid://cbqhhnknyium2" path="res://assets/immersive_home_panels/immersive_home_panels.obj" id="7_f4u4o"]
@ -160,6 +161,7 @@ script = ExtResource("1_ng4u3")
[node name="Background" type="MeshInstance3D" parent="AnimationContainer"] [node name="Background" type="MeshInstance3D" parent="AnimationContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21, 0, 0.15) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21, 0, 0.15)
material_override = ExtResource("2_0x5at")
mesh = SubResource("BoxMesh_08du6") mesh = SubResource("BoxMesh_08du6")
skeleton = NodePath("../..") skeleton = NodePath("../..")

View File

@ -19,6 +19,10 @@ func _ready():
rooms.add_child(room) rooms.add_child(room)
else: else:
room = rooms.get_child(0) room = rooms.get_child(0)
if rooms.get_child_count() > 1:
for child in rooms.get_children():
if child != room:
child.queue_free()
) )
spawn_windows.on_button_down.connect(func(): spawn_windows.on_button_down.connect(func():

View File

@ -29,7 +29,6 @@ script = ExtResource("2_elugy")
[node name="Label3D" type="Label3D" parent="Interface"] [node name="Label3D" type="Label3D" parent="Interface"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.13, -1.86265e-09, 0.05) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.13, -1.86265e-09, 0.05)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "Edit Room" text = "Edit Room"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -37,7 +36,6 @@ outline_size = 0
[node name="CreateBlur" type="Label3D" parent="."] [node name="CreateBlur" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.15, 0.01, 0.261858) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.15, 0.01, 0.261858)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "Fake Windows" text = "Fake Windows"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0

View File

@ -10,6 +10,8 @@ const credits_scene = preload("./credits.tscn")
@onready var input_token = $Content/InputToken @onready var input_token = $Content/InputToken
@onready var button_connect = $Content/Connect @onready var button_connect = $Content/Connect
@onready var credits = $Content/Credits/Clickable @onready var credits = $Content/Credits/Clickable
@onready var save = $Content/Save
@onready var clear_save = $Content/ClearSave
@onready var background = $Background @onready var background = $Background
func _ready(): func _ready():
@ -52,6 +54,14 @@ func _ready():
}) })
) )
save.on_button_down.connect(func():
SaveSystem.save()
)
clear_save.on_button_down.connect(func():
SaveSystem.clear()
)
HomeApi.on_connect.connect(func(): HomeApi.on_connect.connect(func():
connection_status.text = "Connected" connection_status.text = "Connected"
) )

View File

@ -25,7 +25,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.007, 0)
[node name="Label3D" type="Label3D" parent="Content"] [node name="Label3D" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.134377, 0, 0.253575) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.134377, 0, 0.253575)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "Spawn Ball" text = "Spawn Ball"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -41,7 +40,6 @@ script = ExtResource("3_qmg6q")
[node name="ConnectionStatus" type="Label3D" parent="Content"] [node name="ConnectionStatus" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.250698, 0, 0.151303) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.250698, 0, 0.151303)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "Disconnected" text = "Disconnected"
font_size = 8 font_size = 8
outline_size = 0 outline_size = 0
@ -49,7 +47,6 @@ outline_size = 0
[node name="LabelURL" type="Label3D" parent="Content"] [node name="LabelURL" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.03) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.03)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "url: text = "url:
" "
font_size = 18 font_size = 18
@ -63,7 +60,6 @@ text = "ws://192.168.0.1:8123"
[node name="LabelToken" type="Label3D" parent="Content"] [node name="LabelToken" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.07) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.07)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "token:" text = "token:"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -76,7 +72,6 @@ text = "..."
[node name="LabelConnect" type="Label3D" parent="Content"] [node name="LabelConnect" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.14, 0, 0.12) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.14, 0, 0.12)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "Connect" text = "Connect"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -97,7 +92,6 @@ shape = SubResource("BoxShape3D_3qdps")
[node name="Label" type="Label3D" parent="Content/Credits"] [node name="Label" type="Label3D" parent="Content/Credits"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.0102286, 0.29) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.0102286, 0.29)
pixel_size = 0.001 pixel_size = 0.001
modulate = Color(0, 0, 0, 1)
text = "credits" text = "credits"
font_size = 12 font_size = 12
outline_size = 0 outline_size = 0
@ -113,3 +107,13 @@ outline_size = 0
[node name="Clickable" type="Node" parent="Content/Credits"] [node name="Clickable" type="Node" parent="Content/Credits"]
script = ExtResource("3_qmg6q") script = ExtResource("3_qmg6q")
[node name="Save" parent="Content" instance=ExtResource("1_faxng")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, 0, 0.17)
label = "save"
icon = true
[node name="ClearSave" parent="Content" instance=ExtResource("1_faxng")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, 0, 0.17)
label = "close"
icon = true

View File

@ -2,6 +2,9 @@ extends Node
const VariantSerializer = preload("res://lib/utils/variant_serializer.gd") const VariantSerializer = preload("res://lib/utils/variant_serializer.gd")
func clear():
_clear_save_tree(get_tree().root.get_node("Main"))
func save(): func save():
if HomeApi.has_connected() == false: if HomeApi.has_connected() == false:
return return
@ -19,6 +22,8 @@ func save():
save_file.store_line(json_text) save_file.store_line(json_text)
func load(): func load():
clear()
if HomeApi.has_connected() == false: if HomeApi.has_connected() == false:
return return
@ -38,6 +43,12 @@ func load():
else: else:
_build_save_tree(save_tree) _build_save_tree(save_tree)
func _clear_save_tree(node: Node):
for child in node.get_children():
_clear_save_tree(child)
if node.has_method("_save"):
node.queue_free()
func _generate_save_tree(node: Node): func _generate_save_tree(node: Node):
var children = [] var children = []
@ -76,10 +87,13 @@ func _generate_save_tree(node: Node):
func _build_save_tree(tree: Dictionary): func _build_save_tree(tree: Dictionary):
var new_object = load(tree["filename"]).instantiate() var new_object = load(tree["filename"]).instantiate()
get_node(tree["parent"]).add_child(new_object)
if new_object.has_method("_load"): if new_object.has_method("_load"):
new_object.call("_load", VariantSerializer.parse_value(tree["data"])) new_object.call("_load", VariantSerializer.parse_value(tree["data"]))
else: else:
for key in tree["data"].keys(): for key in tree["data"].keys():
new_object.set(key, VariantSerializer.parse_value(tree["data"][key])) new_object.set(key, VariantSerializer.parse_value(tree["data"][key]))
get_node(tree["parent"]).add_child(new_object)
for child in tree["children"]:
_build_save_tree(child)