地图系统

This commit is contained in:
2026-06-05 18:41:33 +08:00
parent 613f2a4d13
commit fe4fd60083
234 changed files with 33090 additions and 4899 deletions

View File

@@ -0,0 +1,54 @@
using System.Collections.Generic;
namespace BaseGames.Inventory
{
/// <summary>
/// 背包管理服务接口。UI 层ItemInventoryPanel通过此接口读取道具状态
/// 与 <see cref="InventoryManager"/> 具体实现解耦,便于独立测试和跨场景复用。
/// 设计对照 <see cref="BaseGames.Equipment.IEquipmentService"/>。
/// </summary>
public interface IInventoryService
{
/// <summary>当前持有的全部道具条目(只读视图,含数量)。</summary>
IReadOnlyList<InventoryEntry> Items { get; }
/// <summary>持有道具种类数(不含数量)。</summary>
int DistinctCount { get; }
/// <summary>查询指定道具的持有数量;未持有返回 0。</summary>
int GetCount(string itemId);
/// <summary>是否持有指定道具(数量 ≥ 1。</summary>
bool Has(string itemId);
/// <summary>
/// 增加道具。stackable 道具按 amount 叠加(受 maxStack 限制);
/// 非 stackable 恒为 1。返回实际新增数量0 表示已满或道具无效)。
/// </summary>
int AddItem(string itemId, int amount = 1);
/// <summary>移除道具(如消耗品使用 / 剧情消耗)。返回实际移除数量。</summary>
int RemoveItem(string itemId, int amount = 1);
/// <summary>清除某道具的"新获得"未读标记(玩家查看背包后调用)。</summary>
void MarkSeen(string itemId);
/// <summary>道具集合变化(增删 / 数量变更时触发UI 据此刷新。</summary>
event System.Action OnInventoryChanged;
}
/// <summary>背包条目:道具数据 + 当前数量 + 未读标记。</summary>
public readonly struct InventoryEntry
{
public readonly ItemSO Item;
public readonly int Count;
public readonly bool IsNew;
public InventoryEntry(ItemSO item, int count, bool isNew)
{
Item = item;
Count = count;
IsNew = isNew;
}
}
}