Restructured for new direction.

This commit is contained in:
2026-05-12 12:01:09 +01:00
parent 0439b6c1d2
commit c203f836b1
1134 changed files with 125569 additions and 213519 deletions

View File

@@ -73,6 +73,7 @@ namespace BriarQueen.UI.HUD
private SettingsService _settingsService;
private RectTransform _textRect;
private Camera _uiCamera;
private string _displayedTooltipText = string.Empty;
private void Awake()
{
@@ -93,10 +94,11 @@ namespace BriarQueen.UI.HUD
{
if (!AreTooltipsEnabled())
{
SetVisible(false);
ClearTooltipText();
return;
}
UpdateTooltip();
FollowCursor();
}
@@ -125,7 +127,7 @@ namespace BriarQueen.UI.HUD
}
[Inject]
private void Construct(EventCoordinator eventCoordinator, InputManager inputManager, SettingsService settingsService,
private void Construct(EventCoordinator eventCoordinator, InputManager inputManager, SettingsService settingsService,
UICursorService cursorService)
{
_eventCoordinator = eventCoordinator;
@@ -183,12 +185,13 @@ namespace BriarQueen.UI.HUD
private void UpdateTooltip()
{
if (!_tooltipText)
{
return;
}
if (!AreTooltipsEnabled())
{
_tooltipText.text = string.Empty;
SetVisible(false);
ClearTooltipText();
return;
}
@@ -197,17 +200,34 @@ namespace BriarQueen.UI.HUD
if (!show)
{
_tooltipText.text = string.Empty;
SetVisible(false);
ClearTooltipText();
return;
}
if (string.Equals(_displayedTooltipText, text))
{
SetVisible(true);
return;
}
_displayedTooltipText = text;
_tooltipText.text = text;
SetVisible(true);
UpdateLayoutToText();
}
private void ClearTooltipText()
{
if (_tooltipText)
{
_tooltipText.text = string.Empty;
}
_displayedTooltipText = string.Empty;
SetVisible(false);
}
private string BuildTooltipText()
{
if (_hoveredInteractable == null)
@@ -363,4 +383,4 @@ namespace BriarQueen.UI.HUD
_rootRect.position = pos;
}
}
}
}

View File

@@ -55,7 +55,7 @@ namespace BriarQueen.UI.HUD
private Sequence _hudSequence;
private CancellationTokenSource _interactCancellationTokenSource;
private Sequence _interactErrorSequence;
private Sequence _interactTextSequence;
private UIManager _uiManager;
public CursorTooltip CursorTooltip => _cursorTooltip;
@@ -132,10 +132,10 @@ namespace BriarQueen.UI.HUD
try
{
// Fade in
_interactErrorSequence = Sequence.Create(useUnscaledTime: true)
_interactTextSequence = Sequence.Create(useUnscaledTime: true)
.Group(Tween.Alpha(_interactTextCanvasGroup, fadeIn));
await _interactErrorSequence.ToUniTask(cancellationToken: token);
await _interactTextSequence.ToUniTask(cancellationToken: token);
_interactTextCanvasGroup.alpha = 1f;
@@ -145,10 +145,10 @@ namespace BriarQueen.UI.HUD
cancellationToken: token);
// Fade out
_interactErrorSequence = Sequence.Create(useUnscaledTime: true)
_interactTextSequence = Sequence.Create(useUnscaledTime: true)
.Group(Tween.Alpha(_interactTextCanvasGroup, fadeOut));
await _interactErrorSequence.ToUniTask(cancellationToken: token);
await _interactTextSequence.ToUniTask(cancellationToken: token);
_interactTextCanvasGroup.alpha = 0f;
}
@@ -164,7 +164,7 @@ namespace BriarQueen.UI.HUD
_interactCancellationTokenSource = null;
}
_interactErrorSequence = default;
_interactTextSequence = default;
}
}
@@ -252,10 +252,10 @@ namespace BriarQueen.UI.HUD
private void StopInteractErrorTween()
{
if (_interactErrorSequence.isAlive)
_interactErrorSequence.Stop();
if (_interactTextSequence.isAlive)
_interactTextSequence.Stop();
_interactErrorSequence = default;
_interactTextSequence = default;
if (_interactCancellationTokenSource != null)
{

View File

@@ -2,12 +2,13 @@ using System;
using System.Collections.Generic;
using System.Threading;
using BriarQueen.Data.Identifiers;
using BriarQueen.Framework.Assets;
using BriarQueen.Framework.Coordinators.Events;
using BriarQueen.Framework.Events.Gameplay;
using BriarQueen.Framework.Managers.Assets;
using BriarQueen.Framework.Managers.Player;
using BriarQueen.Framework.Managers.Player.Data;
using BriarQueen.Framework.Registries;
using BriarQueen.Framework.Services.Destruction;
using BriarQueen.Framework.Services.Tutorials;
using Cysharp.Threading.Tasks;
using PrimeTween;
@@ -42,6 +43,7 @@ namespace BriarQueen.UI.HUD
private EventCoordinator _eventCoordinator;
private PlayerManager _playerManager;
private TutorialService _tutorialService;
private DestructionService _destructionService;
private int _currentPage;
private int _selectedIndex = -1;
@@ -69,13 +71,15 @@ namespace BriarQueen.UI.HUD
PlayerManager playerManager,
AddressableManager addressableManager,
AssetRegistry assetRegistry,
TutorialService tutorialService)
TutorialService tutorialService,
DestructionService destructionService)
{
_eventCoordinator = eventCoordinator;
_playerManager = playerManager;
_addressableManager = addressableManager;
_assetRegistry = assetRegistry;
_tutorialService = tutorialService;
_destructionService = destructionService;
}
private void Awake()
@@ -180,7 +184,7 @@ namespace BriarQueen.UI.HUD
continue;
child.gameObject.SetActive(false);
Destroy(child.gameObject);
_destructionService.Destroy(child.gameObject).Forget();
}
}
@@ -242,25 +246,41 @@ private async UniTask RebuildInventoryAsync()
if (item == null)
continue;
var slotObj = await _addressableManager.InstantiateAsync(slotRef, parent: _content);
token.ThrowIfCancellationRequested();
GameObject slotObj = null;
if (slotObj == null)
try
{
Debug.LogWarning("[InventoryBar] AddressableManager returned null slot object.");
continue;
}
slotObj = await _addressableManager.InstantiateAsync(slotRef, parent: _content);
token.ThrowIfCancellationRequested();
var slot = slotObj.GetComponent<UIInventorySlot>();
if (slot == null)
if (slotObj == null)
{
Debug.LogWarning("[InventoryBar] AddressableManager returned null slot object.");
continue;
}
var slot = slotObj.GetComponent<UIInventorySlot>();
if (slot == null)
{
Debug.LogWarning("[InventoryBar] Instantiated slot prefab is missing UIInventorySlot.");
await _destructionService.Destroy(slotObj);
slotObj = null;
continue;
}
slot.Initialize(this, item);
_inventorySlots.Add(slot);
// Ownership has moved to the active slot list.
slotObj = null;
}
catch (OperationCanceledException)
{
Debug.LogWarning("[InventoryBar] Instantiated slot prefab is missing UIInventorySlot.");
Destroy(slotObj);
continue;
}
if (slotObj != null)
await _destructionService.Destroy(slotObj);
slot.Initialize(this, item);
_inventorySlots.Add(slot);
throw;
}
}
await UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate, token);
@@ -563,4 +583,4 @@ private async UniTask RebuildInventoryAsync()
SetSelectedIndex(prevIndex, true);
}
}
}
}