using System; namespace BITKit { /// /// 支持二进制化的的物品容器,适用于网络化物品容器 /// 支持属性 /// 支持回调 /// public interface IBasicItemContainer { /// /// 物品容器的唯一Id /// int Id { get; } /// /// 尝试获取指定Item /// bool TryGetItem(Func func, out IBasicItem item); /// /// 获取所有Item的只读副本 /// IBasicItem[] GetItems(); /// /// 添加物品的接口 /// bool Add(IBasicItem item); /// /// 通过Item本身进行移除 /// bool Remove(IBasicItem item); /// /// 通过Id移除物品(推荐) /// bool Remove(int id); /// /// 通过工厂方法移除物品 /// bool Remove(Func removeFactory); /// /// 通过通过Id丢下物品 /// bool Drop(int Id); /// /// 注册添加物品的工厂方法, /// event Func AddFactory; /// /// 注册移除物品的工厂方法 /// event Func RemoveFactory; /// /// 注册丢下物品的工厂方法 /// event Func DropFactory; /// /// 已添加Item的回调 /// event Action OnAdd; /// /// 已移除Item的回调 /// event Action OnRemove; /// /// 已设置Item的回调 /// event Action OnSet; /// /// 已丢下Item的回调 /// event Action OnDrop; /// /// 已重构Items的回调 /// event Action OnRebuild; } }