艹
This commit is contained in:
7
Entity/Chat/ChatComponent.cs
Normal file
7
Entity/Chat/ChatComponent.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public class ChatComponent : Entity
|
||||
{
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Fantasy\Fantasy.Net\Fantasy.Net\Fantasy.Net.csproj" />
|
||||
<ProjectReference Include="..\Fantasy\Fantasy.Packages\Fantasy.ConfigTable\Net\Fantasy.ConfigTable.csproj" />
|
||||
<ProjectReference Include="..\ThirdParty\ThirdParty.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -28,6 +29,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Gate\" />
|
||||
<Folder Include="Map\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
46
Entity/Game/Container/Container.cs
Normal file
46
Entity/Game/Container/Container.cs
Normal 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>();
|
||||
}
|
||||
23
Entity/Game/Container/ContainerComponent.cs
Normal file
23
Entity/Game/Container/ContainerComponent.cs
Normal 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
|
||||
{
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace NB.Game;
|
||||
|
||||
public class DayFlags
|
||||
{
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class MapMatter : Entity
|
||||
{
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class Mission : Entity
|
||||
{
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家信息
|
||||
/// </summary>
|
||||
public class Player : Entity
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class Skill : Entity
|
||||
{
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class Activity : Entity
|
||||
public class ItemComponent : Entity
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
namespace NB;
|
||||
|
||||
public class BasicInfo : Entity
|
||||
/// <summary>
|
||||
/// 角色基础数据
|
||||
/// </summary>
|
||||
[RoleCom]
|
||||
public class RoleBasic : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
15
Entity/Game/Role/Child/RoleCurrency.cs
Normal file
15
Entity/Game/Role/Child/RoleCurrency.cs
Normal 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();
|
||||
}
|
||||
11
Entity/Game/Role/Child/RoleDayFlags.cs
Normal file
11
Entity/Game/Role/Child/RoleDayFlags.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB;
|
||||
|
||||
/// <summary>
|
||||
/// 角色状态标志量
|
||||
/// </summary>
|
||||
[RoleCom]
|
||||
public class RoleDayFlags : Entity
|
||||
{
|
||||
}
|
||||
@@ -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
8
Entity/Game/Role/Role.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB;
|
||||
|
||||
public sealed class Role : Entity
|
||||
{
|
||||
|
||||
}
|
||||
10
Entity/Game/Role/RoleComAttribute.cs
Normal file
10
Entity/Game/Role/RoleComAttribute.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using CommandLine;
|
||||
|
||||
namespace NB;
|
||||
|
||||
/// <summary>
|
||||
/// 挂这个 玩家Role创建时会自动添加此组件
|
||||
/// </summary>
|
||||
public class RoleComAttribute : BaseAttribute
|
||||
{
|
||||
}
|
||||
8
Entity/Game/Role/RoleManagerComponent.cs
Normal file
8
Entity/Game/Role/RoleManagerComponent.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB;
|
||||
|
||||
public class RoleManagerComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<long, Role> Roles = new();
|
||||
}
|
||||
@@ -3,10 +3,8 @@ using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace NB.Gate;
|
||||
|
||||
public sealed class GameAccount : Entity
|
||||
public sealed class Player : Entity
|
||||
{
|
||||
// 1、可以拿ToKen的传递过来的AId来当这个组件的Id.
|
||||
// 2、让这个Id自动生成、在组件里做一个变量来记录ToKen的AId。 public long AuthenticationId;
|
||||
public long CreateTime;
|
||||
public long LoginTime;
|
||||
|
||||
@@ -2,12 +2,14 @@ using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Gate;
|
||||
|
||||
public sealed class GameAccountFlagComponent : Entity
|
||||
public sealed class PlayerFlagComponent : Entity
|
||||
{
|
||||
public bool Kick { get; set; }
|
||||
|
||||
public long AccountID;
|
||||
|
||||
// 有一种可能,当在Account在其他地方被销毁
|
||||
// 这时候因为这个Account是会回收到池子中,所以这个引用还是有效的
|
||||
// 那这时候就会出现这个引用的Account可能是其他用户的了。
|
||||
public EntityReference<GameAccount> Account;
|
||||
public EntityReference<Player> Account;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Gate;
|
||||
|
||||
public sealed class GameAccountManageComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<long, GameAccount> Accounts = new();
|
||||
}
|
||||
8
Entity/Gate/PlayerManageComponent.cs
Normal file
8
Entity/Gate/PlayerManageComponent.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Gate;
|
||||
|
||||
public sealed class PlayerManageComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<long, Player> Players = new();
|
||||
}
|
||||
@@ -163,7 +163,6 @@ namespace Fantasy
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Unit = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<M2M_SendUnitRequest>(this);
|
||||
#endif
|
||||
@@ -171,7 +170,6 @@ namespace Fantasy
|
||||
[BsonIgnore]
|
||||
public M2M_SendUnitResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.M2M_SendUnitRequest; }
|
||||
public Unit Unit { get; set; }
|
||||
}
|
||||
public partial class M2M_SendUnitResponse : AMessage, IRouteResponse
|
||||
{
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class Unit : Entity
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user