UI系统优化
This commit is contained in:
@@ -11,7 +11,7 @@ namespace BaseGames.Equipment
|
||||
/// 管理玩家的 2 个工具槽(装备、使用、冷却)。
|
||||
/// 实现 ISaveable 以持久化槽位状态。
|
||||
/// </summary>
|
||||
public class ToolSlotManager : MonoBehaviour, ISaveable
|
||||
public class ToolSlotManager : MonoBehaviour, ISaveable, IToolSlotService
|
||||
{
|
||||
private const int SlotCount = 2;
|
||||
|
||||
@@ -27,8 +27,17 @@ namespace BaseGames.Equipment
|
||||
Debug.Assert(_toolCatalog != null, "[ToolSlotManager] _toolCatalog 未赋值,请在 Inspector 中指定 ToolCatalogSO。", this);
|
||||
}
|
||||
|
||||
private void OnEnable() => ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Register(this);
|
||||
private void OnDisable() => ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Unregister(this);
|
||||
private void OnEnable()
|
||||
{
|
||||
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Register(this);
|
||||
ServiceLocator.Register<IToolSlotService>(this);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Unregister(this);
|
||||
ServiceLocator.Unregister<IToolSlotService>(this);
|
||||
}
|
||||
|
||||
// ── 装备 ─────────────────────────────────────────────────────────────
|
||||
public void EquipTool(int slotIndex, ToolSO tool)
|
||||
|
||||
Reference in New Issue
Block a user