46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using Fantasy.DataStructure.Collection;
|
|
using Fantasy.Entitas;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using MongoDB.Bson.Serialization.Options;
|
|
using NB.Game;
|
|
|
|
namespace NB;
|
|
|
|
public sealed class Container : Entity
|
|
{
|
|
/// <summary>
|
|
/// 可用格子数量
|
|
/// </summary>
|
|
public int CellCount;
|
|
|
|
/// <summary>
|
|
/// 最大格子数量
|
|
/// </summary>
|
|
public int CellCountMax;
|
|
|
|
/// <summary>
|
|
/// 当前已经使用格子数量
|
|
/// </summary>
|
|
public int CurrentCellCount;
|
|
|
|
/// <summary>
|
|
/// 容器内的物品
|
|
/// </summary>
|
|
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
|
public Dictionary<long, Item> Items = new Dictionary<long, Item>();
|
|
|
|
/// <summary>
|
|
/// 容器内物品,按格子进行分组
|
|
/// </summary>
|
|
[BsonIgnore] public Dictionary<uint, Item> ItemsByCell = new Dictionary<uint, Item>();
|
|
|
|
/// <summary>
|
|
/// 按物品id分组
|
|
/// </summary>
|
|
[BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByConfigId = new OneToManyListPool<uint, Item>();
|
|
|
|
/// <summary>
|
|
/// 容器内按物品类型分组
|
|
/// </summary>
|
|
[BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByType = new OneToManyListPool<uint, Item>();
|
|
} |