First commit for private source control. Older commits available on Github.

This commit is contained in:
2026-03-26 12:52:52 +00:00
parent a04c602626
commit 2d449c4a17
2176 changed files with 408185 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 58a00e94414846c6b914db0fbc38837f
timeCreated: 1773682720

View File

@@ -0,0 +1,87 @@
using System.Collections.Generic;
using System.Linq;
using BriarQueen.Data.Identifiers;
using UnityEngine;
namespace BriarQueen.Framework.Managers.Player.Data.Codex
{
public class Codex
{
private readonly List<CodexEntrySo> _entries = new();
public IReadOnlyList<CodexEntrySo> Entries => _entries;
public void AddEntry(CodexEntrySo entry)
{
if (entry == null)
return;
if (_entries.Any(x => x.UniqueID == entry.UniqueID))
return;
Debug.Log($"Adding codex entry {entry.UniqueID}");
_entries.Add(entry);
}
public void RemoveEntry(CodexEntrySo entry)
{
if (entry == null)
return;
if (_entries.All(x => x.UniqueID != entry.UniqueID))
return;
_entries.Remove(entry);
}
public void RemoveEntry(string uniqueID)
{
var entry = _entries.FirstOrDefault(x => x.UniqueID == uniqueID);
if (entry)
_entries.Remove(entry);
}
public bool HasEntry(CodexEntrySo entry)
{
if (entry == null)
return false;
return _entries.Any(x => x.UniqueID == entry.UniqueID);
}
public bool HasEntry(string uniqueID)
{
if (string.IsNullOrWhiteSpace(uniqueID))
return false;
return _entries.Any(x => x.UniqueID == uniqueID);
}
public IEnumerable<CodexEntrySo> GetEntriesByType(CodexType codexType)
{
return _entries.Where(x => x.EntryType == codexType);
}
public IEnumerable<CodexEntrySo> GetBookEntries()
{
return GetEntriesByType(CodexType.BookEntry);
}
public IEnumerable<CodexEntrySo> GetPuzzleClues()
{
return GetEntriesByType(CodexType.PuzzleClue);
}
public IEnumerable<CodexEntrySo> GetPhotoEntries()
{
return GetEntriesByType(CodexType.Photo);
}
public void ClearEntries()
{
_entries.Clear();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 15993ce7dcfd437186874d9d0822ad2d
timeCreated: 1773682720

View File

@@ -0,0 +1,40 @@
using BriarQueen.Framework.Managers.Levels.Data;
using BriarQueen.Framework.Managers.UI;
using Cysharp.Threading.Tasks;
using UnityEngine;
namespace BriarQueen.Framework.Managers.Player.Data.Codex
{
public class CodexTrigger : BaseItem, ICodexTrigger
{
[Header("Codex")]
[SerializeField]
private CodexEntrySo _codexEntry;
[SerializeField]
private bool _removeTrigger;
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
public override string InteractableName =>
!string.IsNullOrWhiteSpace(InteractableTooltip) ? InteractableTooltip : _codexEntry.Title;
public GameObject TriggerObject => GameObject;
public CodexEntrySo Entry => _codexEntry;
public bool RemoveTrigger => _removeTrigger;
public override async UniTask OnInteract(ItemDataSo item = null)
{
if (!CheckEmptyHands())
return;
PlayerManager.UnlockCodexEntry(_codexEntry);
if (_removeTrigger)
{
await Remove();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b26357202d94390a9d04c7cd3194b40
timeCreated: 1773861326

View File

@@ -0,0 +1,13 @@
using Cysharp.Threading.Tasks;
using UnityEngine;
namespace BriarQueen.Framework.Managers.Player.Data.Codex
{
public interface ICodexTrigger
{
GameObject TriggerObject { get; }
CodexEntrySo Entry { get; }
bool RemoveTrigger { get; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2f81e1754251482a9e9bc183c5e1bd5b
timeCreated: 1773868877

View File

@@ -0,0 +1,109 @@
using BriarQueen.Data.Identifiers;
using NaughtyAttributes;
using UnityEngine;
namespace BriarQueen.Framework.Managers.Player.Data
{
[CreateAssetMenu(menuName = "Briar Queen/Codex/New Codex Entry", fileName = "New Codex Entry")]
public class CodexEntrySo : ScriptableObject
{
[Header("Codex Type")]
[SerializeField]
private CodexType _codexType;
[Header("Codex ID")]
[SerializeField]
[ShowIf(nameof(IsBookEntry))]
private BookEntryID _bookEntryID;
[SerializeField]
[ShowIf(nameof(IsPuzzleClue))]
private ClueEntryID _clueEntryID;
[SerializeField]
[ShowIf(nameof(IsPhoto))]
private PhotoEntryID _photoEntryID;
[Header("Display")]
[SerializeField]
private string _title;
[SerializeField]
[ShowIf(EConditionOperator.Or, nameof(IsPhoto), nameof(_isPhotoOverride))]
private Sprite _displayImage;
[TextArea(6, 20)]
[SerializeField]
[ShowIf(EConditionOperator.Or, nameof(IsBookEntry), nameof(_bodyTextOverride))]
private string _bodyText;
[SerializeField]
[ShowIf(EConditionOperator.Or, nameof(IsPhoto), nameof(_isPhotoOverride))]
private string _photoDescription;
[SerializeField]
[ShowIf(EConditionOperator.Or, nameof(IsPhoto), nameof(_isPhotoOverride))]
private string _polaroidWriting;
[Header("Behaviour")]
[SerializeField]
private bool _startsUnlocked;
[SerializeField]
private bool _hiddenUntilUnlocked = true;
[SerializeField]
private bool _isPhotoOverride;
[SerializeField]
private bool _bodyTextOverride;
[SerializeField]
private Location _location;
public CodexType EntryType => _codexType;
public Location Location => _location;
public bool IsBookEntry => _codexType == CodexType.BookEntry;
public bool IsPuzzleClue => _codexType == CodexType.PuzzleClue;
public bool IsPhoto => _codexType == CodexType.Photo;
public BookEntryID BookEntryID => _bookEntryID;
public ClueEntryID ClueEntryID => _clueEntryID;
public PhotoEntryID PhotoEntryID => _photoEntryID;
public string Title => _title;
public Sprite DisplayImage => _displayImage;
public string BodyText => _bodyText;
public string PhotoDescription => _photoDescription;
public string PolaroidWriting => _polaroidWriting;
public bool StartsUnlocked => _startsUnlocked;
public bool HiddenUntilUnlocked => _hiddenUntilUnlocked;
public bool IsPhotoOverride => _isPhotoOverride;
public bool IsBodyTextOverride => _bodyTextOverride;
public string UniqueID
{
get
{
return _codexType switch
{
CodexType.BookEntry when _bookEntryID != BookEntryID.None =>
CodexEntryIDs.Get(_bookEntryID),
CodexType.PuzzleClue when _clueEntryID != ClueEntryID.None =>
CodexEntryIDs.Get(_clueEntryID),
CodexType.Photo when _photoEntryID != PhotoEntryID.None =>
CodexEntryIDs.Get(_photoEntryID),
_ => string.Empty
};
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5bdd4c819cc240c1b89ef5a0e33145ef
timeCreated: 1773682436

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a795285ea8e94689952d456af9369c92
timeCreated: 1769700038

View File

@@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace BriarQueen.Framework.Managers.Player.Data.Inventory
{
public class Backpack
{
private readonly List<ItemDataSo> _items = new();
public IReadOnlyList<ItemDataSo> Items => _items;
public void AddItem(ItemDataSo item)
{
if (_items.Any(x => x.UniqueID == item.UniqueID))
return;
Debug.Log($"Adding item {item.UniqueID}");
_items.Add(item);
}
public void RemoveItem(ItemDataSo item)
{
if (_items.All(x => x.UniqueID != item.UniqueID)) return;
_items.Remove(item);
}
public void RemoveItem(string uniqueID)
{
var item = _items.FirstOrDefault(x => x.UniqueID == uniqueID);
if (item) _items.Remove(item);
}
public void ClearItems()
{
_items.Clear();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 855a4eee12334e29938a4b6c564aa157
timeCreated: 1769701500

View File

@@ -0,0 +1,82 @@
using BriarQueen.Data.Identifiers;
using BriarQueen.Framework.Managers.Interaction.Data;
using NaughtyAttributes;
using UnityEngine;
namespace BriarQueen.Framework.Managers.Player.Data
{
[CreateAssetMenu(menuName = "Briar Queen/Items/New Item Data", fileName = "New Item Data")]
public class ItemDataSo : ScriptableObject
{
public enum ItemIdType
{
None = 0,
Pickup = 1,
Environment = 2,
PuzzleSlot = 3
}
[Header("Item Type")]
[SerializeField]
private ItemIdType _idType;
[Header("Item Details")]
[Tooltip("Pickup key used for inventory items.")]
[SerializeField]
[ShowIf(nameof(IsPickup))]
private ItemKey _itemKey;
[Tooltip("Environment key used for world interactables.")]
[SerializeField]
[ShowIf(nameof(IsEnvironment))]
private EnvironmentKey _environmentKey;
[Tooltip("Puzzle slot key used for puzzle slot interactables.")]
[SerializeField]
[ShowIf(nameof(IsPuzzleSlot))]
private PuzzleSlotKey _puzzleSlotKey;
[SerializeField]
private Sprite _icon;
[SerializeField]
private string _itemName;
[Header("Inventory Interaction (serialized inline, no extra SO assets)")]
[SerializeReference]
private BaseInteraction _interaction = new NoOpItemInteraction();
public Sprite Icon => _icon;
public string ItemName => _itemName;
public BaseInteraction Interaction => _interaction;
public bool IsPickup => _idType == ItemIdType.Pickup;
public bool IsEnvironment => _idType == ItemIdType.Environment;
public bool IsPuzzleSlot => _idType == ItemIdType.PuzzleSlot;
public ItemIdType IdType => _idType;
public ItemKey ItemKey => _itemKey;
public EnvironmentKey EnvironmentKey => _environmentKey;
public PuzzleSlotKey PuzzleSlotKey => _puzzleSlotKey;
public string UniqueID
{
get
{
return _idType switch
{
ItemIdType.Pickup when _itemKey != ItemKey.None =>
ItemIDs.Get(_itemKey),
ItemIdType.Environment when _environmentKey != EnvironmentKey.None =>
ItemIDs.Get(_environmentKey),
ItemIdType.PuzzleSlot when _puzzleSlotKey != PuzzleSlotKey.None =>
ItemIDs.Get(_puzzleSlotKey),
_ => string.Empty
};
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 668f0266fce84811b2efce4a48adff09
timeCreated: 1769700109

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cfd9e5206a504db9a0aa92f0e934776f
timeCreated: 1773954968

View File

@@ -0,0 +1,201 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BriarQueen.Data.Identifiers;
using BriarQueen.Framework.Coordinators.Events;
using BriarQueen.Framework.Events.Gameplay;
using BriarQueen.Framework.Events.UI;
using BriarQueen.Framework.Managers.UI;
using BriarQueen.Framework.Services.Tutorials;
using UnityEngine;
namespace BriarQueen.Framework.Managers.Player.Data.Tools
{
public class Toolbelt : IDisposable
{
private readonly Dictionary<ToolID, bool> _unlockedTools = new();
private readonly EventCoordinator _eventCoordinator;
private readonly TutorialService _tutorialService;
public IReadOnlyDictionary<ToolID, bool> UnlockedTools => _unlockedTools;
public ToolID CurrentTool { get; private set; } = ToolID.None;
public Toolbelt(EventCoordinator eventCoordinator, TutorialService tutorialService)
{
_eventCoordinator = eventCoordinator;
_tutorialService = tutorialService;
}
public void Initialize()
{
_eventCoordinator.Subscribe<OnNextToolChangedEvent>(OnNextToolChanged);
_eventCoordinator.Subscribe<OnPreviousToolChangedEvent>(OnPreviousToolChanged);
}
public void Dispose()
{
_eventCoordinator.Unsubscribe<OnNextToolChangedEvent>(OnNextToolChanged);
_eventCoordinator.Unsubscribe<OnPreviousToolChangedEvent>(OnPreviousToolChanged);
}
public void Unlock(ToolID id)
{
if (id == ToolID.None)
return;
_unlockedTools[id] = true;
Debug.Log($"{this} Tool {id} has been unlocked");
}
public void Lock(ToolID id)
{
if (id == ToolID.None)
return;
if (_unlockedTools.ContainsKey(id))
_unlockedTools[id] = false;
if (CurrentTool == id)
SelectNextTool();
}
public bool HasAccess(ToolID id)
{
if (id == ToolID.None)
return true;
return _unlockedTools.TryGetValue(id, out var unlocked) && unlocked;
}
public bool IsKnown(ToolID id)
{
if (id == ToolID.None)
return true;
return _unlockedTools.ContainsKey(id);
}
public void SelectTool(ToolID id)
{
if (!HasAccess(id))
return;
SetCurrentTool(id, 0);
}
public void SelectEmptyHands()
{
SetCurrentTool(ToolID.None, 0);
}
public void SelectNextTool()
{
Debug.Log($"SelectNextTool: {CurrentTool}");
CycleTool(1);
}
public void SelectPreviousTool()
{
CycleTool(-1);
}
private void OnNextToolChanged(OnNextToolChangedEvent e)
{
SelectNextTool();
}
private void OnPreviousToolChanged(OnPreviousToolChangedEvent e)
{
SelectPreviousTool();
}
private void CycleTool(int direction)
{
var selectableTools = GetSelectableTools();
Debug.Log($"CycleTool: {selectableTools.Count}");
foreach (var selectableTool in selectableTools)
{
Debug.Log($"CycleTool: {selectableTool}");
}
if (selectableTools.Count == 0)
{
SetCurrentTool(ToolID.None, direction);
return;
}
int currentIndex = selectableTools.IndexOf(CurrentTool);
if (currentIndex < 0)
{
int fallbackIndex = direction > 0 ? 0 : selectableTools.Count - 1;
SetCurrentTool(selectableTools[fallbackIndex], direction);
return;
}
int nextIndex = currentIndex + direction;
if (nextIndex < 0)
nextIndex = selectableTools.Count - 1;
else if (nextIndex >= selectableTools.Count)
nextIndex = 0;
Debug.Log($"CycleTool: Setting tool to {selectableTools[nextIndex]}");
SetCurrentTool(selectableTools[nextIndex], direction);
}
private void CheckToolsCycling()
{
_tutorialService.DisplayTutorial(TutorialPopupID.ToolCycling);
}
private void SetCurrentTool(ToolID newTool, int direction)
{
if (CurrentTool == newTool)
return;
CurrentTool = newTool;
CheckToolsCycling();
_eventCoordinator.Publish(new SelectedToolChangedEvent(CurrentTool, direction));
if (newTool == ToolID.None)
{
_eventCoordinator.Publish(
new OverrideCursorStyleChangeEvent(UICursorService.CursorStyle.Default));
return;
}
if (Enum.TryParse(newTool.ToString(), out UICursorService.CursorStyle style))
{
_eventCoordinator.Publish(new OverrideCursorStyleChangeEvent(style));
}
else
{
_eventCoordinator.Publish(
new OverrideCursorStyleChangeEvent(UICursorService.CursorStyle.Default));
}
}
private List<ToolID> GetSelectableTools()
{
var tools = _unlockedTools
.Where(x => x.Value && x.Key != ToolID.None)
.Select(x => x.Key)
.OrderBy(x => (int)x)
.ToList();
Debug.Log($"{_unlockedTools.Count} tools have been unlocked");
tools.Insert(0, ToolID.None);
Debug.Log($"[Get Selectable Tools: {tools.Count}]");
return tools;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 565885be67c447bbbb3a64e39ae1f734
timeCreated: 1773954972