diff --git a/project.godot b/project.godot index d17b866..b0740ac 100644 --- a/project.godot +++ b/project.godot @@ -24,9 +24,10 @@ COOKING="*res://scripts/Singletons/Cooking.gd" ITEM="*res://scripts/Singletons/Item.gd" OVERWORLD="*res://scripts/Singletons/Overworld.gd" PAUSE="*res://scripts/Singletons/Pause.gd" -QUEST="*res://scripts/Singletons/Quest.gd" +QUEST="*res://scenes/Singletons/Quest.tscn" SCENE_MANAGER="*res://scripts/Singletons/SceneManager.gd" VN="*res://scenes/Singletons/VN.tscn" +UI="*res://scenes/Singletons/UI.tscn" [dotnet] diff --git a/scenes/Entities/Rosa.tscn b/scenes/Entities/Rosa.tscn index 80b98c4..41a496d 100644 --- a/scenes/Entities/Rosa.tscn +++ b/scenes/Entities/Rosa.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=8 format=3 uid="uid://yhtpoum3eek7"] -[ext_resource type="Script" uid="uid://ixwikdguyhf0" path="res://scripts/Entities/RosaController.gd" id="1_3g383"] -[ext_resource type="Script" uid="uid://jd50n00bo05y" path="res://scripts/Entities/RosaCamera.gd" id="2_tr66j"] +[ext_resource type="Script" uid="uid://ixwikdguyhf0" path="res://scripts/Entity/RosaController.gd" id="1_3g383"] +[ext_resource type="Script" uid="uid://jd50n00bo05y" path="res://scripts/Entity/RosaCamera.gd" id="2_tr66j"] [ext_resource type="Shader" uid="uid://7h2axb2tsh17" path="res://shaders/NPC Shader.gdshader" id="3_j5vis"] [ext_resource type="Texture2D" uid="uid://cofrgefp8e617" path="res://textures/human.png" id="4_rvn3n"] diff --git a/scenes/Entities/TestNPC.tscn b/scenes/Entities/TestNPC.tscn index 551a7c3..d7fe00d 100644 --- a/scenes/Entities/TestNPC.tscn +++ b/scenes/Entities/TestNPC.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=3 uid="uid://dr4b2pmsknuhc"] -[ext_resource type="Script" uid="uid://d23qg1ovkbxst" path="res://scripts/Entities/BasicNPCEntity.gd" id="1_1muh7"] +[ext_resource type="Script" uid="uid://d23qg1ovkbxst" path="res://scripts/Entity/BasicNPCEntity.gd" id="1_1muh7"] [ext_resource type="Shader" uid="uid://7h2axb2tsh17" path="res://shaders/NPC Shader.gdshader" id="1_xgcv1"] [ext_resource type="Texture2D" uid="uid://cofrgefp8e617" path="res://textures/human.png" id="4_vo0ku"] diff --git a/scenes/MainMenu.tscn b/scenes/MainMenu.tscn index 8f6c072..2f50384 100644 --- a/scenes/MainMenu.tscn +++ b/scenes/MainMenu.tscn @@ -1,29 +1,25 @@ -[gd_scene format=3 uid="uid://w1q5eoiejmy3"] +[gd_scene load_steps=2 format=3 uid="uid://w1q5eoiejmy3"] -[node name="MainMenu" type="Node3D"] +[ext_resource type="PackedScene" uid="uid://bimrljk1rn7af" path="res://scenes/UI/SubsceneUI.tscn" id="1_yqorp"] -[node name="UI" type="Control" parent="."] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="MainMenu" type="Node"] -[node name="Label" type="Label" parent="UI"] +[node name="SubsceneUI" parent="." instance=ExtResource("1_yqorp")] + +[node name="Label" type="Label" parent="SubsceneUI"] layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -68.0 -offset_top = -11.5 -offset_right = 68.0 -offset_bottom = 11.5 +offset_left = -133.5 +offset_top = -37.5 +offset_right = 133.5 +offset_bottom = 37.5 grow_horizontal = 2 grow_vertical = 2 -text = "Thyme and Magic +text = "Thyme and Magic - Prototype Press tab to bring up debug menu." horizontal_alignment = 1 diff --git a/scenes/Maps/TestMap/TestMap.tscn b/scenes/Maps/TestMap/TestMap.tscn index 1a1d8f3..d50f460 100644 --- a/scenes/Maps/TestMap/TestMap.tscn +++ b/scenes/Maps/TestMap/TestMap.tscn @@ -4,8 +4,8 @@ [ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/Entities/TestNPC.tscn" id="2_cg1ph"] [ext_resource type="PackedScene" uid="uid://lh713g04d3bg" path="res://scenes/Maps/TestMap/TestMapGround.tscn" id="3_gxq5o"] [ext_resource type="PackedScene" uid="uid://boj5o4fx41rv8" path="res://scenes/Maps/TestMap/TestMapBuilding.tscn" id="4_brp0k"] -[ext_resource type="Script" uid="uid://tkfc88q8m86f" path="res://scripts/Events/EventConversation.gd" id="5_cg1ph"] -[ext_resource type="Script" uid="uid://y7ckj1tn5cro" path="res://scripts/Events/EventTextbox.gd" id="6_gxq5o"] +[ext_resource type="Script" uid="uid://tkfc88q8m86f" path="res://scripts/Event/EventConversation.gd" id="5_cg1ph"] +[ext_resource type="Script" uid="uid://y7ckj1tn5cro" path="res://scripts/Event/EventTextbox.gd" id="6_gxq5o"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"] sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1) diff --git a/scenes/Singletons/Debug.tscn b/scenes/Singletons/Debug.tscn index c85c645..1f162d6 100644 --- a/scenes/Singletons/Debug.tscn +++ b/scenes/Singletons/Debug.tscn @@ -1,21 +1,19 @@ -[gd_scene load_steps=3 format=3 uid="uid://klfo3l0dxlht"] +[gd_scene load_steps=4 format=3 uid="uid://klfo3l0dxlht"] [ext_resource type="Script" uid="uid://d36d3fnpi8y30" path="res://scripts/Singletons/Debug.gd" id="1_5spvt"] +[ext_resource type="PackedScene" uid="uid://bimrljk1rn7af" path="res://scenes/UI/SubsceneUI.tscn" id="2_5o7yr"] [ext_resource type="PackedScene" uid="uid://verg13jtqwvh" path="res://scenes/UI/DebugMenu.tscn" id="2_c2xgb"] -[node name="Debug" type="Node2D"] +[node name="Debug" type="Node"] script = ExtResource("1_5spvt") -[node name="UI" type="Control" parent="."] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="SubsceneUI" parent="." instance=ExtResource("2_5o7yr")] +layer = 3 -[node name="DebugMenu" parent="UI" instance=ExtResource("2_c2xgb")] +[node name="DebugMenu" parent="SubsceneUI" instance=ExtResource("2_c2xgb")] layout_mode = 0 anchors_preset = 0 anchor_bottom = 0.0 +offset_right = 207.0 +offset_bottom = 206.0 grow_vertical = 1 diff --git a/scenes/Singletons/Quest.tscn b/scenes/Singletons/Quest.tscn new file mode 100644 index 0000000..d7366c5 --- /dev/null +++ b/scenes/Singletons/Quest.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://cs3kmmd0rfm8w"] + +[ext_resource type="Script" uid="uid://d0060jeyftia7" path="res://scripts/Singletons/Quest.gd" id="1_v2h4q"] + +[node name="Quest" type="Node"] +script = ExtResource("1_v2h4q") diff --git a/scenes/Singletons/UI.tscn b/scenes/Singletons/UI.tscn new file mode 100644 index 0000000..60b41fe --- /dev/null +++ b/scenes/Singletons/UI.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=2 format=3 uid="uid://b5bwpsh0gcicf"] + +[ext_resource type="Script" uid="uid://dahhuhiu8u88b" path="res://scripts/Singletons/UI.gd" id="1_g3au4"] + +[node name="UI" 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_g3au4") +metadata/_custom_type_script = "uid://dahhuhiu8u88b" + +[node name="LayerGame" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="LayerVN" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="LayerDebug" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/scenes/Singletons/VN.tscn b/scenes/Singletons/VN.tscn index 084998e..ee12e22 100644 --- a/scenes/Singletons/VN.tscn +++ b/scenes/Singletons/VN.tscn @@ -1,18 +1,14 @@ -[gd_scene load_steps=3 format=3 uid="uid://b6pl1cq5y05ad"] +[gd_scene load_steps=4 format=3 uid="uid://b6pl1cq5y05ad"] [ext_resource type="Script" uid="uid://benvf7v4p4i2l" path="res://scripts/Singletons/VN.gd" id="1_01fad"] [ext_resource type="PackedScene" uid="uid://bkx3l0kckf4a8" path="res://scenes/UI/VNTextbox.tscn" id="2_adm0d"] +[ext_resource type="PackedScene" uid="uid://bimrljk1rn7af" path="res://scenes/UI/SubsceneUI.tscn" id="2_hxsm8"] [node name="VN" type="Node"] script = ExtResource("1_01fad") -[node name="UI" type="Control" parent="."] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="SubsceneUI" parent="." instance=ExtResource("2_hxsm8")] +layer = 1 -[node name="VNTextbox" parent="UI" instance=ExtResource("2_adm0d")] +[node name="VNTextbox" parent="SubsceneUI" instance=ExtResource("2_adm0d")] layout_mode = 1 diff --git a/scenes/UI/SubsceneUI.tscn b/scenes/UI/SubsceneUI.tscn new file mode 100644 index 0000000..3718c1f --- /dev/null +++ b/scenes/UI/SubsceneUI.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=3 uid="uid://bimrljk1rn7af"] + +[ext_resource type="Script" uid="uid://x3cc7wsnn0xd" path="res://scripts/UI/SubsceneUI.gd" id="1_m23s2"] + +[node name="SubsceneUI" 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_m23s2") +metadata/_custom_type_script = "uid://x3cc7wsnn0xd" diff --git a/scripts/Cutscene/Event/Entity/OverworldEntityEvent.gd b/scripts/Cutscene/Event/Entity/OverworldEntityEvent.gd index d271685..28feac5 100644 --- a/scripts/Cutscene/Event/Entity/OverworldEntityEvent.gd +++ b/scripts/Cutscene/Event/Entity/OverworldEntityEvent.gd @@ -1,5 +1,5 @@ class_name OverworldEntityEvent extends "res://scripts/Cutscene/CutsceneEvent.gd" -const OverworldEntity = preload("res://scripts/Entities/OverworldEntity.gd"); +const OverworldEntity = preload("res://scripts/Entity/OverworldEntity.gd"); var entity:OverworldEntity; diff --git a/scripts/Cutscene/Scene/OverworldConversationEvent.gd b/scripts/Cutscene/Scene/OverworldConversationEvent.gd index 213f767..a767625 100644 --- a/scripts/Cutscene/Scene/OverworldConversationEvent.gd +++ b/scripts/Cutscene/Scene/OverworldConversationEvent.gd @@ -1,5 +1,5 @@ class_name OverworldConversationEvent extends "res://scripts/Cutscene/Cutscene.gd" -const OverworldEntity = preload("res://scripts/Entities/OverworldEntity.gd"); +const OverworldEntity = preload("res://scripts/Entity/OverworldEntity.gd"); const TextboxEvent = preload("res://scripts/Cutscene/Event/VisualNovel/TextboxEvent.gd"); const PauseEvent = preload("res://scripts/Cutscene/Event/CutscenePauseEvent.gd"); const OverworldChangeDirectionEvent = preload("res://scripts/Cutscene/Event/Entity/OverworldChangeDirectionEvent.gd"); diff --git a/scripts/Entities/BasicNPCEntity.gd b/scripts/Entity/BasicNPCEntity.gd similarity index 85% rename from scripts/Entities/BasicNPCEntity.gd rename to scripts/Entity/BasicNPCEntity.gd index 252356a..49af713 100644 --- a/scripts/Entities/BasicNPCEntity.gd +++ b/scripts/Entity/BasicNPCEntity.gd @@ -1,5 +1,5 @@ -class_name BasicNPCEntity extends "res://scripts/Entities/OverworldEntity.gd" -const Event = preload("res://scripts/Events/Event.gd"); +class_name BasicNPCEntity extends "res://scripts/Entity/OverworldEntity.gd" +const Event = preload("res://scripts/Event/Event.gd"); enum BasicNPCMoveType { STILL, diff --git a/scripts/Entities/BasicNPCEntity.gd.uid b/scripts/Entity/BasicNPCEntity.gd.uid similarity index 100% rename from scripts/Entities/BasicNPCEntity.gd.uid rename to scripts/Entity/BasicNPCEntity.gd.uid diff --git a/scripts/Entities/OverworldEntity.gd b/scripts/Entity/OverworldEntity.gd similarity index 100% rename from scripts/Entities/OverworldEntity.gd rename to scripts/Entity/OverworldEntity.gd diff --git a/scripts/Entities/OverworldEntity.gd.uid b/scripts/Entity/OverworldEntity.gd.uid similarity index 100% rename from scripts/Entities/OverworldEntity.gd.uid rename to scripts/Entity/OverworldEntity.gd.uid diff --git a/scripts/Entities/RosaCamera.gd b/scripts/Entity/RosaCamera.gd similarity index 100% rename from scripts/Entities/RosaCamera.gd rename to scripts/Entity/RosaCamera.gd diff --git a/scripts/Entities/RosaCamera.gd.uid b/scripts/Entity/RosaCamera.gd.uid similarity index 100% rename from scripts/Entities/RosaCamera.gd.uid rename to scripts/Entity/RosaCamera.gd.uid diff --git a/scripts/Entities/RosaController.gd b/scripts/Entity/RosaController.gd similarity index 95% rename from scripts/Entities/RosaController.gd rename to scripts/Entity/RosaController.gd index e3e76eb..f2c4922 100644 --- a/scripts/Entities/RosaController.gd +++ b/scripts/Entity/RosaController.gd @@ -1,4 +1,4 @@ -class_name RosaController extends "res://scripts/Entities/OverworldEntity.gd" +class_name RosaController extends "res://scripts/Entity/OverworldEntity.gd" var interactRange = 0.7; diff --git a/scripts/Entities/RosaController.gd.uid b/scripts/Entity/RosaController.gd.uid similarity index 100% rename from scripts/Entities/RosaController.gd.uid rename to scripts/Entity/RosaController.gd.uid diff --git a/scripts/Events/Entity/EventEntityTurn.gd b/scripts/Event/Entity/EventEntityTurn.gd similarity index 74% rename from scripts/Events/Entity/EventEntityTurn.gd rename to scripts/Event/Entity/EventEntityTurn.gd index 4e860ea..744688a 100644 --- a/scripts/Events/Entity/EventEntityTurn.gd +++ b/scripts/Event/Entity/EventEntityTurn.gd @@ -1,4 +1,4 @@ -class_name EventEntityTurn extends "res://scripts/Events/Event.gd" +class_name EventEntityTurn extends "res://scripts/Event/Event.gd" @export var entity:OverworldEntity = null @export var direction:OverworldEntity.Direction = OverworldEntity.Direction.SOUTH diff --git a/scripts/Events/Entity/EventEntityTurn.gd.uid b/scripts/Event/Entity/EventEntityTurn.gd.uid similarity index 100% rename from scripts/Events/Entity/EventEntityTurn.gd.uid rename to scripts/Event/Entity/EventEntityTurn.gd.uid diff --git a/scripts/Events/Event.gd b/scripts/Event/Event.gd similarity index 91% rename from scripts/Events/Event.gd rename to scripts/Event/Event.gd index 200d849..4c75019 100644 --- a/scripts/Events/Event.gd +++ b/scripts/Event/Event.gd @@ -1,6 +1,6 @@ class_name Event extends Node -const OverworldEntity = preload("res://scripts/Entities/OverworldEntity.gd"); +const OverworldEntity = preload("res://scripts/Entity/OverworldEntity.gd"); var started:bool = false; diff --git a/scripts/Events/Event.gd.uid b/scripts/Event/Event.gd.uid similarity index 100% rename from scripts/Events/Event.gd.uid rename to scripts/Event/Event.gd.uid diff --git a/scripts/Events/EventConversation.gd b/scripts/Event/EventConversation.gd similarity index 94% rename from scripts/Events/EventConversation.gd rename to scripts/Event/EventConversation.gd index ce2829d..c22910a 100644 --- a/scripts/Events/EventConversation.gd +++ b/scripts/Event/EventConversation.gd @@ -1,4 +1,4 @@ -class_name EventConversation extends "res://scripts/Events/Flow/EventGroup.gd" +class_name EventConversation extends "res://scripts/Event/Flow/EventGroup.gd" @export var startPauseType:PauseSystem.PauseType = PauseSystem.PauseType.ENTITY_PAUSED @export var endPauseType:PauseSystem.PauseType = PauseSystem.PauseType.NOT_PAUSED diff --git a/scripts/Events/EventConversation.gd.uid b/scripts/Event/EventConversation.gd.uid similarity index 100% rename from scripts/Events/EventConversation.gd.uid rename to scripts/Event/EventConversation.gd.uid diff --git a/scripts/Events/EventGroup.gd.uid b/scripts/Event/EventGroup.gd.uid similarity index 100% rename from scripts/Events/EventGroup.gd.uid rename to scripts/Event/EventGroup.gd.uid diff --git a/scripts/Events/EventPause.gd b/scripts/Event/EventPause.gd similarity index 89% rename from scripts/Events/EventPause.gd rename to scripts/Event/EventPause.gd index d17f483..c5f3698 100644 --- a/scripts/Events/EventPause.gd +++ b/scripts/Event/EventPause.gd @@ -1,4 +1,4 @@ -class_name EventPause extends "res://scripts/Events/Event.gd" +class_name EventPause extends "res://scripts/Event/Event.gd" const PauseSystem = preload("res://scripts/Singletons/Pause.gd") diff --git a/scripts/Events/EventPause.gd.uid b/scripts/Event/EventPause.gd.uid similarity index 100% rename from scripts/Events/EventPause.gd.uid rename to scripts/Event/EventPause.gd.uid diff --git a/scripts/Events/EventTextbox.gd b/scripts/Event/EventTextbox.gd similarity index 63% rename from scripts/Events/EventTextbox.gd rename to scripts/Event/EventTextbox.gd index 75e2d61..4ad49f5 100644 --- a/scripts/Events/EventTextbox.gd +++ b/scripts/Event/EventTextbox.gd @@ -1,4 +1,4 @@ -class_name EventTextbox extends "res://scripts/Events/Event.gd" +class_name EventTextbox extends "res://scripts/Event/Event.gd" # @export var text:Array[String] = [ "Hello Text" ]; @export_multiline var text:String = "Hello Text" @@ -8,4 +8,4 @@ func start() -> void: VN.getTextbox().setText(self.text); func isDone() -> bool: - return super.isDone() && VN.getTextbox().isClosed; \ No newline at end of file + return super.isDone() && VN.getTextbox().isClosed; diff --git a/scripts/Events/EventTextbox.gd.uid b/scripts/Event/EventTextbox.gd.uid similarity index 100% rename from scripts/Events/EventTextbox.gd.uid rename to scripts/Event/EventTextbox.gd.uid diff --git a/scripts/Events/EventWithChildren.gd.uid b/scripts/Event/EventWithChildren.gd.uid similarity index 100% rename from scripts/Events/EventWithChildren.gd.uid rename to scripts/Event/EventWithChildren.gd.uid diff --git a/scripts/Events/Flow/EventGroup.gd b/scripts/Event/Flow/EventGroup.gd similarity index 95% rename from scripts/Events/Flow/EventGroup.gd rename to scripts/Event/Flow/EventGroup.gd index 46dbdfc..41ef5d8 100644 --- a/scripts/Events/Flow/EventGroup.gd +++ b/scripts/Event/Flow/EventGroup.gd @@ -1,4 +1,4 @@ -class_name EventGroup extends "res://scripts/Events/Flow/EventWithChildren.gd" +class_name EventGroup extends "res://scripts/Event/Flow/EventWithChildren.gd" enum ProcessType { SEQUENTIAL, diff --git a/scripts/Events/Flow/EventGroup.gd.uid b/scripts/Event/Flow/EventGroup.gd.uid similarity index 100% rename from scripts/Events/Flow/EventGroup.gd.uid rename to scripts/Event/Flow/EventGroup.gd.uid diff --git a/scripts/Events/Flow/EventWithChildren.gd b/scripts/Event/Flow/EventWithChildren.gd similarity index 61% rename from scripts/Events/Flow/EventWithChildren.gd rename to scripts/Event/Flow/EventWithChildren.gd index 3413274..eea3a0a 100644 --- a/scripts/Events/Flow/EventWithChildren.gd +++ b/scripts/Event/Flow/EventWithChildren.gd @@ -1,34 +1,12 @@ -class_name EventWithChildren extends "res://scripts/Events/Event.gd" +class_name EventWithChildren extends "res://scripts/Event/Event.gd" var childEvents:Array[Event] = [] var extraEvents:Array[Event] = [] -func _init() -> void: - super._init() - # _updateChildEvents() - # self.child_entered_tree.connect(onChildEntered) - # self.child_exiting_tree.connect(onChildExited) - # self.child_order_changed.connect(onChildOrderChanged) - func start(): super.start() _updateChildEvents() -func _updateChildEvents() -> void: - childEvents = [] - for child in get_children(): - if child is Event: - childEvents.append(child) - -func onChildEntered(child:Node) -> void: - _updateChildEvents() - -func onChildExited(child:Node) -> void: - _updateChildEvents() - -func onChildOrderChanged() -> void: - _updateChildEvents() - func reset() -> void: super.reset() _cleanupExtraEvents() @@ -37,6 +15,12 @@ func end() -> void: super.end() _cleanupExtraEvents() +func _updateChildEvents() -> void: + childEvents = [] + for child in get_children(): + if child is Event: + childEvents.append(child) + func _cleanupExtraEvents(): for event in extraEvents: remove_child(event) diff --git a/scripts/Events/Flow/EventWithChildren.gd.uid b/scripts/Event/Flow/EventWithChildren.gd.uid similarity index 100% rename from scripts/Events/Flow/EventWithChildren.gd.uid rename to scripts/Event/Flow/EventWithChildren.gd.uid diff --git a/scripts/Singletons/Debug.gd b/scripts/Singletons/Debug.gd index 208d64b..a01081f 100644 --- a/scripts/Singletons/Debug.gd +++ b/scripts/Singletons/Debug.gd @@ -3,7 +3,7 @@ extends Node var debugMenu:DebugMenu func _ready() -> void: - debugMenu = $UI/DebugMenu; + debugMenu = $SubsceneUI/DebugMenu; debugMenu.hide() func _process(delta: float) -> void: @@ -16,8 +16,7 @@ func _process(delta: float) -> void: func showMenu() -> void: debugMenu.show() - self.get_parent().move_child(self, self.get_parent().get_child_count() - 1) + print("Debug menu shown") func hideMenu() -> void: debugMenu.hide() - self.get_parent().move_child(self, 0) diff --git a/scripts/Singletons/Quest.gd b/scripts/Singletons/Quest.gd index 5b3261c..2ebcc6a 100644 --- a/scripts/Singletons/Quest.gd +++ b/scripts/Singletons/Quest.gd @@ -1,7 +1 @@ -class_name QuestSystem extends Node - -static var QUEST_EXAMPLE = preload("res://scripts/Quest/QuestExample.gd").new(); - -static var ALL_QUESTS = [ - QUEST_EXAMPLE -] +class_name QuestSystem extends Node \ No newline at end of file diff --git a/scripts/Singletons/SceneManager.gd b/scripts/Singletons/SceneManager.gd index 1abbb43..34d92a1 100644 --- a/scripts/Singletons/SceneManager.gd +++ b/scripts/Singletons/SceneManager.gd @@ -1,4 +1,4 @@ -extends Node +class_name SceneManager extends Node const MainMenu = preload("res://scenes/MainMenu.tscn"); const OverworldScene = preload("res://scenes/Overworld.tscn"); diff --git a/scripts/Singletons/UI.gd b/scripts/Singletons/UI.gd new file mode 100644 index 0000000..4b0bf1e --- /dev/null +++ b/scripts/Singletons/UI.gd @@ -0,0 +1,25 @@ +class_name UISystem extends Control + +enum Layer { + Game, + VN, + Test, + Debug +} + +func addSubscene(subscene:Control, layer:Layer) -> void: + subscene.originalParent.remove_child.call_deferred(subscene) + + match layer: + Layer.Game: + $LayerGame.add_child.call_deferred(subscene) + Layer.Debug: + $LayerDebug.add_child.call_deferred(subscene) + Layer.VN: + $LayerVN.add_child.call_deferred(subscene) + _: + push_error("Invalid layer: " + str(layer)) + return + +func removeSubscene(subscene:Control) -> void: + subscene.get_parent().remove_child(subscene) diff --git a/scripts/Singletons/UI.gd.uid b/scripts/Singletons/UI.gd.uid new file mode 100644 index 0000000..50f5b6a --- /dev/null +++ b/scripts/Singletons/UI.gd.uid @@ -0,0 +1 @@ +uid://dahhuhiu8u88b diff --git a/scripts/Singletons/VN.gd b/scripts/Singletons/VN.gd index bfe3f27..c4aba40 100644 --- a/scripts/Singletons/VN.gd +++ b/scripts/Singletons/VN.gd @@ -1,5 +1,10 @@ class_name VNSystem extends Node const VNTextbox = preload("res://scripts/UI/VNTextbox.gd") +var vnTextbox:VNTextbox = null + +func _ready() -> void: + vnTextbox = $SubsceneUI/VNTextbox + func getTextbox() -> VNTextbox: - return $UI/VNTextbox; + return vnTextbox diff --git a/scripts/UI/SubsceneUI.gd b/scripts/UI/SubsceneUI.gd new file mode 100644 index 0000000..8dbbe82 --- /dev/null +++ b/scripts/UI/SubsceneUI.gd @@ -0,0 +1,15 @@ +class_name SubsceneUI extends Control + +@export var layer:UISystem.Layer = UISystem.Layer.Game; +var originalParent:Node = null + +func _ready() -> void: + originalParent = self.get_parent() + originalParent.tree_exiting.connect(onParentExiting) + UI.addSubscene(self, layer) + +func onParentExiting() -> void: + if originalParent: + originalParent.tree_exiting.disconnect(onParentExiting) + UI.removeSubscene(self) + originalParent = null diff --git a/scripts/UI/SubsceneUI.gd.uid b/scripts/UI/SubsceneUI.gd.uid new file mode 100644 index 0000000..0452497 --- /dev/null +++ b/scripts/UI/SubsceneUI.gd.uid @@ -0,0 +1 @@ +uid://x3cc7wsnn0xd