diff --git a/Config/Excel/Version.txt b/Config/Excel/Version.txt
index bf43dff..8fa6e75 100644
--- a/Config/Excel/Version.txt
+++ b/Config/Excel/Version.txt
@@ -1 +1 @@
-{"WorksheetNames":[-8419147776733210060,-3495952183970875596,-1088042625810372120,1720330851179383898],"Tables":{"-3495952183970875596":1757242691062,"-1088042625810372120":1753532052628,"1720330851179383898":1753711757684,"3730651590607244245":1753532052629,"5812538452563588342":1753532052630}}
\ No newline at end of file
+{"WorksheetNames":[-8419147776733210060,-3495952183970875596,1720330851179383898,5812538452563588342],"Tables":{"-3495952183970875596":1757296589391,"-1088042625810372120":1748918712210,"1720330851179383898":1753770985781,"3730651590607244245":1748918712210,"5812538452563588342":1751250727840}}
\ No newline at end of file
diff --git a/Config/NetworkProtocol/Outer/GameMessage.proto b/Config/NetworkProtocol/Outer/GameMessage.proto
index 2f5c1f6..c47bc71 100644
--- a/Config/NetworkProtocol/Outer/GameMessage.proto
+++ b/Config/NetworkProtocol/Outer/GameMessage.proto
@@ -1,3 +1,86 @@
syntax = "proto3";
package Fantasy.Network.Message;
+////////////// ******** 物品信息 *******/////////////
+
+///请求背包列表
+message C2Game_GetItemsRequest // ICustomRouteRequest,Game2C_GetItemsResponse,GameRoute
+{
+
+}
+
+///请求背包列表响应
+message Game2C_GetItemsResponse // ICustomRouteResponse
+{
+ repeated ItemInfo Items = 1; //物品信息
+ repeated ItemBindInfo Rigs = 2; //钓组信息
+}
+
+///请求使用物品
+message C2Game_UseItemRequest // ICustomRouteRequest,Game2C_UseItemResponse,GameRoute
+{
+
+}
+
+///请求使用物品响应
+message Game2C_UseItemResponse // ICustomRouteResponse
+{
+}
+
+///物品变化
+message Game2C_ItemChange // ICustomRouteMessage,GameRoute
+{
+ int32 Type = 1; //变化类型 0.新增 1,更新 -1删除
+ repeated ItemInfo Items = 2; //物品信息
+ repeated int64 Removes = 3; //移除物品(移除时有)
+}
+
+
+////////////// ******** 鱼护 *******/////////////
+
+///请求鱼护列表
+message C2Game_GetFishsRequest // ICustomRouteRequest,Game2C_GetFishsResponse,GameRoute
+{
+
+}
+
+///请求鱼护列表响应
+message Game2C_GetFishsResponse // ICustomRouteResponse
+{
+ repeated FishInfo Fishs = 1;
+}
+
+///鱼护变化
+message Game2C_FishChange // ICustomRouteMessage,GameRoute
+{
+ int32 Type = 1; //变化类型 0.新增 1,更新 -1删除
+ repeated FishInfo Fishs = 2; //物品信息
+ repeated int64 Removes = 3; //移除物品(移除时有)
+}
+
+///请求出售
+message C2Game_SellFishRequest // ICustomRouteRequest,Game2C_SellFishResponse,GameRoute
+{
+ repeated int64 Ids = 1; //出售id
+}
+
+///请求出售响应
+message Game2C_SellFishResponse // ICustomRouteResponse
+{
+ repeated AwardInfo Awards = 1; //奖励
+}
+
+
+////////////// ******** 商店 *******/////////////
+
+///请求购买
+message C2Game_BuyRequest // ICustomRouteRequest,Game2C_GetFishsResponse,GameRoute
+{
+
+}
+
+///请求购买响应
+message Game2C_BuyResponse // ICustomRouteResponse
+{
+ repeated AwardInfo Awards = 1; //奖励
+}
\ No newline at end of file
diff --git a/Config/NetworkProtocol/Outer/RoomMessage.proto b/Config/NetworkProtocol/Outer/RoomMessage.proto
index 51f4327..44572e8 100644
--- a/Config/NetworkProtocol/Outer/RoomMessage.proto
+++ b/Config/NetworkProtocol/Outer/RoomMessage.proto
@@ -64,7 +64,8 @@ message Map2C_MoveNotify // ICustomRouteMessage,MapRoute
Vector3Info Rotation = 3; //角色方向
Vector3Info Direction = 4; // 移动方向
bool IsStop = 5; // 是否停止移动
- int64 Timestamp = 6; // 时间点
+ bool IsRun = 6; //是否奔跑
+ int64 Timestamp = 7; // 时间点
}
///玩家旋转推送
diff --git a/Config/NetworkProtocol/Outer/data/CommonProtoData.proto b/Config/NetworkProtocol/Outer/data/CommonProtoData.proto
index 7bfbb9a..52f16a7 100644
--- a/Config/NetworkProtocol/Outer/data/CommonProtoData.proto
+++ b/Config/NetworkProtocol/Outer/data/CommonProtoData.proto
@@ -42,13 +42,13 @@ message RoleInfo
RoleBaseInfo BaseInfo = 1;
int64 RoleId = 2; //账号id
repeated ItemInfo Items = 3; //身上物品
- repeated FishInfo Fishs = 4; //鱼护
- repeated ActivityInfo Activities = 5; //活动信息
- repeated KeyValueInt64 Currency = 6; //货币信息
- repeated KeyValueInt64 Slots = 7; //插槽使用情况
- repeated SkillInfo Skills = 8; //技能信息
- repeated GearInfo Gears = 9; //钓组信息
- int32 MapId = 9; //当前所在地图
+ repeated ItemBindInfo ItemBinds = 4; //物品绑定信息
+ repeated FishInfo Fishs = 5; //鱼护
+ repeated ActivityInfo Activities = 6; //活动信息
+ repeated KeyValueInt64 Currency = 7; //货币信息
+ repeated KeyValueInt64 Slots = 8; //插槽使用情况
+ repeated SkillInfo Skills = 9; //技能信息
+ int32 MapId = 10; //当前所在地图
}
/// 角色信息
@@ -78,6 +78,12 @@ message AwardInfo
int32 Count = 2; //数量
}
+///玩家当前使用钓组信息
+message ItemBindInfo
+{
+ int64 Item = 1; //主物品
+ repeated int64 BindItems = 2; //绑定物品
+}
///物品信息
message ItemInfo
{
diff --git a/Config/NetworkProtocol/Outer/data/MapProtoData.proto b/Config/NetworkProtocol/Outer/data/MapProtoData.proto
index 011f57e..d73bee6 100644
--- a/Config/NetworkProtocol/Outer/data/MapProtoData.proto
+++ b/Config/NetworkProtocol/Outer/data/MapProtoData.proto
@@ -23,16 +23,14 @@ message QuaternionInfo
message GearInfo
{
int64 Rod = 1;
- repeated int64 Rigs = 2; //钓组配件
- float LineLength = 3; //线长度
- float ReelSpeed = 4; //收线速度
- int32 State = 5; //杆子状态
- Vector3Info Position = 6; //钓组当前位置
- Vector3Info Rotation = 7; //钓组方向
+ repeated int64 Rigs = 2; //钓组配件
+ int32 State = 3; //杆子状态
+ Vector3Info Position = 4; //钓组当前位置
+ Vector3Info Rotation = 5; //钓组方向
+ repeated KeyValueInt32 Propertys = 6; //属性信息
}
-
message UnitStateInfo
{
int32 State = 1; //状态id
diff --git a/Entity/Game/Item/Item.cs b/Entity/Game/Item/Item.cs
index e394885..57d0571 100644
--- a/Entity/Game/Item/Item.cs
+++ b/Entity/Game/Item/Item.cs
@@ -46,5 +46,5 @@ public class Item : Entity
///
/// 物品所属的容器
///
- [BsonIgnore] ItemContainer Container;
+ [BsonIgnore] PlayerItemContainer Container;
}
\ No newline at end of file
diff --git a/Entity/Game/Item/ItemContainer.cs b/Entity/Game/Item/PlayerItemContainer.cs
similarity index 95%
rename from Entity/Game/Item/ItemContainer.cs
rename to Entity/Game/Item/PlayerItemContainer.cs
index 9754a1a..eb41e01 100644
--- a/Entity/Game/Item/ItemContainer.cs
+++ b/Entity/Game/Item/PlayerItemContainer.cs
@@ -6,7 +6,7 @@ using NB.Game;
namespace NB;
-public sealed class ItemContainer : Entity
+public sealed class PlayerItemContainer : Entity
{
///
/// 最大格子数量
diff --git a/Entity/Game/Player/Child/PlayerBasic.cs b/Entity/Game/Player/Child/PlayerBasic.cs
deleted file mode 100644
index 031acb8..0000000
--- a/Entity/Game/Player/Child/PlayerBasic.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Fantasy.Entitas;
-using MongoDB.Bson.Serialization.Attributes;
-
-namespace NB.Game;
-
-// public class PlayerBasic : Entity
-// {
-// ///
-// /// 昵称
-// ///
-// public string NickName;
-//
-// ///
-// /// 头像
-// ///
-// public string Head;
-//
-// ///
-// /// 国家
-// ///
-// public string Country;
-//
-// ///
-// /// 等级
-// ///
-// public int Level;
-//
-// ///
-// /// 当前经验
-// ///
-// public int Exp;
-// }
\ No newline at end of file
diff --git a/Entity/Game/Player/Child/PlayerSlot.cs b/Entity/Game/Player/Child/PlayerSlot.cs
deleted file mode 100644
index 525dda0..0000000
--- a/Entity/Game/Player/Child/PlayerSlot.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using Fantasy.Entitas;
-
-namespace NB.Game;
-
-public enum SlotType
-{
- None,
-
- ///
- /// 物品
- ///
- Item,
-
- ///
- /// 钓组
- ///
- Tackle
-}
-
-///
-/// 快速使用插槽
-///
-public class PlayerSlot : Entity
-{
- ///
- /// 插槽类型
- ///
- public SlotType SlotType;
-
- ///
- /// 绑定快速使用的id
- ///
- public long BindId;
-}
\ No newline at end of file
diff --git a/Entity/Game/Player/Child/PlayerTackle.cs b/Entity/Game/Player/Child/PlayerTackle.cs
deleted file mode 100644
index 4b2d85b..0000000
--- a/Entity/Game/Player/Child/PlayerTackle.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Fantasy.Entitas;
-
-namespace NB;
-
-///
-/// 玩家钓组
-///
-public class PlayerTackle : Entity
-{
-
-}
\ No newline at end of file
diff --git a/Entity/Game/Player/Player.cs b/Entity/Game/Player/Player.cs
index 73f88ba..e662cb6 100644
--- a/Entity/Game/Player/Player.cs
+++ b/Entity/Game/Player/Player.cs
@@ -59,7 +59,7 @@ public sealed class Player : Entity
///
/// 背包
///
- [BsonElement("bag")] public ItemContainer ItemContainer;
+ [BsonElement("bag")] public PlayerItemContainer ItemContainer;
///
/// 鱼护
@@ -83,14 +83,5 @@ public sealed class Player : Entity
public bool IsVip => Vip != null && Vip.ExpirationTime > TimeHelper.Now;
[BsonIgnore] public long SessionRunTimeId;
-
- ///
- /// 需要保存数据库
- ///
- [BsonIgnore] public bool NeedSave;
-
- ///
- /// 需要保存数据库时间
- ///
- [BsonIgnore] public long NeedSaveTime;
+
}
\ No newline at end of file
diff --git a/Entity/Game/Player/PlayerManageComponent.cs b/Entity/Game/Player/PlayerManageComponent.cs
index 59905f4..1965dca 100644
--- a/Entity/Game/Player/PlayerManageComponent.cs
+++ b/Entity/Game/Player/PlayerManageComponent.cs
@@ -4,7 +4,5 @@ namespace NB.Game;
public sealed class PlayerManageComponent : Entity
{
- public long AutoSaveTimerId;
-
public readonly Dictionary Players = new();
}
\ No newline at end of file
diff --git a/Entity/Game/Player/Child/PlayerVip.cs b/Entity/Game/Player/PlayerVip.cs
similarity index 100%
rename from Entity/Game/Player/Child/PlayerVip.cs
rename to Entity/Game/Player/PlayerVip.cs
diff --git a/Entity/Game/Player/Child/PlayerWallet.cs b/Entity/Game/Player/PlayerWallet.cs
similarity index 100%
rename from Entity/Game/Player/Child/PlayerWallet.cs
rename to Entity/Game/Player/PlayerWallet.cs
diff --git a/Entity/Game/Player/Child/PlayerStatistics.cs b/Entity/Game/Statistics/PlayerStatistics.cs
similarity index 100%
rename from Entity/Game/Player/Child/PlayerStatistics.cs
rename to Entity/Game/Statistics/PlayerStatistics.cs
diff --git a/Entity/Generate/NetworkProtocol/CommonProtoData.cs b/Entity/Generate/NetworkProtocol/CommonProtoData.cs
index a80f9b6..c7046e7 100644
--- a/Entity/Generate/NetworkProtocol/CommonProtoData.cs
+++ b/Entity/Generate/NetworkProtocol/CommonProtoData.cs
@@ -150,12 +150,12 @@ namespace Fantasy
BaseInfo = default;
RoleId = default;
Items.Clear();
+ ItemBinds.Clear();
Fishs.Clear();
Activities.Clear();
Currency.Clear();
Slots.Clear();
Skills.Clear();
- Gears.Clear();
MapId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
@@ -168,17 +168,17 @@ namespace Fantasy
[ProtoMember(3)]
public List Items = new List();
[ProtoMember(4)]
- public List Fishs = new List();
+ public List ItemBinds = new List();
[ProtoMember(5)]
- public List Activities = new List();
+ public List Fishs = new List();
[ProtoMember(6)]
- public List Currency = new List();
+ public List Activities = new List();
[ProtoMember(7)]
- public List Slots = new List();
+ public List Currency = new List();
[ProtoMember(8)]
- public List Skills = new List();
+ public List Slots = new List();
[ProtoMember(9)]
- public List Gears = new List();
+ public List Skills = new List();
[ProtoMember(10)]
public int MapId { get; set; }
}
@@ -267,6 +267,29 @@ namespace Fantasy
public int Count { get; set; }
}
///
+ /// 玩家当前使用钓组信息
+ ///
+ [ProtoContract]
+ public partial class ItemBindInfo : AMessage, IProto
+ {
+ public static ItemBindInfo Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Item = default;
+ BindItems.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoMember(1)]
+ public long Item { get; set; }
+ [ProtoMember(2)]
+ public List BindItems = new List();
+ }
+ ///
/// 物品信息
///
[ProtoContract]
diff --git a/Entity/Generate/NetworkProtocol/GameMessage.cs b/Entity/Generate/NetworkProtocol/GameMessage.cs
index c4f45da..8277e48 100644
--- a/Entity/Generate/NetworkProtocol/GameMessage.cs
+++ b/Entity/Generate/NetworkProtocol/GameMessage.cs
@@ -17,4 +17,304 @@ using Fantasy.Serialize;
namespace Fantasy
{
+ ///
+ /// /////////// ******** 物品信息 *******/////////////
+ ///
+ ///
+ /// 请求背包列表
+ ///
+ [ProtoContract]
+ public partial class C2Game_GetItemsRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2Game_GetItemsRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public Game2C_GetItemsResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2Game_GetItemsRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ }
+ ///
+ /// 请求背包列表响应
+ ///
+ [ProtoContract]
+ public partial class Game2C_GetItemsResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static Game2C_GetItemsResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Items.Clear();
+ Rigs.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Game2C_GetItemsResponse; }
+ [ProtoMember(1)]
+ public List Items = new List();
+ [ProtoMember(2)]
+ public List Rigs = new List();
+ [ProtoMember(3)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 请求使用物品
+ ///
+ [ProtoContract]
+ public partial class C2Game_UseItemRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2Game_UseItemRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public Game2C_UseItemResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2Game_UseItemRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ }
+ ///
+ /// 请求使用物品响应
+ ///
+ [ProtoContract]
+ public partial class Game2C_UseItemResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static Game2C_UseItemResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Game2C_UseItemResponse; }
+ [ProtoMember(1)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 物品变化
+ ///
+ [ProtoContract]
+ public partial class Game2C_ItemChange : AMessage, ICustomRouteMessage, IProto
+ {
+ public static Game2C_ItemChange Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Type = default;
+ Items.Clear();
+ Removes.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Game2C_ItemChange; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ [ProtoMember(1)]
+ public int Type { get; set; }
+ [ProtoMember(2)]
+ public List Items = new List();
+ [ProtoMember(3)]
+ public List Removes = new List();
+ }
+ ///
+ /// /////////// ******** 鱼护 *******/////////////
+ ///
+ ///
+ /// 请求鱼护列表
+ ///
+ [ProtoContract]
+ public partial class C2Game_GetFishsRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2Game_GetFishsRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public Game2C_GetFishsResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2Game_GetFishsRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ }
+ ///
+ /// 请求鱼护列表响应
+ ///
+ [ProtoContract]
+ public partial class Game2C_GetFishsResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static Game2C_GetFishsResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Fishs.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Game2C_GetFishsResponse; }
+ [ProtoMember(1)]
+ public List Fishs = new List();
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 鱼护变化
+ ///
+ [ProtoContract]
+ public partial class Game2C_FishChange : AMessage, ICustomRouteMessage, IProto
+ {
+ public static Game2C_FishChange Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Type = default;
+ Fishs.Clear();
+ Removes.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Game2C_FishChange; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ [ProtoMember(1)]
+ public int Type { get; set; }
+ [ProtoMember(2)]
+ public List Fishs = new List();
+ [ProtoMember(3)]
+ public List Removes = new List();
+ }
+ ///
+ /// 请求出售
+ ///
+ [ProtoContract]
+ public partial class C2Game_SellFishRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2Game_SellFishRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Ids.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public Game2C_SellFishResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2Game_SellFishRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ [ProtoMember(1)]
+ public List Ids = new List();
+ }
+ ///
+ /// 请求出售响应
+ ///
+ [ProtoContract]
+ public partial class Game2C_SellFishResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static Game2C_SellFishResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Awards.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Game2C_SellFishResponse; }
+ [ProtoMember(1)]
+ public List Awards = new List();
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// /////////// ******** 商店 *******/////////////
+ ///
+ ///
+ /// 请求购买
+ ///
+ [ProtoContract]
+ public partial class C2Game_BuyRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2Game_BuyRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public Game2C_GetFishsResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2Game_BuyRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ }
+ ///
+ /// 请求购买响应
+ ///
+ [ProtoContract]
+ public partial class Game2C_BuyResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static Game2C_BuyResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Awards.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Game2C_BuyResponse; }
+ [ProtoMember(1)]
+ public List Awards = new List();
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
}
diff --git a/Entity/Generate/NetworkProtocol/MapMessage.cs b/Entity/Generate/NetworkProtocol/MapMessage.cs
index 0407359..2a02cc7 100644
--- a/Entity/Generate/NetworkProtocol/MapMessage.cs
+++ b/Entity/Generate/NetworkProtocol/MapMessage.cs
@@ -70,7 +70,7 @@ namespace Fantasy
public uint ErrorCode { get; set; }
}
///
- /// 请求网关离开房间
+ /// 请求网关离开房间(离开房间,但是不离开地图)
///
[ProtoContract]
public partial class C2G_ExitRoomRequest : AMessage, IRequest, IProto
diff --git a/Entity/Generate/NetworkProtocol/MapProtoData.cs b/Entity/Generate/NetworkProtocol/MapProtoData.cs
index 9efd7d7..a2dce68 100644
--- a/Entity/Generate/NetworkProtocol/MapProtoData.cs
+++ b/Entity/Generate/NetworkProtocol/MapProtoData.cs
@@ -100,11 +100,10 @@ namespace Fantasy
{
Rod = default;
Rigs.Clear();
- LineLength = default;
- ReelSpeed = default;
State = default;
Position = default;
Rotation = default;
+ Propertys.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
#endif
@@ -114,15 +113,13 @@ namespace Fantasy
[ProtoMember(2)]
public List Rigs = new List();
[ProtoMember(3)]
- public float LineLength { get; set; }
- [ProtoMember(4)]
- public float ReelSpeed { get; set; }
- [ProtoMember(5)]
public int State { get; set; }
- [ProtoMember(6)]
+ [ProtoMember(4)]
public Vector3Info Position { get; set; }
- [ProtoMember(7)]
+ [ProtoMember(5)]
public Vector3Info Rotation { get; set; }
+ [ProtoMember(6)]
+ public List Propertys = new List();
}
[ProtoContract]
public partial class UnitStateInfo : AMessage, IProto
diff --git a/Entity/Generate/NetworkProtocol/OuterOpcode.cs b/Entity/Generate/NetworkProtocol/OuterOpcode.cs
index 7bbce27..e961c15 100644
--- a/Entity/Generate/NetworkProtocol/OuterOpcode.cs
+++ b/Entity/Generate/NetworkProtocol/OuterOpcode.cs
@@ -2,60 +2,72 @@ namespace Fantasy
{
public static partial class OuterOpcode
{
- public const uint C2Map_CreateRoomRequest = 2281711377;
- public const uint Map2C_CreateRoomResponse = 2415929105;
+ public const uint C2Game_GetItemsRequest = 2281711377;
+ public const uint Game2C_GetItemsResponse = 2415929105;
+ public const uint C2Game_UseItemRequest = 2281711378;
+ public const uint Game2C_UseItemResponse = 2415929106;
+ public const uint Game2C_ItemChange = 2147493649;
+ public const uint C2Game_GetFishsRequest = 2281711379;
+ public const uint Game2C_GetFishsResponse = 2415929107;
+ public const uint Game2C_FishChange = 2147493650;
+ public const uint C2Game_SellFishRequest = 2281711380;
+ public const uint Game2C_SellFishResponse = 2415929108;
+ public const uint C2Game_BuyRequest = 2281711381;
+ public const uint Game2C_BuyResponse = 2415929109;
+ public const uint C2Map_CreateRoomRequest = 2281711382;
+ public const uint Map2C_CreateRoomResponse = 2415929110;
public const uint C2G_ExitRoomRequest = 268445457;
public const uint G2C_ExitRoomResponse = 402663185;
public const uint C2G_EnterMapRequest = 268445458;
public const uint G2C_EnterMapResponse = 402663186;
- public const uint Map2C_ChangeMap = 2147493649;
+ public const uint Map2C_ChangeMap = 2147493651;
public const uint C2A_LoginRequest = 268445459;
public const uint A2C_LoginResponse = 402663187;
public const uint C2G_LoginRequest = 268445460;
public const uint G2C_LoginResponse = 402663188;
public const uint G2C_RepeatLogin = 134227729;
- public const uint C2Game_GetRoleInfoRequest = 2281711378;
- public const uint Game2C_GetRoleInfoResponse = 2415929106;
- public const uint Map2C_RoleEnterRoomNotify = 2147493650;
- public const uint Map2C_RoleExitRoomNotify = 2147493651;
- public const uint Map2C_RoleStateNotify = 2147493652;
- public const uint Map2C_RoleGearChangeNotify = 2147493653;
- public const uint Map2C_RolePropertyChangeNotify = 2147493654;
- public const uint C2Map_Move = 2147493655;
- public const uint C2Map_Look = 2147493656;
- public const uint Map2C_MoveNotify = 2147493657;
- public const uint Map2C_LookeNotify = 2147493658;
- public const uint C2S_GetConversationsRequest = 2281711379;
- public const uint S2C_GetConversationsResponse = 2415929107;
- public const uint C2S_SendMailRequest = 2281711380;
- public const uint S2C_SendMailResponse = 2415929108;
- public const uint C2S_DeleteMailRequest = 2281711381;
- public const uint S2C_DeleteMailResponse = 2415929109;
- public const uint S2C_HaveMail = 2147493659;
- public const uint S2C_MailState = 2147493660;
- public const uint C2S_CreateChannelRequest = 2281711382;
- public const uint S2C_CreateChannelResponse = 2415929110;
- public const uint C2S_JoinChannelRequest = 2281711383;
- public const uint S2C_JoinChannelResponse = 2415929111;
- public const uint C2S_SendMessageRequest = 2281711384;
- public const uint S2C_SendMessageResponse = 2415929112;
- public const uint S2C_Message = 2147493661;
- public const uint C2S_CreateClubRequest = 2281711385;
- public const uint S2C_CreateClubResponse = 2415929113;
- public const uint C2S_GetClubInfoRequest = 2281711386;
- public const uint S2C_GetClubInfoResponse = 2415929114;
- public const uint C2S_GetMemberListRequest = 2281711387;
- public const uint S2C_GetMemberListResponse = 2415929115;
- public const uint C2S_GetClubListRequest = 2281711388;
- public const uint S2C_GetClubListResponse = 2415929116;
- public const uint C2S_JoinClubRequest = 2281711389;
- public const uint S2C_JoinClubResponse = 2415929117;
- public const uint C2S_LeaveClubRequest = 2281711390;
- public const uint S2C_LeaveClubResponse = 2415929118;
- public const uint C2S_DissolveClubRequest = 2281711391;
- public const uint S2C_DissolveClubResponse = 2415929119;
- public const uint C2S_DisposeJoinRequest = 2281711392;
- public const uint S2C_DisposeJoinResponse = 2415929120;
- public const uint S2C_ClubChange = 2147493662;
+ public const uint C2Game_GetRoleInfoRequest = 2281711383;
+ public const uint Game2C_GetRoleInfoResponse = 2415929111;
+ public const uint Map2C_RoleEnterRoomNotify = 2147493652;
+ public const uint Map2C_RoleExitRoomNotify = 2147493653;
+ public const uint Map2C_RoleStateNotify = 2147493654;
+ public const uint Map2C_RoleGearChangeNotify = 2147493655;
+ public const uint Map2C_RolePropertyChangeNotify = 2147493656;
+ public const uint C2Map_Move = 2147493657;
+ public const uint C2Map_Look = 2147493658;
+ public const uint Map2C_MoveNotify = 2147493659;
+ public const uint Map2C_LookeNotify = 2147493660;
+ public const uint C2S_GetConversationsRequest = 2281711384;
+ public const uint S2C_GetConversationsResponse = 2415929112;
+ public const uint C2S_SendMailRequest = 2281711385;
+ public const uint S2C_SendMailResponse = 2415929113;
+ public const uint C2S_DeleteMailRequest = 2281711386;
+ public const uint S2C_DeleteMailResponse = 2415929114;
+ public const uint S2C_HaveMail = 2147493661;
+ public const uint S2C_MailState = 2147493662;
+ public const uint C2S_CreateChannelRequest = 2281711387;
+ public const uint S2C_CreateChannelResponse = 2415929115;
+ public const uint C2S_JoinChannelRequest = 2281711388;
+ public const uint S2C_JoinChannelResponse = 2415929116;
+ public const uint C2S_SendMessageRequest = 2281711389;
+ public const uint S2C_SendMessageResponse = 2415929117;
+ public const uint S2C_Message = 2147493663;
+ public const uint C2S_CreateClubRequest = 2281711390;
+ public const uint S2C_CreateClubResponse = 2415929118;
+ public const uint C2S_GetClubInfoRequest = 2281711391;
+ public const uint S2C_GetClubInfoResponse = 2415929119;
+ public const uint C2S_GetMemberListRequest = 2281711392;
+ public const uint S2C_GetMemberListResponse = 2415929120;
+ public const uint C2S_GetClubListRequest = 2281711393;
+ public const uint S2C_GetClubListResponse = 2415929121;
+ public const uint C2S_JoinClubRequest = 2281711394;
+ public const uint S2C_JoinClubResponse = 2415929122;
+ public const uint C2S_LeaveClubRequest = 2281711395;
+ public const uint S2C_LeaveClubResponse = 2415929123;
+ public const uint C2S_DissolveClubRequest = 2281711396;
+ public const uint S2C_DissolveClubResponse = 2415929124;
+ public const uint C2S_DisposeJoinRequest = 2281711397;
+ public const uint S2C_DisposeJoinResponse = 2415929125;
+ public const uint S2C_ClubChange = 2147493664;
}
}
diff --git a/Entity/Generate/NetworkProtocol/RoomMessage.cs b/Entity/Generate/NetworkProtocol/RoomMessage.cs
index 02f9fc4..66c62bd 100644
--- a/Entity/Generate/NetworkProtocol/RoomMessage.cs
+++ b/Entity/Generate/NetworkProtocol/RoomMessage.cs
@@ -207,6 +207,7 @@ namespace Fantasy
Rotation = default;
Direction = default;
IsStop = default;
+ IsRun = default;
Timestamp = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
@@ -226,6 +227,8 @@ namespace Fantasy
[ProtoMember(5)]
public bool IsStop { get; set; }
[ProtoMember(6)]
+ public bool IsRun { get; set; }
+ [ProtoMember(7)]
public long Timestamp { get; set; }
}
///
diff --git a/Hotfix/Game/Item/ItemContainerSystem.cs b/Hotfix/Game/Item/ItemContainerSystem.cs
index a592668..1800689 100644
--- a/Hotfix/Game/Item/ItemContainerSystem.cs
+++ b/Hotfix/Game/Item/ItemContainerSystem.cs
@@ -3,9 +3,9 @@ using Fantasy.Entitas.Interface;
namespace NB.Game;
-public sealed class ItemContainerDestroySystem : DestroySystem
+public sealed class ItemContainerDestroySystem : DestroySystem
{
- protected override void Destroy(ItemContainer self)
+ protected override void Destroy(PlayerItemContainer self)
{
self.CellCountMax = 0;
@@ -31,7 +31,7 @@ public static class ItemContainerSystem
///
///
///
- public static bool GetItemById(this ItemContainer self, long id, out Item? item)
+ public static bool GetItemById(this PlayerItemContainer self, long id, out Item? item)
{
return self.Items.TryGetValue(id, out item);
}
@@ -42,7 +42,7 @@ public static class ItemContainerSystem
///
///
///
- public static bool GetFistItemByConfigId(this ItemContainer self, int configId, out Item? item)
+ public static bool GetFistItemByConfigId(this PlayerItemContainer self, int configId, out Item? item)
{
foreach (var (_, it) in self.Items)
{
@@ -100,7 +100,7 @@ public static class ItemContainerSystem
#region Add
- public static void Add(this ItemContainer self, int configId, int count)
+ public static void Add(this PlayerItemContainer self, int configId, int count)
{
var item = ItemFactory.Create(self.Scene, configId, count);
self.Items.Add(item.Id, item);
@@ -110,7 +110,7 @@ public static class ItemContainerSystem
#region 结构转换
- public static List GetItemInfos(this ItemContainer self)
+ public static List GetItemInfos(this PlayerItemContainer self)
{
List ret = new List();
foreach (var (_, item) in self.Items)
@@ -121,7 +121,7 @@ public static class ItemContainerSystem
return ret;
}
- public static List GetGearInfos(this ItemContainer self)
+ public static List GetGearInfos(this PlayerItemContainer self)
{
List ret = new List();
diff --git a/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs b/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs
index f88a4f0..ecf7644 100644
--- a/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs
+++ b/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs
@@ -12,8 +12,6 @@ public sealed class PlayerManageComponentAwakeSystem : AwakeSystem { _ = self.CheckAutoSave(); });
}
}
@@ -27,8 +25,6 @@ public sealed class PlayerManageComponentDestroySystem : DestroySystem
+ /// 尝试获取或增加相关组件
+ ///
+ ///
+ ///
+ public static async FTask TryComponent(this Player player) where T : Entity, new()
{
- foreach (var (_, player) in self.Players)
+ if (player.GetComponent() == null)
{
- if (player.NeedSave)
+ var component = await player.Scene.World.DataBase.Query(player.Id, true);
+ if (component == null)
{
- await player.SaveImmediately();
+ //如果没有组件
+ player.AddComponent();
+ }
+ else
+ {
+ player.AddComponent(component);
}
}
}
#endregion
-
-
}
\ No newline at end of file
diff --git a/Hotfix/Game/Player/Helper/PlayerFactory.cs b/Hotfix/Game/Player/Helper/PlayerFactory.cs
index 3d2a611..ab31c7d 100644
--- a/Hotfix/Game/Player/Helper/PlayerFactory.cs
+++ b/Hotfix/Game/Player/Helper/PlayerFactory.cs
@@ -13,12 +13,10 @@ public static class PlayerFactory
///
///
/// ToKen令牌传递过来的aId
- /// 是否在创建的过程中保存到数据库
///
public static Player Create(Scene scene, long aId)
{
var player = Entity.Create(scene, aId, true, true);
- player.InitializeChildEntity();
return player;
}
}
\ No newline at end of file
diff --git a/Hotfix/Game/Player/Helper/PlayerHelper.cs b/Hotfix/Game/Player/Helper/PlayerHelper.cs
index 43e47ec..c2e1e4c 100644
--- a/Hotfix/Game/Player/Helper/PlayerHelper.cs
+++ b/Hotfix/Game/Player/Helper/PlayerHelper.cs
@@ -9,57 +9,9 @@ namespace NB.Game;
public static class PlayerHelper
{
#region MyRegion
-
- public static void InitializeChildEntity(this Player self)
- {
- if (self.Vip == null)
- {
- self.Vip = Entity.Create(self.Scene, true, true);
- }
-
- if (self.Wallet == null)
- {
- self.Wallet = Entity.Create(self.Scene, true, true);
- }
-
- if (self.ItemContainer == null)
- {
- self.ItemContainer = Entity.Create(self.Scene, true, true);
- }
-
- if (self.FishContainer == null)
- {
- self.FishContainer = Entity.Create(self.Scene, true, true);
- }
-
- if (self.SkillContainer == null)
- {
- self.SkillContainer = Entity.Create(self.Scene, true, true);
- }
-
- if (self.AchievementContainer == null)
- {
- self.AchievementContainer = Entity.Create(self.Scene, true, true);
- }
-
- // if (self.Statistics == null)
- // {
- // self.Statistics = Entity.Create(self.Scene, true, true);
- // self.Statistics.LoginTime = self.Statistics.CreateTime = TimeHelper.Now;
- // }
- }
-
- public static async FTask SaveImmediately(this Player self)
- {
- await self.Scene.World.DataBase.Save(self);
- self.NeedSave = false;
- Log.Info($"player id:{self.Id} save data to dataBase");
- }
-
+
public static async FTask Save(this Player self)
{
- self.NeedSave = true;
- self.NeedSaveTime = TimeHelper.Now + AppConfig.PlayerDataAutoSaveTime;
//先立马保存,后续做缓存
await self.Scene.World.DataBase.Save(self);
}
@@ -97,7 +49,7 @@ public static class PlayerHelper
public static async FTask Disconnect(this Player self)
{
// 保存该账号信息到数据库中。
- await SaveImmediately(self);
+ await Save(self);
// 在缓存中移除自己,并且执行自己的Dispose方法。
self.Scene.GetComponent().Remove(self.Id);
}
@@ -176,7 +128,6 @@ public static class PlayerHelper
var info = new RoleInfo();
info.BaseInfo = GetRoleBaseInfo(self);
info.Items = self.ItemContainer.GetItemInfos();
- info.Gears = self.ItemContainer.GetGearInfos();
info.RoleId = self.RouteId;
return info;
}