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

@@ -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);
}
}
}
}