This commit is contained in:
2025-07-27 12:34:04 +08:00
parent 6311c7cb12
commit 743c1d2baa
194 changed files with 81685 additions and 696 deletions

View File

@@ -0,0 +1,46 @@
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>();
}

View File

@@ -0,0 +1,23 @@
using Fantasy.Entitas;
namespace NB;
public enum ContainerType : uint
{
/// <summary>
/// 背包
/// </summary>
Bag,
/// <summary>
/// 鱼护
/// </summary>
FishBag,
}
/// <summary>
/// 物品容器组件
/// </summary>
public class ContainerComponent : Entity
{
}

View File

@@ -1,16 +0,0 @@
using Fantasy.Entitas;
namespace NB.Game;
public class Currency : Entity
{
/// <summary>
/// 配置id
/// </summary>
public int ConfigId;
/// <summary>
/// 拥有的数量
/// </summary>
public int Count;
}

View File

@@ -1,5 +0,0 @@
namespace NB.Game;
public class DayFlags
{
}

View File

@@ -1,21 +0,0 @@
using Fantasy.Entitas;
namespace NB.Game;
public class GamingInfo : Entity
{
/// <summary>
/// 地图
/// </summary>
public int Map;
/// <summary>
/// 位置
/// </summary>
public int Pos;
/// <summary>
/// 进入时间
/// </summary>
public int Time;
}

View File

@@ -1,26 +0,0 @@
using Fantasy.Entitas;
namespace NB.Game;
public class Guide : Entity
{
/// <summary>
/// 排序
/// </summary>
public int Sort;
/// <summary>
/// 配置id
/// </summary>
public int ConfigId;
/// <summary>
/// 步骤
/// </summary>
public int Step;
/// <summary>
/// 触发时间
/// </summary>
public long GetTime;
}

View File

@@ -1,7 +0,0 @@
using Fantasy.Entitas;
namespace NB.Game;
public class MapMatter : Entity
{
}

View File

@@ -1,7 +0,0 @@
using Fantasy.Entitas;
namespace NB.Game;
public class Mission : Entity
{
}

View File

@@ -1,11 +0,0 @@
using Fantasy.Entitas;
namespace Fantasy;
/// <summary>
/// 玩家信息
/// </summary>
public class Player : Entity
{
}

View File

@@ -1,7 +0,0 @@
using Fantasy.Entitas;
namespace NB.Game;
public class Skill : Entity
{
}

View File

@@ -1,62 +0,0 @@
using Fantasy.Entitas;
using NB.Game;
namespace NB;
public class UserInfo : Entity
{
/// <summary>
/// 基础信息
/// </summary>
public BasicInfo BasicInfo;
/// <summary>
/// 统计信息
/// </summary>
public UserStatisticsInfo Statistics;
/// <summary>
/// 游戏信息
/// </summary>
public GamingInfo GamingInfo;
/// <summary>
/// 货币信息
/// </summary>
public List<Currency> Currency;
/// <summary>
/// 拥有的物品
/// </summary>
public List<Item> Items;
/// <summary>
/// 参与的活动
/// </summary>
public List<Activity> Activity;
/// <summary>
/// 任务列表
/// </summary>
public List<Mission> Missions;
/// <summary>
/// 账号标识
/// </summary>
public DayFlags DayFlags;
/// <summary>
/// 拥有的技能
/// </summary>
public List<Skill> Abilities;
/// <summary>
/// 引导情况
/// </summary>
public List<Guide> Guides;
/// <summary>
/// 地图情况
/// </summary>
public List<MapMatter> MapMatters;
}

View File

@@ -1,7 +1,16 @@
using Fantasy.Entitas;
using MongoDB.Bson.Serialization.Attributes;
namespace NB.Game;
public enum ItemType
{
None = 0,
Item,
Equip,
Fish,
}
public class Item : Entity
{
/// <summary>
@@ -18,4 +27,9 @@ public class Item : Entity
/// 是否绑定
/// </summary>
public bool IsBind;
}
/// <summary>
/// 当前所属的容器
/// </summary>
[BsonIgnore] public Container Container;
}

View File

@@ -2,6 +2,7 @@
namespace NB.Game;
public class Activity : Entity
public class ItemComponent : Entity
{
}

View File

@@ -1,8 +1,12 @@
using Fantasy.Entitas;
namespace NB.Game;
namespace NB;
public class BasicInfo : Entity
/// <summary>
/// 角色基础数据
/// </summary>
[RoleCom]
public class RoleBasic : Entity
{
/// <summary>
/// 昵称

View File

@@ -0,0 +1,15 @@
using Fantasy.Entitas;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Options;
namespace NB;
/// <summary>
/// 角色货币数据
/// </summary>
[RoleCom]
public class RoleCurrency : Entity
{
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
public Dictionary<int, int> dic = new();
}

View File

@@ -0,0 +1,11 @@
using Fantasy.Entitas;
namespace NB;
/// <summary>
/// 角色状态标志量
/// </summary>
[RoleCom]
public class RoleDayFlags : Entity
{
}

View File

@@ -1,8 +1,12 @@
using Fantasy.Entitas;
namespace NB.Game;
namespace NB;
public class UserStatisticsInfo : Entity
/// <summary>
/// 角色统计数据
/// </summary>
[RoleCom]
public class RoleStatistics : Entity
{
/// <summary>
/// 登录次数
@@ -24,5 +28,8 @@ public class UserStatisticsInfo : Entity
/// </summary>
public long CreateTime;
/// <summary>
/// 钓鱼个数
/// </summary>
public int FishCount;
}

8
Entity/Game/Role/Role.cs Normal file
View File

@@ -0,0 +1,8 @@
using Fantasy.Entitas;
namespace NB;
public sealed class Role : Entity
{
}

View File

@@ -0,0 +1,10 @@
using CommandLine;
namespace NB;
/// <summary>
/// 挂这个 玩家Role创建时会自动添加此组件
/// </summary>
public class RoleComAttribute : BaseAttribute
{
}

View File

@@ -0,0 +1,8 @@
using Fantasy.Entitas;
namespace NB;
public class RoleManagerComponent : Entity
{
public readonly Dictionary<long, Role> Roles = new();
}