parent
ba512508f8
commit
01daddee3b
@ -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
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
[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
|
||||||
|
|
||||||
|
[connection signal="pressed" from="TitleButton" to="." method="ClickedTitleButton"]
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
[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
|
||||||
|
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
|
||||||
|
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"]
|
||||||
@ -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,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 @@
|
|||||||
|
uid://dwhee40ksubke
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestListUi : VBoxContainer
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
private PackedScene _questListItemPrefab;
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
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.GetActiveQuests();
|
||||||
|
|
||||||
|
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,21 @@
|
|||||||
|
#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 => _currentDetailQuestBacking;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentDetailQuestBacking = value;
|
||||||
|
EmitSignalDetailQuestChanged(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private QuestResource? _currentDetailQuestBacking;
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://o1qpo0wdqlw3
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
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; }
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Godot.Collections.Dictionary<QuestResource, QuestStatus> _questStatus = new();
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://dl2uhq12p3qks
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://vji5lp4qc8pp
|
||||||
@ -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,17 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Babushka.scripts.CSharp.Common.Quest;
|
||||||
|
|
||||||
|
public partial class QuestTrigger : Node
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public QuestResource questResource;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public QuestStatus.Status toStatus;
|
||||||
|
|
||||||
|
public void Trigger()
|
||||||
|
{
|
||||||
|
QuestManager.Instance.ChangeQuestStatus(questResource, toStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://cldtt4atgymm5
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://bwisbh2f2ci6l
|
||||||
Loading…
Reference in new issue