Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b129ed050 | |||
| ace7575026 |
@@ -0,0 +1,20 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cqcs80xsgygeb"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://2q1n6g2kj5er" path="res://prefabs/UI/Quest/QuestLog.tscn" id="1_7u5et"]
|
||||||
|
|
||||||
|
[node name="Book" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="QuestLog" parent="." instance=ExtResource("1_7u5et")]
|
||||||
|
layout_mode = 1
|
||||||
|
offset_left = 247.0
|
||||||
|
offset_top = 72.0
|
||||||
|
offset_right = -205.0
|
||||||
|
offset_bottom = -76.0
|
||||||
|
grow_horizontal = 1
|
||||||
|
grow_vertical = 1
|
||||||
@@ -1,20 +1,21 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://cgjc4wurbgimy"]
|
[gd_scene load_steps=8 format=3 uid="uid://cgjc4wurbgimy"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://hg7jay2kt441" path="res://scripts/CSharp/Common/Inventory/InventoryUi.cs" id="1_6wusm"]
|
[ext_resource type="Script" uid="uid://hg7jay2kt441" path="res://scripts/CSharp/Common/Inventory/InventoryUi.cs" id="1_6wusm"]
|
||||||
[ext_resource type="Texture2D" uid="uid://3ln8aleyxgp1" path="res://art/ui/UI/UI_bag_export_01.png" id="3_vvo7l"]
|
[ext_resource type="Texture2D" uid="uid://3ln8aleyxgp1" path="res://art/ui/UI/UI_bag_export_01.png" id="3_vvo7l"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dcidjcsqk12p1" path="res://art/ui/UI/UI_bag_export_02.png" id="4_df8i8"]
|
[ext_resource type="Texture2D" uid="uid://dcidjcsqk12p1" path="res://art/ui/UI/UI_bag_export_02.png" id="4_df8i8"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c7wqla0mbu3np" path="res://art/ui/babushka_ui_tmp_inventory_select.png" id="4_tiss4"]
|
[ext_resource type="Texture2D" uid="uid://c7wqla0mbu3np" path="res://art/ui/babushka_ui_tmp_inventory_select.png" id="4_tiss4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c0kmdjeqkqrwv" path="res://prefabs/UI/Inventory/Slot.tscn" id="5_u7kje"]
|
[ext_resource type="PackedScene" uid="uid://c0kmdjeqkqrwv" path="res://prefabs/UI/Inventory/Slot.tscn" id="5_u7kje"]
|
||||||
[ext_resource type="Script" uid="uid://cvkw4qd2hxksi" path="res://scripts/GdScript/dialogic_toggle.gd" id="6_n5apg"]
|
[ext_resource type="Script" uid="uid://7wwid23tc8as" path="res://scripts/CSharp/Common/Quest/QuestMessagePopup.cs" id="6_n5apg"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_tiss4"]
|
||||||
|
font_size = 22
|
||||||
|
font_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="CanvasLayer" type="CanvasLayer"]
|
[node name="CanvasLayer" type="CanvasLayer"]
|
||||||
layer = 90
|
layer = 90
|
||||||
follow_viewport_enabled = true
|
|
||||||
|
|
||||||
[node name="DialogicToggle" type="Node2D" parent="." node_paths=PackedStringArray("itemToToggle")]
|
[node name="DialogicToggle" type="Node2D" parent="."]
|
||||||
scale = Vector2(0.7, 0.7)
|
scale = Vector2(0.7, 0.7)
|
||||||
script = ExtResource("6_n5apg")
|
|
||||||
itemToToggle = NodePath("../Inventory")
|
|
||||||
|
|
||||||
[node name="Inventory" type="Control" parent="."]
|
[node name="Inventory" type="Control" parent="."]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
@@ -23,19 +24,19 @@ anchor_right = 1.0
|
|||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
scale = Vector2(0.7, 0.7)
|
|
||||||
script = ExtResource("1_6wusm")
|
script = ExtResource("1_6wusm")
|
||||||
metadata/_edit_use_anchors_ = true
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
[node name="SlotsContainer" type="Control" parent="Inventory"]
|
[node name="SlotsContainer" type="Control" parent="Inventory"]
|
||||||
custom_minimum_size = Vector2(500, 0)
|
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 13
|
anchors_preset = 7
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 0
|
||||||
|
scale = Vector2(0.7, 0.7)
|
||||||
|
|
||||||
[node name="SlotSelectContainer" type="Control" parent="Inventory/SlotsContainer"]
|
[node name="SlotSelectContainer" type="Control" parent="Inventory/SlotsContainer"]
|
||||||
custom_minimum_size = Vector2(900, 100)
|
custom_minimum_size = Vector2(900, 100)
|
||||||
@@ -371,3 +372,56 @@ offset_left = 703.0
|
|||||||
offset_top = 512.0
|
offset_top = 512.0
|
||||||
offset_right = 803.0
|
offset_right = 803.0
|
||||||
offset_bottom = 612.0
|
offset_bottom = 612.0
|
||||||
|
|
||||||
|
[node name="Messages" 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="MessageContainer" type="Control" parent="Messages"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="PopUpPostIt" type="Control" parent="Messages/MessageContainer"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 103.0
|
||||||
|
offset_top = 32.0
|
||||||
|
offset_right = 303.0
|
||||||
|
offset_bottom = 232.0
|
||||||
|
grow_vertical = 0
|
||||||
|
script = ExtResource("6_n5apg")
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="Messages/MessageContainer/PopUpPostIt"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(1, 1, 0.447059, 1)
|
||||||
|
|
||||||
|
[node name="Text" type="Label" parent="Messages/MessageContainer/PopUpPostIt"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 10.0
|
||||||
|
offset_right = -10.0
|
||||||
|
offset_bottom = -10.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Switch to Unity"
|
||||||
|
label_settings = SubResource("LabelSettings_tiss4")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
autowrap_mode = 2
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://1iqqwh7d6xoh"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dwhee40ksubke" path="res://scripts/CSharp/Common/Quest/QuestListItemUi.cs" id="1_svwef"]
|
||||||
|
|
||||||
|
[node name="QuestListItem" type="Control"]
|
||||||
|
custom_minimum_size = Vector2(0, 30)
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_svwef")
|
||||||
|
|
||||||
|
[node name="TitleButton" type="Button" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Hello world"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="TitleButton" to="." method="ClickedTitleButton"]
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://2q1n6g2kj5er"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://c7ilqe2fmjyvx" path="res://scripts/CSharp/Common/Quest/QuestListUi.cs" id="1_17sli"]
|
||||||
|
[ext_resource type="Script" uid="uid://o1qpo0wdqlw3" path="res://scripts/CSharp/Common/Quest/QuestLog.cs" id="1_vc33n"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://1iqqwh7d6xoh" path="res://prefabs/UI/Quest/QuestListItem.tscn" id="2_fswdj"]
|
||||||
|
[ext_resource type="Script" uid="uid://b8mywolvj2yq7" path="res://scripts/CSharp/Common/Quest/QuestDescriptionUi.cs" id="4_1vy15"]
|
||||||
|
|
||||||
|
[node name="QuestLog" type="Control"]
|
||||||
|
custom_minimum_size = Vector2(700, 500)
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_right = -452.0
|
||||||
|
offset_bottom = -148.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_vc33n")
|
||||||
|
|
||||||
|
[node name="LeftPage" type="Control" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 9
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_right = 350.0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="LeftPage"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_17sli")
|
||||||
|
_questListItemPrefab = ExtResource("2_fswdj")
|
||||||
|
|
||||||
|
[node name="RightPage" type="Control" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 11
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -350.0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Description" type="RichTextLabel" parent="RightPage"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("4_1vy15")
|
||||||
|
|
||||||
|
[connection signal="DetailQuestChanged" from="." to="RightPage/Description" method="UpdateText"]
|
||||||
@@ -21,6 +21,7 @@ config/icon="uid://b2smanpdo1y5e"
|
|||||||
|
|
||||||
Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd"
|
Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd"
|
||||||
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
|
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
|
||||||
|
QuestManager="*res://scripts/CSharp/Common/Quest/QuestManager.cs"
|
||||||
|
|
||||||
[dialogic]
|
[dialogic]
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="Resource" script_class="QuestResource" load_steps=2 format=3 uid="uid://0aruj4lm74n6"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://vji5lp4qc8pp" path="res://scripts/CSharp/Common/Quest/QuestResource.cs" id="1_kisdg"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_kisdg")
|
||||||
|
id = "test_01"
|
||||||
|
title = "First Testing Quest"
|
||||||
|
description = "Do the first thing you do to complete this quest"
|
||||||
|
metadata/_custom_type_script = "uid://vji5lp4qc8pp"
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="Resource" script_class="QuestResource" load_steps=2 format=3 uid="uid://be1dmc6d2mxl5"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://vji5lp4qc8pp" path="res://scripts/CSharp/Common/Quest/QuestResource.cs" id="1_t87fj"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_t87fj")
|
||||||
|
id = "test_02"
|
||||||
|
title = "Second Testing Quest"
|
||||||
|
description = "Second my ass. Do what ever. I don't care"
|
||||||
|
metadata/_custom_type_script = "uid://vji5lp4qc8pp"
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="Resource" script_class="QuestResource" load_steps=2 format=3 uid="uid://tmmnsg1bge2"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://vji5lp4qc8pp" path="res://scripts/CSharp/Common/Quest/QuestResource.cs" id="1_y0umc"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_y0umc")
|
||||||
|
id = "test_03"
|
||||||
|
title = "Third Testing Quest"
|
||||||
|
description = "I'd like to apologize for the second quest, he has some bad manners"
|
||||||
|
metadata/_custom_type_script = "uid://vji5lp4qc8pp"
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://dbpsqfedlku4f"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cqcs80xsgygeb" path="res://prefabs/UI/Book/Book.tscn" id="1_bd7dq"]
|
||||||
|
[ext_resource type="Script" uid="uid://cg0oqug38c81n" path="res://scripts/CSharp/Common/Quest/QuestTestingScript.cs" id="2_sv6jn"]
|
||||||
|
[ext_resource type="Resource" uid="uid://0aruj4lm74n6" path="res://resources/quests/test_01.tres" id="3_nhtae"]
|
||||||
|
[ext_resource type="Resource" uid="uid://be1dmc6d2mxl5" path="res://resources/quests/test_02.tres" id="4_kr4yw"]
|
||||||
|
[ext_resource type="Resource" uid="uid://tmmnsg1bge2" path="res://resources/quests/test_03.tres" id="5_4cktu"]
|
||||||
|
|
||||||
|
[node name="BabushkaTestsBook" type="Node"]
|
||||||
|
|
||||||
|
[node name="Book" parent="." instance=ExtResource("1_bd7dq")]
|
||||||
|
|
||||||
|
[node name="QuestTesting" type="Node" parent="."]
|
||||||
|
script = ExtResource("2_sv6jn")
|
||||||
|
_questsToActivate = Array[Object]([ExtResource("3_nhtae"), ExtResource("4_kr4yw"), ExtResource("5_4cktu")])
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://c4ns2ixo8k2ih"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="1_opxcj"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://2q1n6g2kj5er" path="res://prefabs/UI/Quest/QuestLog.tscn" id="2_lj712"]
|
||||||
|
[ext_resource type="Script" uid="uid://cldtt4atgymm5" path="res://scripts/CSharp/Common/Quest/QuestTrigger.cs" id="3_sx4ix"]
|
||||||
|
[ext_resource type="Resource" uid="uid://0aruj4lm74n6" path="res://resources/quests/test_01.tres" id="4_qyyck"]
|
||||||
|
[ext_resource type="Resource" uid="uid://be1dmc6d2mxl5" path="res://resources/quests/test_02.tres" id="5_sokiv"]
|
||||||
|
[ext_resource type="Resource" uid="uid://tmmnsg1bge2" path="res://resources/quests/test_03.tres" id="6_ajsa7"]
|
||||||
|
|
||||||
|
[node name="BabushkaTestsQuests" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="CanvasLayer" parent="." instance=ExtResource("1_opxcj")]
|
||||||
|
|
||||||
|
[node name="CanvasLayer2" type="CanvasLayer" parent="."]
|
||||||
|
layer = 128
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer2"]
|
||||||
|
offset_left = 71.0
|
||||||
|
offset_top = 53.0
|
||||||
|
offset_right = 571.0
|
||||||
|
offset_bottom = 353.0
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer2/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer2/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 1
|
||||||
|
text = "Quest 1"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Active" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Active"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer/Active"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("4_qyyck")
|
||||||
|
toStatus = 1
|
||||||
|
makeCurrent = true
|
||||||
|
|
||||||
|
[node name="Done" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Done"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer/Done"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("4_qyyck")
|
||||||
|
toStatus = 2
|
||||||
|
|
||||||
|
[node name="Cancle" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Cancle"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer/Cancle"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("4_qyyck")
|
||||||
|
toStatus = 3
|
||||||
|
|
||||||
|
[node name="Hide" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Hide
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer/Hide"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("4_qyyck")
|
||||||
|
|
||||||
|
[node name="HBoxContainer2" type="HBoxContainer" parent="CanvasLayer2/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer2/VBoxContainer/HBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 1
|
||||||
|
text = "Quest 2"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Active" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Active"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer2/Active"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("5_sokiv")
|
||||||
|
toStatus = 1
|
||||||
|
|
||||||
|
[node name="Done" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Done"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer2/Done"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("5_sokiv")
|
||||||
|
toStatus = 2
|
||||||
|
|
||||||
|
[node name="Cancle" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Cancle"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer2/Cancle"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("5_sokiv")
|
||||||
|
toStatus = 3
|
||||||
|
|
||||||
|
[node name="Hide" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Hide
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer2/Hide"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("5_sokiv")
|
||||||
|
|
||||||
|
[node name="HBoxContainer3" type="HBoxContainer" parent="CanvasLayer2/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer2/VBoxContainer/HBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 1
|
||||||
|
text = "Quest 3"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Active" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Active"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer3/Active"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("6_ajsa7")
|
||||||
|
toStatus = 1
|
||||||
|
|
||||||
|
[node name="Done" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Done"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer3/Done"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("6_ajsa7")
|
||||||
|
toStatus = 2
|
||||||
|
|
||||||
|
[node name="Cancle" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Cancle"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer3/Cancle"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("6_ajsa7")
|
||||||
|
toStatus = 3
|
||||||
|
|
||||||
|
[node name="Hide" type="Button" parent="CanvasLayer2/VBoxContainer/HBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Hide
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="QuestSetter" type="Node" parent="CanvasLayer2/VBoxContainer/HBoxContainer3/Hide"]
|
||||||
|
script = ExtResource("3_sx4ix")
|
||||||
|
questResource = ExtResource("6_ajsa7")
|
||||||
|
|
||||||
|
[node name="QuestLog" parent="CanvasLayer2" instance=ExtResource("2_lj712")]
|
||||||
|
offset_left = 625.0
|
||||||
|
offset_top = 294.0
|
||||||
|
offset_right = -595.0
|
||||||
|
offset_bottom = -286.0
|
||||||
|
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer/Active" to="CanvasLayer2/VBoxContainer/HBoxContainer/Active/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer/Done" to="CanvasLayer2/VBoxContainer/HBoxContainer/Done/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer/Cancle" to="CanvasLayer2/VBoxContainer/HBoxContainer/Cancle/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer/Hide" to="CanvasLayer2/VBoxContainer/HBoxContainer/Hide/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer2/Active" to="CanvasLayer2/VBoxContainer/HBoxContainer2/Active/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer2/Done" to="CanvasLayer2/VBoxContainer/HBoxContainer2/Done/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer2/Cancle" to="CanvasLayer2/VBoxContainer/HBoxContainer2/Cancle/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer2/Hide" to="CanvasLayer2/VBoxContainer/HBoxContainer2/Hide/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer3/Active" to="CanvasLayer2/VBoxContainer/HBoxContainer3/Active/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer3/Done" to="CanvasLayer2/VBoxContainer/HBoxContainer3/Done/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer3/Cancle" to="CanvasLayer2/VBoxContainer/HBoxContainer3/Cancle/QuestSetter" method="Trigger"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer2/VBoxContainer/HBoxContainer3/Hide" to="CanvasLayer2/VBoxContainer/HBoxContainer3/Hide/QuestSetter" method="Trigger"]
|
||||||
|
|
||||||
|
[editable path="CanvasLayer"]
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class PopUpPostIt : Control
|
||||||
|
{
|
||||||
|
private Label Text => GetNode<Label>("Text");
|
||||||
|
|
||||||
|
private AnimationPlayer Animation => GetNode<AnimationPlayer>("AnimationPlayer");
|
||||||
|
|
||||||
|
QuestManager QM => QuestManager.Instance!;
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
QM.QuestBecomesActive += NewQuestPostIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NewQuestPostIt(QuestResource questResource)
|
||||||
|
{
|
||||||
|
Text.Text = questResource.title;
|
||||||
|
Animation.Play("NewPostit");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://byar6yqrlph6k
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Util;
|
||||||
|
|
||||||
|
public partial class QuestDescriptionUi : RichTextLabel
|
||||||
|
{
|
||||||
|
public void UpdateText(QuestLog questLog)
|
||||||
|
{
|
||||||
|
Text = questLog.currentDetailQuest?.description ?? "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://b8mywolvj2yq7
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Util;
|
||||||
|
using Godot;
|
||||||
|
namespace Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestListItemUi : Control
|
||||||
|
{
|
||||||
|
private Button TitleButton => GetNode<Button>("TitleButton");
|
||||||
|
private QuestResource? _questResource;
|
||||||
|
|
||||||
|
public void UpdateButton(QuestResource questResource)
|
||||||
|
{
|
||||||
|
_questResource = questResource;
|
||||||
|
var questStatus = QuestManager.Instance!.GetQuestStatus(_questResource);
|
||||||
|
var name = questResource.title;
|
||||||
|
|
||||||
|
name += questStatus.status switch
|
||||||
|
{
|
||||||
|
QuestStatus.Status.Done => " \u2713", // Check
|
||||||
|
QuestStatus.Status.Canceled => " \u2715", // X
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
|
||||||
|
ShowName(name);
|
||||||
|
TitleButton.Pressed += ClickedTitleButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowName(string questResourceTitle)
|
||||||
|
{
|
||||||
|
TitleButton.Text = questResourceTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClickedTitleButton()
|
||||||
|
{
|
||||||
|
var questLog = this.FindParentByType<QuestLog>();
|
||||||
|
if (_questResource == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(_questResource), "QuestResource is null");
|
||||||
|
}
|
||||||
|
questLog.currentDetailQuest = _questResource;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dwhee40ksubke
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestListUi : VBoxContainer
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
private PackedScene _questListItemPrefab;
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
UpdateList();
|
||||||
|
QuestManager.Instance!.QuestsChanged += UpdateList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
QuestManager.Instance!.QuestsChanged -= UpdateList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
UpdateList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateList()
|
||||||
|
{
|
||||||
|
// delete children
|
||||||
|
foreach (Node child in GetChildren())
|
||||||
|
{
|
||||||
|
RemoveChild(child);
|
||||||
|
child.QueueFree();
|
||||||
|
}
|
||||||
|
|
||||||
|
// recreate children
|
||||||
|
var activeQuests = QuestManager.Instance.GetVisibleQuests();
|
||||||
|
|
||||||
|
foreach (var questPair in activeQuests)
|
||||||
|
{
|
||||||
|
var questResource = questPair.Key;
|
||||||
|
var questStatus = questPair.Value;
|
||||||
|
|
||||||
|
var questListItem = _questListItemPrefab.Instantiate<QuestListItemUi>();
|
||||||
|
questListItem.UpdateButton(questResource);
|
||||||
|
AddChild(questListItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://c7ilqe2fmjyvx
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#nullable enable
|
||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestLog : Control
|
||||||
|
{
|
||||||
|
[Signal]
|
||||||
|
public delegate void DetailQuestChangedEventHandler(QuestLog questLog);
|
||||||
|
|
||||||
|
public QuestResource? currentDetailQuest
|
||||||
|
{
|
||||||
|
get => QuestManager.Instance!.GetFollowQuest();
|
||||||
|
set
|
||||||
|
{
|
||||||
|
QuestManager.Instance!.SetFollowQuest(value); // TODO: fix setup
|
||||||
|
EmitSignalDetailQuestChanged(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
QuestManager.Instance!.QuestsChanged += () => EmitSignalDetailQuestChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//private QuestResource? _currentDetailQuestBacking;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://o1qpo0wdqlw3
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
using QuestPair = KeyValuePair<QuestResource, QuestStatus>;
|
||||||
|
public partial class QuestManager : Node
|
||||||
|
{
|
||||||
|
public static QuestManager? Instance { get; private set; }
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void QuestBecomesActiveEventHandler(QuestResource questResource);
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void QuestsChangedEventHandler();
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Godot.Collections.Dictionary<QuestResource, QuestStatus> _questStatus = new();
|
||||||
|
|
||||||
|
private QuestResource? _followQuest;
|
||||||
|
|
||||||
|
|
||||||
|
public void ChangeQuestStatus(QuestResource questResource, QuestStatus.Status newStatus)
|
||||||
|
{
|
||||||
|
if (!_questStatus.TryGetValue(questResource, out var value))
|
||||||
|
{
|
||||||
|
value = new QuestStatus();
|
||||||
|
_questStatus.Add(questResource, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
value.status = newStatus;
|
||||||
|
|
||||||
|
EmitSignalQuestsChanged();
|
||||||
|
|
||||||
|
if (newStatus == QuestStatus.Status.Active)
|
||||||
|
{
|
||||||
|
EmitSignalQuestBecomesActive(questResource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<QuestPair> GetVisibleQuests()
|
||||||
|
{
|
||||||
|
return _questStatus.Where(qs => qs.Value.status != QuestStatus.Status.Hidden);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<QuestPair> GetActiveQuests()
|
||||||
|
{
|
||||||
|
return _questStatus.Where(qs => qs.Value.status == QuestStatus.Status.Active);
|
||||||
|
}
|
||||||
|
public QuestStatus GetQuestStatus(QuestResource questResource)
|
||||||
|
{
|
||||||
|
if (_questStatus.TryGetValue(questResource, out var status))
|
||||||
|
return status;
|
||||||
|
|
||||||
|
status = new QuestStatus();
|
||||||
|
_questStatus.Add(questResource, status);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestResource? GetFollowQuest()
|
||||||
|
{
|
||||||
|
return _followQuest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetFollowQuest(QuestResource? questResource)
|
||||||
|
{
|
||||||
|
_followQuest = questResource;
|
||||||
|
EmitSignalQuestsChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dl2uhq12p3qks
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using System.Net.Mime;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestMessagePopup : Control
|
||||||
|
{
|
||||||
|
|
||||||
|
private Label Text => GetNode<Label>("Text");
|
||||||
|
|
||||||
|
private QuestResource? _currentlyShown;
|
||||||
|
|
||||||
|
private Tween? _activeTween = null;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
private Vector2 _showPosition;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
private Vector2 _hidePosition;
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
QuestManager.Instance!.QuestsChanged += NewActiveQuest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
QuestManager.Instance!.QuestsChanged -= NewActiveQuest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NewActiveQuest()
|
||||||
|
{
|
||||||
|
GD.Print("NewActiveQuest");
|
||||||
|
|
||||||
|
var shownQuest = QuestManager.Instance!.GetFollowQuest();
|
||||||
|
if (_currentlyShown == shownQuest)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_activeTween != null)
|
||||||
|
{
|
||||||
|
_activeTween.Kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shownQuest == null)
|
||||||
|
{
|
||||||
|
HideAnimate();
|
||||||
|
_currentlyShown = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_currentlyShown == null)
|
||||||
|
{
|
||||||
|
Text.Text = shownQuest.title;
|
||||||
|
ShowAnimate();
|
||||||
|
_currentlyShown = shownQuest;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// else (_currentlyShown != null)
|
||||||
|
|
||||||
|
_currentlyShown = shownQuest;
|
||||||
|
HideAnimate(() =>
|
||||||
|
{
|
||||||
|
Text.Text = shownQuest.title;
|
||||||
|
ShowAnimate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideAnimate(Action? then = null)
|
||||||
|
{
|
||||||
|
_activeTween = GetTree().CreateTween();
|
||||||
|
_activeTween.TweenProperty(this, "position", _hidePosition, 0.4)
|
||||||
|
.SetTrans(Tween.TransitionType.Cubic)
|
||||||
|
.SetEase(Tween.EaseType.Out);
|
||||||
|
if (then != null)
|
||||||
|
_activeTween.Finished += then;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowAnimate(Action? then = null)
|
||||||
|
{
|
||||||
|
_activeTween = GetTree().CreateTween();
|
||||||
|
_activeTween.TweenProperty(this, "position", _showPosition, 0.4)
|
||||||
|
.SetTrans(Tween.TransitionType.Cubic)
|
||||||
|
.SetEase(Tween.EaseType.Out);
|
||||||
|
if (then != null)
|
||||||
|
_activeTween.Finished += then;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://7wwid23tc8as
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Godot;
|
||||||
|
namespace Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class QuestResource : Resource
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public string id = "";
|
||||||
|
[Export]
|
||||||
|
public string title = "";
|
||||||
|
[Export(PropertyHint.MultilineText)]
|
||||||
|
public string description = "";
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://vji5lp4qc8pp
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestStatus : GodotObject
|
||||||
|
{
|
||||||
|
public enum Status
|
||||||
|
{
|
||||||
|
Hidden,
|
||||||
|
Active,
|
||||||
|
Done,
|
||||||
|
Canceled,
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status status = Status.Hidden;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bpqgcchuubfiy
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
using Godot.Collections;
|
||||||
|
|
||||||
|
public partial class QuestTestingScript : Node
|
||||||
|
{
|
||||||
|
[Export(PropertyHint.ArrayType)]
|
||||||
|
private Array<QuestResource> _questsToActivate;
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
foreach (var questResource in _questsToActivate)
|
||||||
|
{
|
||||||
|
QuestManager.Instance.ChangeQuestStatus(questResource, QuestStatus.Status.Active);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cg0oqug38c81n
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestTrigger : Node
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public QuestResource? questResource;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public QuestStatus.Status toStatus;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
private bool makeCurrent = false;
|
||||||
|
|
||||||
|
public void Trigger()
|
||||||
|
{
|
||||||
|
GD.Print("trigger");
|
||||||
|
|
||||||
|
if(questResource== null)
|
||||||
|
throw new Exception("QuestResource is not set on QuestTrigger node.");
|
||||||
|
|
||||||
|
if(QuestManager.Instance == null)
|
||||||
|
throw new Exception("QuestManager instance is not available. Make sure it is initialized before calling Trigger.");
|
||||||
|
|
||||||
|
QuestManager.Instance.ChangeQuestStatus(questResource, toStatus);
|
||||||
|
|
||||||
|
if (makeCurrent)
|
||||||
|
{
|
||||||
|
QuestManager.Instance.SetFollowQuest(questResource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cldtt4atgymm5
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using Godot;
|
||||||
|
namespace Babushka.scripts.CSharp.Common.Util;
|
||||||
|
|
||||||
|
public static class NodeExtension
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Searches for a parent node of the specified type.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type of the parent node to search for. The search is successful, when <code>searchedNode is T</code></typeparam>
|
||||||
|
/// <param name="self">The node from which to start the search.</param>
|
||||||
|
/// <returns>The parent node of type T if found, otherwise throws an exception.</returns>
|
||||||
|
public static T FindParentByType<T>(this Node self)
|
||||||
|
{
|
||||||
|
var parent = self.GetParent();
|
||||||
|
while (parent != null)
|
||||||
|
{
|
||||||
|
if (parent is T tParent)
|
||||||
|
{
|
||||||
|
return tParent;
|
||||||
|
}
|
||||||
|
parent = parent.GetParent();
|
||||||
|
}
|
||||||
|
throw new Exception($"Parent of type {typeof(T)} not found for node {self.Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bwisbh2f2ci6l
|
||||||
Reference in New Issue
Block a user