Laxley Grandfather Clock puzzle artwork done.
This commit is contained in:
@@ -2,5 +2,5 @@ using BriarQueen.Framework.Events.System;
|
||||
|
||||
namespace BriarQueen.Framework.Events.Progression
|
||||
{
|
||||
public record RequestHintEvent : IEvent;
|
||||
public abstract record RequestHintEvent : IEvent;
|
||||
}
|
||||
@@ -11,5 +11,5 @@ namespace BriarQueen.Framework.Events.Progression
|
||||
/// By default stages are monotonic (only increase).
|
||||
/// Set Force=true to allow decreasing (e.g., reset/override).
|
||||
/// </summary>
|
||||
public record UpdateHintProgressEvent(string LevelID, int Stage, bool Force = false) : IEvent;
|
||||
public abstract record UpdateHintProgressEvent(string LevelID, int Stage, bool Force = false) : IEvent;
|
||||
}
|
||||
@@ -1,7 +1,22 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using BriarQueen.Data.Attributes;
|
||||
|
||||
namespace BriarQueen.Framework.Extensions
|
||||
{
|
||||
public class EnumExtensions
|
||||
public static class EnumExtensions
|
||||
{
|
||||
|
||||
public static string GetDisplayName(this Enum value)
|
||||
{
|
||||
var type = value.GetType();
|
||||
var field = type.GetField(value.ToString());
|
||||
|
||||
if (field == null)
|
||||
return value.ToString();
|
||||
|
||||
var attribute = field.GetCustomAttribute<DisplayNameAttribute>();
|
||||
|
||||
return attribute != null ? attribute.Name : value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,99 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace BriarQueen.Framework.Extensions
|
||||
{
|
||||
public class StringExtensions
|
||||
public static class StringExtensions
|
||||
{
|
||||
|
||||
private static readonly string[] Prefixes =
|
||||
{
|
||||
"ENV_",
|
||||
"PUZ_",
|
||||
"SUB_",
|
||||
"UI_",
|
||||
"SFX_",
|
||||
"BGM_",
|
||||
"BOOK_",
|
||||
"CLUE_",
|
||||
"PHOTO_"
|
||||
};
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> Overrides =
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{ "Pumphouse", "Pump House" },
|
||||
{ "Lockbox", "Lockbox" },
|
||||
{ "Codex", "Codex" },
|
||||
{ "UIFX", "UI FX" },
|
||||
{ "SFX", "SFX" },
|
||||
{ "BGM", "BGM" }
|
||||
};
|
||||
|
||||
public static string Prettify(this string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
return string.Empty;
|
||||
|
||||
value = StripPrefix(value);
|
||||
value = value.Replace("_", " ");
|
||||
value = AddSpacing(value);
|
||||
value = Regex.Replace(value, @"\s+", " ").Trim();
|
||||
|
||||
if (value.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
var words = value.Split(' ');
|
||||
var sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
{
|
||||
var word = words[i];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(word))
|
||||
continue;
|
||||
|
||||
string formatted = FormatWord(word);
|
||||
|
||||
sb.Append(formatted);
|
||||
|
||||
if (i < words.Length - 1)
|
||||
sb.Append(' ');
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static string StripPrefix(string value)
|
||||
{
|
||||
foreach (var prefix in Prefixes)
|
||||
{
|
||||
if (value.StartsWith(prefix))
|
||||
return value.Substring(prefix.Length);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static string AddSpacing(string value)
|
||||
{
|
||||
value = Regex.Replace(value, "([a-z0-9])([A-Z])", "$1 $2");
|
||||
value = Regex.Replace(value, "([A-Z]+)([A-Z][a-z])", "$1 $2");
|
||||
value = Regex.Replace(value, "([a-zA-Z])([0-9])", "$1 $2");
|
||||
value = Regex.Replace(value, "([0-9])([a-zA-Z])", "$1 $2");
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static string FormatWord(string word)
|
||||
{
|
||||
if (Overrides.TryGetValue(word, out var overrideValue))
|
||||
return overrideValue;
|
||||
|
||||
if (word.Length > 1 && word.ToUpperInvariant() == word)
|
||||
return word;
|
||||
|
||||
return char.ToUpperInvariant(word[0]) + word.Substring(1).ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Managers.IO;
|
||||
using BriarQueen.Framework.Managers.Player;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
@@ -10,15 +12,21 @@ namespace BriarQueen.Framework.Managers
|
||||
public class DebugManager : MonoBehaviour
|
||||
{
|
||||
private SaveManager _saveManager;
|
||||
private PlayerManager _playerManager;
|
||||
|
||||
[Header("Current Loaded Save")]
|
||||
[SerializeField, ReadOnly]
|
||||
private SaveGame _currentSave;
|
||||
|
||||
[Header("Interactive Debugging")]
|
||||
[SerializeField]
|
||||
private ItemKey _itemToGive;
|
||||
|
||||
[Inject]
|
||||
public void Construct(SaveManager saveManager)
|
||||
public void Construct(SaveManager saveManager, PlayerManager playerManager)
|
||||
{
|
||||
_saveManager = saveManager;
|
||||
_playerManager = playerManager;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
@@ -30,5 +38,14 @@ namespace BriarQueen.Framework.Managers
|
||||
{
|
||||
_currentSave = save;
|
||||
}
|
||||
|
||||
[Button]
|
||||
private void GiveItem()
|
||||
{
|
||||
if (_itemToGive == ItemKey.None)
|
||||
return;
|
||||
|
||||
_playerManager.CollectItem(ItemIDs.Get(_itemToGive));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Coordinators.Events;
|
||||
using BriarQueen.Framework.Events.Save;
|
||||
using BriarQueen.Framework.Extensions;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using MemoryPack;
|
||||
using UnityEngine;
|
||||
@@ -418,5 +419,17 @@ namespace BriarQueen.Framework.Managers.IO
|
||||
|
||||
return CurrentSave.PersistentVariables.Game.GetLevelFlag(levelFlag);
|
||||
}
|
||||
|
||||
public bool HasCollectedItem(string uniqueIdentifier)
|
||||
{
|
||||
if (uniqueIdentifier == null)
|
||||
return false;
|
||||
|
||||
var collected = CurrentSave?.CollectedItems;
|
||||
if (collected == null)
|
||||
return false;
|
||||
|
||||
return collected.Any(x => x.UniqueIdentifier == uniqueIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,6 @@ namespace BriarQueen.Framework.Managers.Interaction.Data
|
||||
|
||||
UniTask EnterHover();
|
||||
UniTask ExitHover();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -375,6 +375,7 @@ namespace BriarQueen.Framework.Managers.Interaction
|
||||
return;
|
||||
|
||||
if (_currentHovered != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _currentHovered.ExitHover();
|
||||
@@ -382,20 +383,19 @@ namespace BriarQueen.Framework.Managers.Interaction
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
_currentHovered = next;
|
||||
|
||||
_eventCoordinator.Publish(
|
||||
new HoverInteractableChangedEvent(_currentHovered));
|
||||
_eventCoordinator.Publish(new HoverInteractableChangedEvent(_currentHovered));
|
||||
|
||||
var cursor =
|
||||
_currentHovered?.ApplicableCursorStyle
|
||||
?? UICursorService.CursorStyle.Default;
|
||||
var cursor = _currentHovered?.ApplicableCursorStyle
|
||||
?? UICursorService.CursorStyle.Default;
|
||||
|
||||
_eventCoordinator.Publish(
|
||||
new CursorStyleChangeEvent(cursor));
|
||||
_eventCoordinator.Publish(new CursorStyleChangeEvent(cursor));
|
||||
|
||||
if (_currentHovered != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _currentHovered.EnterHover();
|
||||
@@ -403,6 +403,7 @@ namespace BriarQueen.Framework.Managers.Interaction
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async UniTask ClearHover()
|
||||
@@ -437,6 +438,7 @@ namespace BriarQueen.Framework.Managers.Interaction
|
||||
return;
|
||||
|
||||
_currentHovered.OnInteract(_selectedItem).Forget();
|
||||
|
||||
}
|
||||
|
||||
private void OnRightClickReceived(OnRightClickEvent obj)
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace BriarQueen.Framework.Managers.Levels.Data
|
||||
|
||||
public virtual string InteractableName =>
|
||||
!string.IsNullOrWhiteSpace(_interactableTooltip) ? _interactableTooltip : _itemData.ItemName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when the item is interacted with. Defaults to Pickup.
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Coordinators.Events;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Extensions;
|
||||
using BriarQueen.Framework.Managers.Interaction;
|
||||
using BriarQueen.Framework.Managers.IO;
|
||||
using BriarQueen.Framework.Managers.UI.Base;
|
||||
@@ -222,16 +223,15 @@ namespace BriarQueen.Framework.Managers.UI
|
||||
private string GetToolbeltTextForEntry(ToolID toolID, bool lost)
|
||||
{
|
||||
if (lost)
|
||||
return $"You lost the {toolID.ToString()}.";
|
||||
return $"You lost the {toolID.GetDisplayName()}.";
|
||||
else
|
||||
return $"You gained the {toolID.ToString()}.";
|
||||
return $"You gained the {toolID.GetDisplayName()}.";
|
||||
}
|
||||
|
||||
private string GetCodexTextForEntry(CodexType codexType)
|
||||
{
|
||||
return codexType switch
|
||||
{
|
||||
CodexType.BookEntry => "You've acquired a new book entry.",
|
||||
CodexType.BookEntry => "You've acquired a new document.",
|
||||
CodexType.PuzzleClue => "You've acquired a new puzzle clue.",
|
||||
CodexType.Photo => "You've acquired a new photo.",
|
||||
_ => string.Empty
|
||||
|
||||
Reference in New Issue
Block a user