using Fantasy.DataStructure.Collection; using Fantasy.Entitas; using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Options; namespace Fantasy; /// /// 代表一个容器的实体 /// public sealed class Container : Entity { /// /// 配置表ID /// public uint ConfigId; /// /// 账户的实体 /// [BsonIgnore] public Account Account; /// /// 对应的Config配置文件 /// [BsonIgnore] public ContainerConfig Config => ContainerConfigData.Instance.Get(ConfigId); /// /// 当前已经使用的格子的数量 /// public int CurrentCellCount; /// /// 容器内的物品 /// [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] public Dictionary Items = new Dictionary(); /// /// 容器内的物品,按照格子进行存储 /// [BsonIgnore] public Dictionary ItemsByCell = new Dictionary(); /// /// 容器内的物品,按照物品配置ID进行分组 /// [BsonIgnore] public readonly OneToManyList ItemsByConfigId = new OneToManyListPool(); /// /// 容器内的物品,按照物品类型进行分组 /// [BsonIgnore] public readonly OneToManyList ItemsByType = new OneToManyListPool(); }