自动定时数据落地
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Game\Activity\" />
|
||||
<Folder Include="Game\Skill\" />
|
||||
<Folder Include="Map\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB;
|
||||
|
||||
public enum ContainerType : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// 背包
|
||||
/// </summary>
|
||||
Bag,
|
||||
|
||||
/// <summary>
|
||||
/// 鱼护
|
||||
/// </summary>
|
||||
FishBag,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物品容器组件
|
||||
/// </summary>
|
||||
public class ContainerComponent : Entity
|
||||
{
|
||||
}
|
||||
@@ -24,4 +24,14 @@ public class Fish : Entity
|
||||
/// 失效时间
|
||||
/// </summary>
|
||||
[BsonElement("et")] public long ExpirationTime;
|
||||
|
||||
/// <summary>
|
||||
/// 获取地图
|
||||
/// </summary>
|
||||
[BsonElement("map")] public int Map;
|
||||
|
||||
/// <summary>
|
||||
/// 物品所属的容器
|
||||
/// </summary>
|
||||
[BsonIgnore] FishContainer Container;
|
||||
}
|
||||
19
Entity/Game/Fish/FishContainer.cs
Normal file
19
Entity/Game/Fish/FishContainer.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Fantasy.Entitas;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson.Serialization.Options;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class FishContainer : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 最大格子数量
|
||||
/// </summary>
|
||||
public int CellCountMax;
|
||||
|
||||
/// <summary>
|
||||
/// 容器内的物品
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<long, Item> Fishes = new Dictionary<long, Item>();
|
||||
}
|
||||
@@ -11,8 +11,6 @@ public enum ItemType
|
||||
Fish,
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Item : Entity
|
||||
{
|
||||
/// <summary>
|
||||
@@ -43,5 +41,10 @@ public class Item : Entity
|
||||
/// <summary>
|
||||
/// 耐久度
|
||||
/// </summary>
|
||||
[BsonElement("a")] public int Abrasion;
|
||||
[BsonElement("abr")] public int Abrasion;
|
||||
|
||||
/// <summary>
|
||||
/// 物品所属的容器
|
||||
/// </summary>
|
||||
[BsonIgnore] ItemContainer Container;
|
||||
}
|
||||
@@ -6,34 +6,20 @@ using NB.Game;
|
||||
|
||||
namespace NB;
|
||||
|
||||
public sealed class Container : Entity
|
||||
public sealed class ItemContainer : 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>
|
||||
10
Entity/Game/Mission/Mission.cs
Normal file
10
Entity/Game/Mission/Mission.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
/// <summary>
|
||||
/// 角色任务
|
||||
/// </summary>
|
||||
public class Mission : Entity
|
||||
{
|
||||
}
|
||||
32
Entity/Game/Player/Child/PlayerBasic.cs
Normal file
32
Entity/Game/Player/Child/PlayerBasic.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Fantasy.Entitas;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class PlayerBasic : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
public string NickName;
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
public string Head;
|
||||
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
public string Country;
|
||||
|
||||
/// <summary>
|
||||
/// 等级
|
||||
/// </summary>
|
||||
public int Level;
|
||||
|
||||
/// <summary>
|
||||
/// 当前经验
|
||||
/// </summary>
|
||||
public int Exp;
|
||||
}
|
||||
34
Entity/Game/Player/Child/PlayerSlot.cs
Normal file
34
Entity/Game/Player/Child/PlayerSlot.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public enum SlotType
|
||||
{
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// 物品
|
||||
/// </summary>
|
||||
Item,
|
||||
|
||||
/// <summary>
|
||||
/// 钓组
|
||||
/// </summary>
|
||||
Tackle
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 快速使用插槽
|
||||
/// </summary>
|
||||
public class PlayerSlot : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 插槽类型
|
||||
/// </summary>
|
||||
public SlotType SlotType;
|
||||
|
||||
/// <summary>
|
||||
/// 绑定快速使用的id
|
||||
/// </summary>
|
||||
public long BindId;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy.Entitas;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace NB;
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
namespace NB;
|
||||
|
||||
/// <summary>
|
||||
/// 角色状态标志量
|
||||
/// 玩家钓组
|
||||
/// </summary>
|
||||
public class PlayerDayFlags
|
||||
public class PlayerTackle : Entity
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
namespace NB;
|
||||
using Fantasy.Entitas;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
public class PlayerVip
|
||||
namespace NB;
|
||||
|
||||
public class PlayerVip : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否是vip
|
||||
|
||||
27
Entity/Game/Player/Child/PlayerWallet.cs
Normal file
27
Entity/Game/Player/Child/PlayerWallet.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Fantasy.Entitas;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson.Serialization.Options;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
/// <summary>
|
||||
/// 用户钱包
|
||||
/// </summary>
|
||||
public class PlayerWallet : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 余额
|
||||
/// </summary>
|
||||
public int Money;
|
||||
|
||||
/// <summary>
|
||||
/// 金币
|
||||
/// </summary>
|
||||
public int Gold;
|
||||
|
||||
/// <summary>
|
||||
/// 其他货币
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<int, int> Other = new();
|
||||
}
|
||||
@@ -6,72 +6,35 @@ namespace NB.Game;
|
||||
|
||||
public sealed class Player : Entity
|
||||
{
|
||||
[BsonElement("ct")] public long CreateTime;
|
||||
[BsonElement("lt")] public long LoginTime;
|
||||
/// <summary>
|
||||
/// 基础信息
|
||||
/// </summary>
|
||||
public PlayerBasic Basic;
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// 统计信息
|
||||
/// </summary>
|
||||
[BsonElement("name")] public string NickName;
|
||||
public PlayerStatistics Statistics;
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// 角色vip信息
|
||||
/// </summary>
|
||||
public string Head;
|
||||
public PlayerVip Vip;
|
||||
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// 钱包
|
||||
/// </summary>
|
||||
public string Country;
|
||||
public PlayerWallet Wallet;
|
||||
|
||||
/// <summary>
|
||||
/// 等级
|
||||
/// 背包
|
||||
/// </summary>
|
||||
[BsonElement("lv")] public int Level;
|
||||
|
||||
/// <summary>
|
||||
/// 当前经验
|
||||
/// </summary>
|
||||
public int Exp;
|
||||
|
||||
/// <summary>
|
||||
/// 余额
|
||||
/// </summary>
|
||||
public int Money;
|
||||
|
||||
/// <summary>
|
||||
/// 金币
|
||||
/// </summary>
|
||||
public int Gold;
|
||||
|
||||
// public PlayerStatistics Statistics = new PlayerStatistics();
|
||||
// public PlayerDayFlags DayFlags = new PlayerDayFlags();
|
||||
// public PlayerVip Vip = new PlayerVip();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 其他货币
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<int, int> Currency = new();
|
||||
|
||||
/// <summary>
|
||||
/// 插槽
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<uint, long> Slots = new Dictionary<uint, long>();
|
||||
|
||||
/// <summary>
|
||||
/// 背包物品
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<long, Item> Items = new Dictionary<long, Item>();
|
||||
public ItemContainer ItemContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 鱼护
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<long, Fish> Fishes = new Dictionary<long, Fish>();
|
||||
public FishContainer FishContainer;
|
||||
|
||||
|
||||
[BsonIgnore] public long SessionRunTimeId;
|
||||
@@ -82,7 +45,7 @@ public sealed class Player : Entity
|
||||
[BsonIgnore] public bool NeedSave;
|
||||
|
||||
/// <summary>
|
||||
/// 最后保存时间
|
||||
/// 需要保存数据库时间
|
||||
/// </summary>
|
||||
[BsonIgnore] public long LastSaveTime;
|
||||
[BsonIgnore] public long NeedSaveTime;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class PlayerAutoSaveComponent : Entity
|
||||
{
|
||||
|
||||
}
|
||||
@@ -4,5 +4,17 @@ namespace NB.Game;
|
||||
|
||||
public sealed class PlayerManageComponent : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 10分钟
|
||||
/// </summary>
|
||||
public const long AutoSaveTime = 60000; // 600000;
|
||||
|
||||
public long AutoSaveTimerId;
|
||||
|
||||
public readonly Dictionary<long, Player> Players = new();
|
||||
|
||||
/// <summary>
|
||||
/// 需要保存到数据库的玩家
|
||||
/// </summary>
|
||||
public readonly HashSet<long> NeedSavePlayer = new();
|
||||
}
|
||||
11
Entity/Game/Skill/Skill.cs
Normal file
11
Entity/Game/Skill/Skill.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
/// <summary>
|
||||
/// 角色技能
|
||||
/// </summary>
|
||||
public class Skill : Entity
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user