From 240bee00c394a0d567bc92826515a6b07dfdbe2b Mon Sep 17 00:00:00 2001
From: BobSong <605277374@qq.com>
Date: Mon, 15 Dec 2025 12:30:45 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Entity.csproj | 4 +
Entity/Fantasy.config | 14 ++--
Entity/Game/Item/Item.cs | 15 +++-
.../Map/Component/MapManageComponent.cs | 4 +-
.../Map/Component/RoomManageComponent.cs | 4 +-
Entity/{ => Game}/Map/Entity/Map.cs | 4 +-
Entity/{ => Game}/Map/Entity/MapRoom.cs | 5 +-
.../Map/Entity/MapUnitComponent.cs} | 36 ++++----
Entity/{ => Game}/Map/Entity/MapUnitGear.cs | 4 +-
Entity/Game/Player/Player.cs | 1 +
.../Generate/NetworkProtocol/GameMessage.cs | 55 ++++++++++++
Entity/Generate/NetworkProtocol/MapMessage.cs | 4 +-
.../Generate/NetworkProtocol/MapProtoData.cs | 14 +++-
.../Generate/NetworkProtocol/OuterOpcode.cs | 68 ++++++++-------
.../Generate/NetworkProtocol/RoomMessage.cs | 75 ++++++++++++++---
Entity/Generate/NetworkProtocol/RouteType.cs | 1 -
.../Map/Component/MapUnitManageComponent.cs | 8 --
.../Handler/G2Common_EnterRequestHandler.cs | 41 +++++----
.../Handler/G2Common_ExitRequestHandler.cs | 21 +++--
Hotfix/Common/Helper/SceneConfigHelper.cs | 4 -
.../C2Game_GetRoleInfoRequestHandler.cs | 3 +-
.../Handler/C2Game_RigChangeRequestHandler.cs | 6 ++
.../Handler/C2Game_UseItemRequestHandler.cs | 31 +++++++
Hotfix/Game/Item/Helper/ItemFactory.cs | 1 -
Hotfix/Game/Item/Helper/ItemHelper.cs | 29 ++++---
Hotfix/Game/Item/ItemSystem.cs | 3 +
.../Handler/C2Map_CreateRoomRequestHandler.cs | 21 +++--
.../Map/Handler/C2Map_LookHandler.cs | 23 +++--
.../Map/Handler/C2Map_MoveHandler.cs | 31 ++++---
.../C2Map_RolePropertyChangeHandler.cs | 17 ++--
.../Handler/C2Map_TakeItemRequestHandler.cs | 60 +++++++++++++
.../Inner/G2Map_EnterMapRequestHandler.cs | 28 +++++--
.../Inner/G2Map_ExitRoomRequestHandler.cs | 51 +++++++++++
Hotfix/{ => Game}/Map/Helper/MapFactory.cs | 2 +-
Hotfix/{ => Game}/Map/Helper/RoomHelper.cs | 3 +-
.../Map/System/MapManageComponentSystem.cs | 2 +-
Hotfix/{ => Game}/Map/System/MapRoomSystem.cs | 26 +++---
Hotfix/{ => Game}/Map/System/MapSystem.cs | 2 +-
Hotfix/Game/Map/System/MapUnitSystem.cs | 31 +++++++
.../Map/System/RoomManageComponentSystem.cs | 2 +-
.../Components/PlayerManageComponentSystem.cs | 1 +
Hotfix/Game/Player/Entity/PlayerSystem.cs | 55 ++++--------
.../Outer/C2G_EnterMapRequestHandler.cs | 8 +-
.../Outer/C2G_ExitRoomRequestHandler.cs | 2 +-
Hotfix/Gate/Helper/GateLoginHelper.cs | 4 +-
.../Inner/G2Map_ExitRoomRequestHandler.cs | 13 ---
Hotfix/Map/Helper/MapHelper.cs | 30 -------
Hotfix/Map/Helper/MapUnitFactory.cs | 19 -----
.../System/MapUnitManageComponentSystem.cs | 84 -------------------
Hotfix/Map/System/MapUnitSystem.cs | 70 ----------------
Hotfix/OnCreateSceneEvent.cs | 60 +++++++------
Tools/NetworkProtocol/Outer/GameMessage.proto | 2 +-
Tools/NetworkProtocol/Outer/MapMessage.proto | 15 +---
Tools/NetworkProtocol/Outer/RoomMessage.proto | 41 ++++++---
.../Outer/data/MapProtoData.proto | 14 ++--
Tools/NetworkProtocol/RouteType.Config | 3 +-
56 files changed, 649 insertions(+), 526 deletions(-)
rename Entity/{ => Game}/Map/Component/MapManageComponent.cs (59%)
rename Entity/{ => Game}/Map/Component/RoomManageComponent.cs (82%)
rename Entity/{ => Game}/Map/Entity/Map.cs (67%)
rename Entity/{ => Game}/Map/Entity/MapRoom.cs (86%)
rename Entity/{Map/Entity/MapUnit.cs => Game/Map/Entity/MapUnitComponent.cs} (60%)
rename Entity/{ => Game}/Map/Entity/MapUnitGear.cs (93%)
delete mode 100644 Entity/Map/Component/MapUnitManageComponent.cs
create mode 100644 Hotfix/Game/Handler/C2Game_UseItemRequestHandler.cs
rename Hotfix/{ => Game}/Map/Handler/C2Map_CreateRoomRequestHandler.cs (66%)
rename Hotfix/{ => Game}/Map/Handler/C2Map_LookHandler.cs (55%)
rename Hotfix/{ => Game}/Map/Handler/C2Map_MoveHandler.cs (55%)
rename Hotfix/{ => Game}/Map/Handler/C2Map_RolePropertyChangeHandler.cs (59%)
create mode 100644 Hotfix/Game/Map/Handler/C2Map_TakeItemRequestHandler.cs
rename Hotfix/{ => Game}/Map/Handler/Inner/G2Map_EnterMapRequestHandler.cs (68%)
create mode 100644 Hotfix/Game/Map/Handler/Inner/G2Map_ExitRoomRequestHandler.cs
rename Hotfix/{ => Game}/Map/Helper/MapFactory.cs (95%)
rename Hotfix/{ => Game}/Map/Helper/RoomHelper.cs (98%)
rename Hotfix/{ => Game}/Map/System/MapManageComponentSystem.cs (98%)
rename Hotfix/{ => Game}/Map/System/MapRoomSystem.cs (63%)
rename Hotfix/{ => Game}/Map/System/MapSystem.cs (92%)
create mode 100644 Hotfix/Game/Map/System/MapUnitSystem.cs
rename Hotfix/{ => Game}/Map/System/RoomManageComponentSystem.cs (99%)
delete mode 100644 Hotfix/Map/Handler/Inner/G2Map_ExitRoomRequestHandler.cs
delete mode 100644 Hotfix/Map/Helper/MapHelper.cs
delete mode 100644 Hotfix/Map/Helper/MapUnitFactory.cs
delete mode 100644 Hotfix/Map/System/MapUnitManageComponentSystem.cs
delete mode 100644 Hotfix/Map/System/MapUnitSystem.cs
diff --git a/Entity/Entity.csproj b/Entity/Entity.csproj
index 3641447..1155bae 100644
--- a/Entity/Entity.csproj
+++ b/Entity/Entity.csproj
@@ -18,4 +18,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/Entity/Fantasy.config b/Entity/Fantasy.config
index b50d8ab..14f6c58 100644
--- a/Entity/Fantasy.config
+++ b/Entity/Fantasy.config
@@ -65,13 +65,13 @@
networkProtocol=""
outerPort="0" innerPort="11051" />
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Entity/Game/Item/Item.cs b/Entity/Game/Item/Item.cs
index d70a420..9b371cb 100644
--- a/Entity/Game/Item/Item.cs
+++ b/Entity/Game/Item/Item.cs
@@ -8,7 +8,15 @@ public enum ItemBasicType
None,
Currency = 1,
Item = 2,
- Fish = 3,
+ Rod = 3,
+ Reel =4,
+ Bobber = 5,
+ Line = 6,
+ Bait = 7,
+ Lure = 8,
+ Hook = 9,
+ Weight = 10,
+ Feeder = 11,
}
public class Item : Entity
@@ -47,4 +55,9 @@ public class Item : Entity
/// 物品所属的容器
///
[BsonIgnore] PlayerItemContainerComponent Container;
+
+ ///
+ /// 正则使用中
+ ///
+ [BsonIgnore] public bool InUse;
}
\ No newline at end of file
diff --git a/Entity/Map/Component/MapManageComponent.cs b/Entity/Game/Map/Component/MapManageComponent.cs
similarity index 59%
rename from Entity/Map/Component/MapManageComponent.cs
rename to Entity/Game/Map/Component/MapManageComponent.cs
index 0af5b52..3b3cdd7 100644
--- a/Entity/Map/Component/MapManageComponent.cs
+++ b/Entity/Game/Map/Component/MapManageComponent.cs
@@ -1,8 +1,8 @@
using Fantasy.Entitas;
-namespace NB.Map;
+namespace NB.Game;
-public class MapManageComponent: Entity
+public class MapManageComponent : Entity
{
public readonly Dictionary Maps = new();
}
\ No newline at end of file
diff --git a/Entity/Map/Component/RoomManageComponent.cs b/Entity/Game/Map/Component/RoomManageComponent.cs
similarity index 82%
rename from Entity/Map/Component/RoomManageComponent.cs
rename to Entity/Game/Map/Component/RoomManageComponent.cs
index 4d193a5..b20f77f 100644
--- a/Entity/Map/Component/RoomManageComponent.cs
+++ b/Entity/Game/Map/Component/RoomManageComponent.cs
@@ -1,6 +1,6 @@
using Fantasy.Entitas;
-namespace NB.Map;
+namespace NB.Game;
public class RoomManageComponent : Entity
{
@@ -8,6 +8,4 @@ public class RoomManageComponent : Entity
public readonly PriorityQueue FreeIds = new();
public readonly HashSet InUseID = new();
-
- public string TestRoomCode;
}
\ No newline at end of file
diff --git a/Entity/Map/Entity/Map.cs b/Entity/Game/Map/Entity/Map.cs
similarity index 67%
rename from Entity/Map/Entity/Map.cs
rename to Entity/Game/Map/Entity/Map.cs
index 3bbc832..e10ed70 100644
--- a/Entity/Map/Entity/Map.cs
+++ b/Entity/Game/Map/Entity/Map.cs
@@ -1,6 +1,6 @@
using Fantasy.Entitas;
-namespace NB.Map;
+namespace NB.Game;
public class Map : Entity
{
@@ -12,5 +12,5 @@ public class Map : Entity
///
/// 地图玩家
///
- public Dictionary Units = new Dictionary();
+ public Dictionary Units = new Dictionary();
}
\ No newline at end of file
diff --git a/Entity/Map/Entity/MapRoom.cs b/Entity/Game/Map/Entity/MapRoom.cs
similarity index 86%
rename from Entity/Map/Entity/MapRoom.cs
rename to Entity/Game/Map/Entity/MapRoom.cs
index adaf556..88e2b0b 100644
--- a/Entity/Map/Entity/MapRoom.cs
+++ b/Entity/Game/Map/Entity/MapRoom.cs
@@ -1,7 +1,6 @@
using Fantasy.Entitas;
-using NB.Map;
-namespace NB.Map;
+namespace NB.Game;
///
/// 地图房间
@@ -26,7 +25,7 @@ public class MapRoom : Entity
///
/// 房间玩家
///
- public Dictionary Units = new Dictionary();
+ public Dictionary Units = new Dictionary();
///
/// 房主
diff --git a/Entity/Map/Entity/MapUnit.cs b/Entity/Game/Map/Entity/MapUnitComponent.cs
similarity index 60%
rename from Entity/Map/Entity/MapUnit.cs
rename to Entity/Game/Map/Entity/MapUnitComponent.cs
index a453728..a8261ae 100644
--- a/Entity/Map/Entity/MapUnit.cs
+++ b/Entity/Game/Map/Entity/MapUnitComponent.cs
@@ -1,19 +1,13 @@
-using Fantasy;
-using Fantasy.Entitas;
+using Fantasy.Entitas;
using Unity.Mathematics;
-namespace NB.Map;
+namespace NB.Game;
///
-/// 地图玩家单元
+///
///
-public class MapUnit : Entity
+public class MapUnitComponent : Entity
{
- ///
- /// 角色基础信息
- ///
- public RoleSimpleInfo Info;
-
///
/// 位置
///
@@ -24,20 +18,18 @@ public class MapUnit : Entity
///
public float3 Rotation;
- ///
- /// 当前所在地图id
- ///
- public int MapId;
-
- ///
- /// 当前所在的房间id
- ///
- public int RoomId;
-
- public long GateRouteId;
-
///
/// 钓组信息
///
public List Gears = new List();
+
+ ///
+ /// 房间Id
+ ///
+ public int RoomId;
+
+ ///
+ /// 地图id
+ ///
+ public int MapId;
}
\ No newline at end of file
diff --git a/Entity/Map/Entity/MapUnitGear.cs b/Entity/Game/Map/Entity/MapUnitGear.cs
similarity index 93%
rename from Entity/Map/Entity/MapUnitGear.cs
rename to Entity/Game/Map/Entity/MapUnitGear.cs
index 56f85e6..bcf7bfd 100644
--- a/Entity/Map/Entity/MapUnitGear.cs
+++ b/Entity/Game/Map/Entity/MapUnitGear.cs
@@ -1,7 +1,7 @@
using Fantasy.Entitas;
using Unity.Mathematics;
-namespace NB.Map;
+namespace NB.Game;
public enum MapGearState
{
@@ -18,7 +18,7 @@ public class MapUnitGear : Entity
///
/// 杆子
///
- public long Rod;
+ public long Item;
///
/// 杆子配件
diff --git a/Entity/Game/Player/Player.cs b/Entity/Game/Player/Player.cs
index bd2dbd6..483bea1 100644
--- a/Entity/Game/Player/Player.cs
+++ b/Entity/Game/Player/Player.cs
@@ -63,4 +63,5 @@ public sealed class Player : Entity
[BsonIgnore] public long SessionRunTimeId;
+
}
\ No newline at end of file
diff --git a/Entity/Generate/NetworkProtocol/GameMessage.cs b/Entity/Generate/NetworkProtocol/GameMessage.cs
index 9bf8583..275d181 100644
--- a/Entity/Generate/NetworkProtocol/GameMessage.cs
+++ b/Entity/Generate/NetworkProtocol/GameMessage.cs
@@ -85,6 +85,7 @@ namespace Fantasy
}
public override void Dispose()
{
+ ItemId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
#endif
@@ -94,6 +95,8 @@ namespace Fantasy
public uint OpCode() { return OuterOpcode.C2Game_UseItemRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
+ [ProtoMember(1)]
+ public long ItemId { get; set; }
}
///
/// 请求使用物品响应
@@ -509,5 +512,57 @@ namespace Fantasy
[ProtoMember(1)]
public List Awards = new List();
}
+ ///
+ /// /////////// ******** GM *******/////////////
+ ///
+ ///
+ /// 请求执行GM
+ ///
+ [ProtoContract]
+ public partial class C2Game_GMRequest : AMessage, ICustomRouteRequest
+ {
+ public static C2Game_GMRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Cmd = default;
+ Args = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public Game2C_GMResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2Game_GMRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ [ProtoMember(1)]
+ public string Cmd { get; set; }
+ [ProtoMember(2)]
+ public string Args { get; set; }
+ }
+ ///
+ /// 执行GM返回
+ ///
+ [ProtoContract]
+ public partial class Game2C_GMResponse : AMessage, ICustomRouteResponse
+ {
+ public static Game2C_GMResponse 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_GMResponse; }
+ [ProtoMember(1)]
+ public uint ErrorCode { get; set; }
+ }
}
diff --git a/Entity/Generate/NetworkProtocol/MapMessage.cs b/Entity/Generate/NetworkProtocol/MapMessage.cs
index f36fb38..738256b 100644
--- a/Entity/Generate/NetworkProtocol/MapMessage.cs
+++ b/Entity/Generate/NetworkProtocol/MapMessage.cs
@@ -39,7 +39,7 @@ namespace Fantasy
public Map2C_CreateRoomResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Map_CreateRoomRequest; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public int MapId { get; set; }
}
@@ -193,7 +193,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_ChangeMap; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public int MapId { get; set; }
[ProtoMember(2)]
diff --git a/Entity/Generate/NetworkProtocol/MapProtoData.cs b/Entity/Generate/NetworkProtocol/MapProtoData.cs
index 2578965..d3d5c33 100644
--- a/Entity/Generate/NetworkProtocol/MapProtoData.cs
+++ b/Entity/Generate/NetworkProtocol/MapProtoData.cs
@@ -99,25 +99,31 @@ namespace Fantasy
}
public override void Dispose()
{
- Rod = default;
- Rigs.Clear();
+ Item = default;
+ Binds.Clear();
Position = default;
Rotation = default;
Propertys.Clear();
+ InUse = default;
+ InHand = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
#endif
}
[ProtoMember(1)]
- public long Rod { get; set; }
+ public ItemInfo Item { get; set; }
[ProtoMember(2)]
- public List Rigs = new List();
+ public List Binds = new List();
[ProtoMember(3)]
public Vector3Info Position { get; set; }
[ProtoMember(4)]
public Vector3Info Rotation { get; set; }
[ProtoMember(5)]
public List Propertys = new List();
+ [ProtoMember(6)]
+ public bool InUse { get; set; }
+ [ProtoMember(7)]
+ public bool InHand { get; set; }
}
[ProtoContract]
public partial class UnitStateInfo : AMessage
diff --git a/Entity/Generate/NetworkProtocol/OuterOpcode.cs b/Entity/Generate/NetworkProtocol/OuterOpcode.cs
index e4d8a73..b4451ba 100644
--- a/Entity/Generate/NetworkProtocol/OuterOpcode.cs
+++ b/Entity/Generate/NetworkProtocol/OuterOpcode.cs
@@ -21,8 +21,10 @@ namespace Fantasy
public const uint C2Game_BuyRequest = 2281711384;
public const uint Game2C_BuyResponse = 2415929112;
public const uint Game2C_RewardNotify = 2147493651;
- public const uint C2Map_CreateRoomRequest = 2281711385;
- public const uint Map2C_CreateRoomResponse = 2415929113;
+ public const uint C2Game_GMRequest = 2281711385;
+ public const uint Game2C_GMResponse = 2415929113;
+ public const uint C2Map_CreateRoomRequest = 2281711386;
+ public const uint Map2C_CreateRoomResponse = 2415929114;
public const uint C2G_ExitRoomRequest = 268445457;
public const uint G2C_ExitRoomResponse = 402663185;
public const uint C2G_EnterMapRequest = 268445458;
@@ -33,10 +35,12 @@ namespace Fantasy
public const uint C2G_LoginRequest = 268445460;
public const uint G2C_LoginResponse = 402663188;
public const uint G2C_RepeatLogin = 134227729;
- public const uint C2Game_GetRoleInfoRequest = 2281711386;
- public const uint Game2C_GetRoleInfoResponse = 2415929114;
+ public const uint C2Game_GetRoleInfoRequest = 2281711387;
+ public const uint Game2C_GetRoleInfoResponse = 2415929115;
public const uint Map2C_RoleEnterRoomNotify = 2147493653;
public const uint Map2C_RoleExitRoomNotify = 2147493654;
+ public const uint C2Map_TakeItemRequest = 2281711388;
+ public const uint Map2C_TakeItemResponse = 2415929116;
public const uint C2Map_RolePropertyChange = 2147493655;
public const uint Map2C_RoleStateNotify = 2147493656;
public const uint Map2C_RoleGearChangeNotify = 2147493657;
@@ -45,37 +49,37 @@ namespace Fantasy
public const uint C2Map_Look = 2147493660;
public const uint Map2C_MoveNotify = 2147493661;
public const uint Map2C_LookeNotify = 2147493662;
- public const uint C2S_GetConversationsRequest = 2281711387;
- public const uint S2C_GetConversationsResponse = 2415929115;
- public const uint C2S_SendMailRequest = 2281711388;
- public const uint S2C_SendMailResponse = 2415929116;
- public const uint C2S_DeleteMailRequest = 2281711389;
- public const uint S2C_DeleteMailResponse = 2415929117;
+ public const uint C2S_GetConversationsRequest = 2281711389;
+ public const uint S2C_GetConversationsResponse = 2415929117;
+ public const uint C2S_SendMailRequest = 2281711390;
+ public const uint S2C_SendMailResponse = 2415929118;
+ public const uint C2S_DeleteMailRequest = 2281711391;
+ public const uint S2C_DeleteMailResponse = 2415929119;
public const uint S2C_HaveMail = 2147493663;
public const uint S2C_MailState = 2147493664;
- public const uint C2S_CreateChannelRequest = 2281711390;
- public const uint S2C_CreateChannelResponse = 2415929118;
- public const uint C2S_JoinChannelRequest = 2281711391;
- public const uint S2C_JoinChannelResponse = 2415929119;
- public const uint C2S_SendMessageRequest = 2281711392;
- public const uint S2C_SendMessageResponse = 2415929120;
+ public const uint C2S_CreateChannelRequest = 2281711392;
+ public const uint S2C_CreateChannelResponse = 2415929120;
+ public const uint C2S_JoinChannelRequest = 2281711393;
+ public const uint S2C_JoinChannelResponse = 2415929121;
+ public const uint C2S_SendMessageRequest = 2281711394;
+ public const uint S2C_SendMessageResponse = 2415929122;
public const uint S2C_Message = 2147493665;
- public const uint C2S_CreateClubRequest = 2281711393;
- public const uint S2C_CreateClubResponse = 2415929121;
- public const uint C2S_GetClubInfoRequest = 2281711394;
- public const uint S2C_GetClubInfoResponse = 2415929122;
- public const uint C2S_GetMemberListRequest = 2281711395;
- public const uint S2C_GetMemberListResponse = 2415929123;
- public const uint C2S_GetClubListRequest = 2281711396;
- public const uint S2C_GetClubListResponse = 2415929124;
- public const uint C2S_JoinClubRequest = 2281711397;
- public const uint S2C_JoinClubResponse = 2415929125;
- public const uint C2S_LeaveClubRequest = 2281711398;
- public const uint S2C_LeaveClubResponse = 2415929126;
- public const uint C2S_DissolveClubRequest = 2281711399;
- public const uint S2C_DissolveClubResponse = 2415929127;
- public const uint C2S_DisposeJoinRequest = 2281711400;
- public const uint S2C_DisposeJoinResponse = 2415929128;
+ public const uint C2S_CreateClubRequest = 2281711395;
+ public const uint S2C_CreateClubResponse = 2415929123;
+ public const uint C2S_GetClubInfoRequest = 2281711396;
+ public const uint S2C_GetClubInfoResponse = 2415929124;
+ public const uint C2S_GetMemberListRequest = 2281711397;
+ public const uint S2C_GetMemberListResponse = 2415929125;
+ public const uint C2S_GetClubListRequest = 2281711398;
+ public const uint S2C_GetClubListResponse = 2415929126;
+ public const uint C2S_JoinClubRequest = 2281711399;
+ public const uint S2C_JoinClubResponse = 2415929127;
+ public const uint C2S_LeaveClubRequest = 2281711400;
+ public const uint S2C_LeaveClubResponse = 2415929128;
+ public const uint C2S_DissolveClubRequest = 2281711401;
+ public const uint S2C_DissolveClubResponse = 2415929129;
+ public const uint C2S_DisposeJoinRequest = 2281711402;
+ public const uint S2C_DisposeJoinResponse = 2415929130;
public const uint S2C_ClubChange = 2147493666;
}
}
diff --git a/Entity/Generate/NetworkProtocol/RoomMessage.cs b/Entity/Generate/NetworkProtocol/RoomMessage.cs
index 41c37e0..15ab853 100644
--- a/Entity/Generate/NetworkProtocol/RoomMessage.cs
+++ b/Entity/Generate/NetworkProtocol/RoomMessage.cs
@@ -37,7 +37,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleEnterRoomNotify; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public MapUnitInfo Info { get; set; }
}
@@ -60,10 +60,65 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleExitRoomNotify; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
}
+ ///
+ /// 请求拿起物品
+ ///
+ [ProtoContract]
+ public partial class C2Map_TakeItemRequest : AMessage, ICustomRouteRequest
+ {
+ public static C2Map_TakeItemRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Id = default;
+ Task = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public Map2C_TakeItemResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2Map_TakeItemRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.GameRoute;
+ [ProtoMember(1)]
+ public int Id { get; set; }
+ [ProtoMember(2)]
+ public bool Task { get; set; }
+ }
+ ///
+ /// 请求拿起物品响应
+ ///
+ [ProtoContract]
+ public partial class Map2C_TakeItemResponse : AMessage, ICustomRouteResponse
+ {
+ public static Map2C_TakeItemResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Id = default;
+ Task = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.Map2C_TakeItemResponse; }
+ [ProtoMember(1)]
+ public int Id { get; set; }
+ [ProtoMember(2)]
+ public bool Task { get; set; }
+ [ProtoMember(3)]
+ public uint ErrorCode { get; set; }
+ }
[ProtoContract]
public partial class C2Map_RolePropertyChange : AMessage, ICustomRouteMessage
{
@@ -80,7 +135,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.C2Map_RolePropertyChange; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public List Propertys = new List();
}
@@ -104,7 +159,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleStateNotify; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -130,7 +185,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RoleGearChangeNotify; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -153,7 +208,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_RolePropertyChangeNotify; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -180,7 +235,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.C2Map_Move; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public Vector3Info Position { get; set; }
[ProtoMember(2)]
@@ -211,7 +266,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.C2Map_Look; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public Vector3Info Rotation { get; set; }
[ProtoMember(2)]
@@ -242,7 +297,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_MoveNotify; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
@@ -279,7 +334,7 @@ namespace Fantasy
}
public uint OpCode() { return OuterOpcode.Map2C_LookeNotify; }
[ProtoIgnore]
- public int RouteType => Fantasy.RouteType.MapRoute;
+ public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
diff --git a/Entity/Generate/NetworkProtocol/RouteType.cs b/Entity/Generate/NetworkProtocol/RouteType.cs
index 01cebe1..ec20017 100644
--- a/Entity/Generate/NetworkProtocol/RouteType.cs
+++ b/Entity/Generate/NetworkProtocol/RouteType.cs
@@ -6,6 +6,5 @@ namespace Fantasy
public const int GateRoute = 1001; // Gate
public const int SocialRoute = 1002; // Social
public const int GameRoute = 1003; // Game
- public const int MapRoute = 1004; // 地图
}
}
diff --git a/Entity/Map/Component/MapUnitManageComponent.cs b/Entity/Map/Component/MapUnitManageComponent.cs
deleted file mode 100644
index 260efe6..0000000
--- a/Entity/Map/Component/MapUnitManageComponent.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Fantasy.Entitas;
-
-namespace NB.Map;
-
-public class MapUnitManageComponent : Entity
-{
- public readonly Dictionary Units = new();
-}
\ No newline at end of file
diff --git a/Hotfix/Common/Handler/G2Common_EnterRequestHandler.cs b/Hotfix/Common/Handler/G2Common_EnterRequestHandler.cs
index 7aa9c4e..915d292 100644
--- a/Hotfix/Common/Handler/G2Common_EnterRequestHandler.cs
+++ b/Hotfix/Common/Handler/G2Common_EnterRequestHandler.cs
@@ -3,7 +3,6 @@ using Fantasy.Async;
using Fantasy.Network.Interface;
using NB.Chat;
using NB.Game;
-using NB.Map;
namespace NB.Common;
@@ -27,11 +26,11 @@ public class G2Common_EnterRequestHandler : RouteRPC();
- var account = await chatUnitManageComponent.Online(scene, request.AccountId, request.GateRouteId);
-
- if (account == null)
- {
- response.ErrorCode = ErrorCode.ErrServer;
- return;
- }
-
- response.UnitRouteId = account.RuntimeId;
- Log.Info($"登录到地图服成功,id={response.UnitRouteId}");
- }
+ // private async FTask RunMap(Scene scene, G2Common_EnterRequest request, G2Common_EnterResponse response)
+ // {
+ // // 在缓存中检查该账号是否存在
+ // var chatUnitManageComponent = scene.GetComponent();
+ // var account = await chatUnitManageComponent.Online(scene, request.AccountId, request.GateRouteId);
+ //
+ // if (account == null)
+ // {
+ // response.ErrorCode = ErrorCode.ErrServer;
+ // return;
+ // }
+ //
+ // response.UnitRouteId = account.RuntimeId;
+ // Log.Info($"登录到地图服成功,id={response.UnitRouteId}");
+ // }
}
\ No newline at end of file
diff --git a/Hotfix/Common/Handler/G2Common_ExitRequestHandler.cs b/Hotfix/Common/Handler/G2Common_ExitRequestHandler.cs
index b6abef0..45259bf 100644
--- a/Hotfix/Common/Handler/G2Common_ExitRequestHandler.cs
+++ b/Hotfix/Common/Handler/G2Common_ExitRequestHandler.cs
@@ -3,7 +3,6 @@ using Fantasy.Async;
using Fantasy.Network.Interface;
using NB.Chat;
using NB.Game;
-using NB.Map;
namespace NB.Common;
@@ -25,11 +24,11 @@ public class G2Common_ExitRequestHandler : RouteRPC
+{
+ protected override async FTask Run(Player entity, C2Game_UseItemRequest request, Game2C_UseItemResponse response,
+ Action reply)
+ {
+ var itemContainer = entity.GetComponent();
+ if (itemContainer == null)
+ {
+ response.ErrorCode = ErrorCode.ErrArgs;
+ return;
+ }
+
+ if (!itemContainer.Items.TryGetValue(request.ItemId, out var item))
+ {
+ response.ErrorCode = ErrorCode.ErrArgs;
+ return;
+ }
+
+ var itemType = ItemHelper.GetType(item.ConfigId);
+ if (itemType == ItemBasicType.Rod)
+ {
+ //鱼竿
+ }
+ }
+}
\ No newline at end of file
diff --git a/Hotfix/Game/Item/Helper/ItemFactory.cs b/Hotfix/Game/Item/Helper/ItemFactory.cs
index 09faab1..12d4209 100644
--- a/Hotfix/Game/Item/Helper/ItemFactory.cs
+++ b/Hotfix/Game/Item/Helper/ItemFactory.cs
@@ -1,6 +1,5 @@
using Fantasy;
using Fantasy.Entitas;
-using NB.Map;
namespace NB.Game;
diff --git a/Hotfix/Game/Item/Helper/ItemHelper.cs b/Hotfix/Game/Item/Helper/ItemHelper.cs
index fc75258..721c67c 100644
--- a/Hotfix/Game/Item/Helper/ItemHelper.cs
+++ b/Hotfix/Game/Item/Helper/ItemHelper.cs
@@ -4,17 +4,22 @@ public static class ItemHelper
{
public static ItemBasicType GetType(uint id)
{
- var type = (int)(id / 10000);
- if (type == 1)
- {
- return ItemBasicType.Currency;
- }
-
- if (type == 21)
- {
- return ItemBasicType.Fish;
- }
-
- return ItemBasicType.Item;
+ return (ItemBasicType)(id / 10000);
}
+
+ // public static ItemBasicType GetType(uint id)
+ // {
+ // var type = (int)(id / 10000);
+ // if (type == 1)
+ // {
+ // return ItemBasicType.Currency;
+ // }
+ //
+ // if (type == 21)
+ // {
+ // return ItemBasicType.Fish;
+ // }
+ //
+ // return ItemBasicType.Item;
+ // }
}
\ No newline at end of file
diff --git a/Hotfix/Game/Item/ItemSystem.cs b/Hotfix/Game/Item/ItemSystem.cs
index aec60f3..174a76d 100644
--- a/Hotfix/Game/Item/ItemSystem.cs
+++ b/Hotfix/Game/Item/ItemSystem.cs
@@ -18,6 +18,9 @@ public class ItemDestroySystem : DestroySystem-
public static class ItemSystem
{
+
+
+
public static ItemInfo ToItemInfo(this Item self)
{
return new ItemInfo()
diff --git a/Hotfix/Map/Handler/C2Map_CreateRoomRequestHandler.cs b/Hotfix/Game/Map/Handler/C2Map_CreateRoomRequestHandler.cs
similarity index 66%
rename from Hotfix/Map/Handler/C2Map_CreateRoomRequestHandler.cs
rename to Hotfix/Game/Map/Handler/C2Map_CreateRoomRequestHandler.cs
index e3c1f5f..f041928 100644
--- a/Hotfix/Map/Handler/C2Map_CreateRoomRequestHandler.cs
+++ b/Hotfix/Game/Map/Handler/C2Map_CreateRoomRequestHandler.cs
@@ -3,15 +3,22 @@ using Fantasy.Async;
using Fantasy.Entitas;
using Fantasy.Network.Interface;
-namespace NB.Map;
+namespace NB.Game;
-public class C2Map_CreateRoomRequestHandler : RouteRPC
+public class C2Map_CreateRoomRequestHandler : RouteRPC
{
- protected override async FTask Run(MapUnit entity, C2Map_CreateRoomRequest request,
+ protected override async FTask Run(Player entity, C2Map_CreateRoomRequest request,
Map2C_CreateRoomResponse response,
Action reply)
{
- if (entity.MapId != request.MapId)
+ var mapUnit = entity.GetComponent();
+ if (mapUnit == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ if (mapUnit.MapId != request.MapId)
{
response.ErrorCode = ErrorCode.MapCreateRoomNotEnter;
return;
@@ -31,12 +38,12 @@ public class C2Map_CreateRoomRequestHandler : RouteRPC
+public class C2Map_LookHandler : Route
{
- protected override async FTask Run(MapUnit entity, C2Map_Look message)
+ protected override async FTask Run(Player entity, C2Map_Look message)
{
+ var mapUnit = entity.GetComponent();
+ if (mapUnit == null)
+ {
+ // response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ var roomId = mapUnit.RoomId;
var roomManageComponent = entity.Scene.GetComponent();
- var roomId = entity.RoomId;
var room = roomManageComponent.Get(roomId);
if (room == null)
{
@@ -23,14 +30,14 @@ public class C2Map_LookHandler : Route
Timestamp = message.Timestamp
};
- entity.Rotation.x = message.Rotation.x;
- entity.Rotation.y = message.Rotation.y;
- entity.Rotation.z = message.Rotation.z;
+ // entity.Rotation.x = message.Rotation.x;
+ // entity.Rotation.y = message.Rotation.y;
+ // entity.Rotation.z = message.Rotation.z;
foreach (var (_, unit) in room.Units)
{
// if (unit.Id == entity.Id) continue;
- entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
+ entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
}
await FTask.CompletedTask;
diff --git a/Hotfix/Map/Handler/C2Map_MoveHandler.cs b/Hotfix/Game/Map/Handler/C2Map_MoveHandler.cs
similarity index 55%
rename from Hotfix/Map/Handler/C2Map_MoveHandler.cs
rename to Hotfix/Game/Map/Handler/C2Map_MoveHandler.cs
index 8b7dccd..a5cb4e3 100644
--- a/Hotfix/Map/Handler/C2Map_MoveHandler.cs
+++ b/Hotfix/Game/Map/Handler/C2Map_MoveHandler.cs
@@ -3,14 +3,21 @@ using Fantasy.Async;
using Fantasy.Helper;
using Fantasy.Network.Interface;
-namespace NB.Map;
+namespace NB.Game;
-public class C2Map_MoveHandler : Route
+public class C2Map_MoveHandler : Route
{
- protected override async FTask Run(MapUnit entity, C2Map_Move message)
+ protected override async FTask Run(Player entity, C2Map_Move message)
{
+ var mapUnit = entity.GetComponent();
+ if (mapUnit == null)
+ {
+ // response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
var roomManageComponent = entity.Scene.GetComponent();
- var roomId = entity.RoomId;
+ var roomId = mapUnit.RoomId;
var room = roomManageComponent.Get(roomId);
if (room == null)
{
@@ -27,18 +34,18 @@ public class C2Map_MoveHandler : Route
Timestamp = TimeHelper.Now
};
- entity.Position.x = message.Position.x;
- entity.Position.y = message.Position.y;
- entity.Position.z = message.Position.z;
-
- entity.Rotation.x = message.Rotation.x;
- entity.Rotation.y = message.Rotation.y;
- entity.Rotation.z = message.Rotation.z;
+ // entity.Position.x = message.Position.x;
+ // entity.Position.y = message.Position.y;
+ // entity.Position.z = message.Position.z;
+ //
+ // entity.Rotation.x = message.Rotation.x;
+ // entity.Rotation.y = message.Rotation.y;
+ // entity.Rotation.z = message.Rotation.z;
foreach (var (_, unit) in room.Units)
{
// if (unit.Id == entity.Id) continue;
- entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
+ entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
}
diff --git a/Hotfix/Map/Handler/C2Map_RolePropertyChangeHandler.cs b/Hotfix/Game/Map/Handler/C2Map_RolePropertyChangeHandler.cs
similarity index 59%
rename from Hotfix/Map/Handler/C2Map_RolePropertyChangeHandler.cs
rename to Hotfix/Game/Map/Handler/C2Map_RolePropertyChangeHandler.cs
index 6a456e9..d00d3b0 100644
--- a/Hotfix/Map/Handler/C2Map_RolePropertyChangeHandler.cs
+++ b/Hotfix/Game/Map/Handler/C2Map_RolePropertyChangeHandler.cs
@@ -2,14 +2,21 @@
using Fantasy.Async;
using Fantasy.Network.Interface;
-namespace NB.Map;
+namespace NB.Game;
-public class C2Map_RolePropertyChangeHandler : Route
+public class C2Map_RolePropertyChangeHandler : Route
{
- protected override async FTask Run(MapUnit entity, C2Map_RolePropertyChange message)
+ protected override async FTask Run(Player entity, C2Map_RolePropertyChange message)
{
+ var mapUnit = entity.GetComponent();
+ if (mapUnit == null)
+ {
+ // response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
var roomManageComponent = entity.Scene.GetComponent();
- var roomId = entity.RoomId;
+ var roomId = mapUnit.RoomId;
var room = roomManageComponent.Get(roomId);
if (room == null)
{
@@ -26,7 +33,7 @@ public class C2Map_RolePropertyChangeHandler : Route
+{
+ protected override async FTask Run(Player entity, C2Map_TakeItemRequest request, Map2C_TakeItemResponse response,
+ Action reply)
+ {
+ var itemContainer = entity.GetComponent();
+ if (itemContainer == null)
+ {
+ response.ErrorCode = ErrorCode.ErrArgs;
+ return;
+ }
+
+ if (!itemContainer.Items.TryGetValue(request.Id, out var item))
+ {
+ response.ErrorCode = ErrorCode.ErrArgs;
+ return;
+ }
+
+ var mapUnit = entity.GetComponent();
+ if (mapUnit == null)
+ {
+ response.ErrorCode = ErrorCode.ErrArgs;
+ return;
+ }
+
+ var itemType = ItemHelper.GetType(item.ConfigId);
+ if (itemType == ItemBasicType.Rod)
+ {
+ itemContainer.Binding.TryGetValue(item.Id, out var itemRod);
+ //鱼竿
+ var itemGear = mapUnit.GetOrAddItemGear(item);
+ if (itemRod != null)
+ {
+ itemGear.Rings.AddRange(itemRod);
+ }
+ }
+
+
+ var roomManageComponent = entity.Scene.GetComponent();
+ var roomId = mapUnit.RoomId;
+ var room = roomManageComponent.Get(roomId);
+ if (room != null)
+ {
+ var notifyMessage = new Map2C_RoleGearChangeNotify();
+ // notifyMessage
+ // return;
+ foreach (var (_, unit) in room.Units)
+ {
+ // if (unit.Id == entity.Id) continue;
+ entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Hotfix/Map/Handler/Inner/G2Map_EnterMapRequestHandler.cs b/Hotfix/Game/Map/Handler/Inner/G2Map_EnterMapRequestHandler.cs
similarity index 68%
rename from Hotfix/Map/Handler/Inner/G2Map_EnterMapRequestHandler.cs
rename to Hotfix/Game/Map/Handler/Inner/G2Map_EnterMapRequestHandler.cs
index d256b14..8199610 100644
--- a/Hotfix/Map/Handler/Inner/G2Map_EnterMapRequestHandler.cs
+++ b/Hotfix/Game/Map/Handler/Inner/G2Map_EnterMapRequestHandler.cs
@@ -1,8 +1,9 @@
using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;
+using NB.Game;
-namespace NB.Map.Inner;
+namespace NB.Game.Inner;
///
/// 请求进入地图
@@ -19,32 +20,43 @@ public class G2Map_EnterMapRequestHandler : RouteRPC();
+ var mapUnitManage = entity.GetComponent();
if (mapUnitManage == null)
{
response.ErrorCode = ErrorCode.ErrServer;
return;
}
- var mapUnit = mapUnitManage.Get(request.AccountId);
+ var player = mapUnitManage.Get(request.AccountId);
+ if (player == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ var mapUnit = player.GetComponent();
if (mapUnit == null)
{
response.ErrorCode = ErrorCode.ErrServer;
return;
}
-
//进入地图
- response.ErrorCode = await mapUnit.EnterMap(request.MapId);
- if (response.ErrorCode != 0)
+ var mapManageComponent = entity.GetComponent();
+ var map = mapManageComponent.Get(request.MapId);
+ if (map == null)
{
+ response.ErrorCode = ErrorCode.MapIdError;
return;
}
+ mapUnit.MapId = request.MapId;
+
+
// 如果没有房间代码,则只是进入地图,直接返回,不执行后续逻辑
if (string.IsNullOrEmpty(request.RoomCode))
{
- response.Units = [mapUnit.ToMapUnitInfo()];
+ response.Units = [player.ToMapUnitInfo()];
return;
}
@@ -60,7 +72,7 @@ public class G2Map_EnterMapRequestHandler : RouteRPC
+{
+ protected override async FTask Run(Scene entity, G2Map_ExitRoomRequest request, Map2G_ExiRoomResponse response,
+ Action reply)
+ {
+ var roomManageComponent = entity.GetComponent();
+ if (roomManageComponent == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ var mapUnitManage = entity.GetComponent();
+ if (mapUnitManage == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ var player = mapUnitManage.Get(request.AccountId);
+ if (player == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ var mapUnit = player.GetComponent();
+ if (mapUnit == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ var room = roomManageComponent.Get(mapUnit.RoomId);
+ if (room == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ player.RemoveComponent();
+ response.ErrorCode = await room.Enter(player);
+ // room.Units.Remove(mapUnit.Id);
+ }
+}
\ No newline at end of file
diff --git a/Hotfix/Map/Helper/MapFactory.cs b/Hotfix/Game/Map/Helper/MapFactory.cs
similarity index 95%
rename from Hotfix/Map/Helper/MapFactory.cs
rename to Hotfix/Game/Map/Helper/MapFactory.cs
index dad3195..09221c4 100644
--- a/Hotfix/Map/Helper/MapFactory.cs
+++ b/Hotfix/Game/Map/Helper/MapFactory.cs
@@ -1,7 +1,7 @@
using Fantasy;
using Fantasy.Entitas;
-namespace NB.Map;
+namespace NB.Game;
public class MapFactory
{
diff --git a/Hotfix/Map/Helper/RoomHelper.cs b/Hotfix/Game/Map/Helper/RoomHelper.cs
similarity index 98%
rename from Hotfix/Map/Helper/RoomHelper.cs
rename to Hotfix/Game/Map/Helper/RoomHelper.cs
index cf6f85b..806ab7c 100644
--- a/Hotfix/Map/Helper/RoomHelper.cs
+++ b/Hotfix/Game/Map/Helper/RoomHelper.cs
@@ -1,6 +1,6 @@
using System.Text;
-namespace NB.Map;
+namespace NB.Game;
public static class RoomHelper
{
@@ -65,5 +65,4 @@ public static class RoomHelper
}
#endregion
-
}
\ No newline at end of file
diff --git a/Hotfix/Map/System/MapManageComponentSystem.cs b/Hotfix/Game/Map/System/MapManageComponentSystem.cs
similarity index 98%
rename from Hotfix/Map/System/MapManageComponentSystem.cs
rename to Hotfix/Game/Map/System/MapManageComponentSystem.cs
index 900bc2c..26c26bb 100644
--- a/Hotfix/Map/System/MapManageComponentSystem.cs
+++ b/Hotfix/Game/Map/System/MapManageComponentSystem.cs
@@ -1,7 +1,7 @@
using Fantasy.Entitas;
using Fantasy.Entitas.Interface;
-namespace NB.Map;
+namespace NB.Game;
public class MapManageComponentDestroySystem : DestroySystem
{
diff --git a/Hotfix/Map/System/MapRoomSystem.cs b/Hotfix/Game/Map/System/MapRoomSystem.cs
similarity index 63%
rename from Hotfix/Map/System/MapRoomSystem.cs
rename to Hotfix/Game/Map/System/MapRoomSystem.cs
index 332bcc0..5aec035 100644
--- a/Hotfix/Map/System/MapRoomSystem.cs
+++ b/Hotfix/Game/Map/System/MapRoomSystem.cs
@@ -2,7 +2,7 @@
using Fantasy.Async;
using Fantasy.Entitas.Interface;
-namespace NB.Map;
+namespace NB.Game;
public class MapRoomDestroySystem : DestroySystem
{
@@ -18,21 +18,21 @@ public class MapRoomDestroySystem : DestroySystem
public static class MapRoomSystem
{
- public static async FTask Enter(this MapRoom self, MapUnit unit)
+ public static async FTask Enter(this MapRoom self, Player unit)
{
self.Units.TryAdd(unit.Id, unit);
- var notifyMessage = new Map2C_RoleEnterRoomNotify()
- {
- Info = unit.ToMapUnitInfo(),
- };
-
- foreach (var (_, roomUnit) in self.Units)
- {
- // if (roomUnit.Id == unit.Id) continue;
- // 同步其他客户端
- self.Scene.NetworkMessagingComponent.SendInnerRoute(roomUnit.GateRouteId, notifyMessage);
- }
+ // var notifyMessage = new Map2C_RoleEnterRoomNotify()
+ // {
+ // Info = unit.ToMapUnitInfo(),
+ // };
+ //
+ // foreach (var (_, roomUnit) in self.Units)
+ // {
+ // // if (roomUnit.Id == unit.Id) continue;
+ // // 同步其他客户端
+ // self.Scene.NetworkMessagingComponent.SendInnerRoute(roomUnit.GateRouteId, notifyMessage);
+ // }
await FTask.CompletedTask;
return ErrorCode.Successful;
diff --git a/Hotfix/Map/System/MapSystem.cs b/Hotfix/Game/Map/System/MapSystem.cs
similarity index 92%
rename from Hotfix/Map/System/MapSystem.cs
rename to Hotfix/Game/Map/System/MapSystem.cs
index a27e3d5..eaba19b 100644
--- a/Hotfix/Map/System/MapSystem.cs
+++ b/Hotfix/Game/Map/System/MapSystem.cs
@@ -1,6 +1,6 @@
using Fantasy.Entitas.Interface;
-namespace NB.Map;
+namespace NB.Game;
public class MapDestroySystem : DestroySystem