From 7a93c0f8f1950a191f80a2c943fb94ff4b2e2600 Mon Sep 17 00:00:00 2001
From: bob <605277374@qq.com>
Date: Fri, 8 Aug 2025 18:21:11 +0800
Subject: [PATCH] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E9=A2=91=E9=81=93=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../NetworkProtocol/Inner/InnerMessage.proto | 5 ++-
.../NetworkProtocol/Outer/data/Account.proto | 10 +++++
.../Outer/data/GlobalData.proto | 7 ++--
Entity/Chat/ChatChannel.cs | 40 +++++++++++++++++++
Entity/Chat/ChatChannelCenterComponent.cs | 2 +-
Entity/Chat/ChatChannelComponent.cs | 11 -----
Entity/Chat/ChatContentBase.cs | 25 ++++++++++++
Entity/Chat/ChatMessageRecord.cs | 4 ++
Entity/Chat/ChatUnit.cs | 15 +++++++
Entity/Generate/NetworkProtocol/Account.cs | 32 +++++++++++++++
Entity/Generate/NetworkProtocol/GlobalData.cs | 7 +++-
.../Generate/NetworkProtocol/InnerMessage.cs | 9 +++--
.../C2Chat_SendMessageRequestHandler.cs | 2 +-
.../Handler/G2Chat_EnterRequestHandler.cs | 10 +++--
Hotfix/Chat/Helper/ChatChannelHelper.cs | 39 ------------------
Hotfix/Chat/Helper/ChatSceneHelper.cs | 34 +++++++++++-----
.../ChatChannelCenterComponentSystem.cs | 12 ++++--
.../System/ChatUnitManageComponentSystem.cs | 18 ++++++---
.../Handler/G2Game_EnterRequestHandler.cs | 1 +
Hotfix/Game/Helper/GameSceneHelper.cs | 8 ++--
Hotfix/Game/Player/Helper/PlayerHelper.cs | 40 +++++++++++++++++++
Hotfix/Gate/Helper/GateLoginHelper.cs | 16 ++++----
Hotfix/Hotfix.csproj | 4 ++
23 files changed, 256 insertions(+), 95 deletions(-)
create mode 100644 Entity/Chat/ChatChannel.cs
delete mode 100644 Entity/Chat/ChatChannelComponent.cs
create mode 100644 Entity/Chat/ChatContentBase.cs
create mode 100644 Entity/Chat/ChatMessageRecord.cs
delete mode 100644 Hotfix/Chat/Helper/ChatChannelHelper.cs
diff --git a/Config/NetworkProtocol/Inner/InnerMessage.proto b/Config/NetworkProtocol/Inner/InnerMessage.proto
index 9054eff..1db896c 100644
--- a/Config/NetworkProtocol/Inner/InnerMessage.proto
+++ b/Config/NetworkProtocol/Inner/InnerMessage.proto
@@ -10,13 +10,14 @@ message G2Game_EnterRequest // IRouteRequest,Game2G_EnterResponse
message Game2G_EnterResponse // IRouteResponse
{
int64 RoleRouteId = 1; //角色实体的路由id
+ RoleSimpleInfo RoleInfo = 2; //角色信息
}
///通知游戏服角色进入该聊天服
message G2Chat_EnterRequest // IRouteRequest,Game2G_EnterResponse
{
- int64 AccountId = 1; //账号id
+ RoleSimpleInfo Role = 1; //角色信息
int64 GateRouteId = 2;//网关路由地址
}
@@ -27,5 +28,5 @@ message Chat2G_EnterResponse // IRouteResponse
message Chat2G_ChatMessage // IRouteMessage
{
- string Message = 1; //聊天内容
+ ChatMessageInfo Message = 1; //聊天内容
}
\ No newline at end of file
diff --git a/Config/NetworkProtocol/Outer/data/Account.proto b/Config/NetworkProtocol/Outer/data/Account.proto
index 45b0d48..b5b710f 100644
--- a/Config/NetworkProtocol/Outer/data/Account.proto
+++ b/Config/NetworkProtocol/Outer/data/Account.proto
@@ -43,6 +43,16 @@ message RoleInfo
repeated SkillInfo Skills = 8; //技能信息
}
+/// 角色信息
+message RoleSimpleInfo
+{
+ int64 RoleId = 1;
+ string NickName = 2; //昵称
+ string Head = 3; //头像
+ string Country = 4; //国家
+ int32 Level = 5; //等级
+}
+
/// VIP信息
message VipInfo
{
diff --git a/Config/NetworkProtocol/Outer/data/GlobalData.proto b/Config/NetworkProtocol/Outer/data/GlobalData.proto
index ebd2f3d..9c73aa1 100644
--- a/Config/NetworkProtocol/Outer/data/GlobalData.proto
+++ b/Config/NetworkProtocol/Outer/data/GlobalData.proto
@@ -9,7 +9,8 @@ message ChatUserInfo
message ChatMessageInfo
{
- int32 Type = 1; //消息类型
- ChatUserInfo Trigger = 2; //发送者
- repeated string Content = 3; //内容
+ int32 Type = 1; //消息类型
+ int32 Source = 2; //消息来源
+ ChatUserInfo Trigger = 3; //触发者
+ repeated byte Content = 4; //内容
}
\ No newline at end of file
diff --git a/Entity/Chat/ChatChannel.cs b/Entity/Chat/ChatChannel.cs
new file mode 100644
index 0000000..494397e
--- /dev/null
+++ b/Entity/Chat/ChatChannel.cs
@@ -0,0 +1,40 @@
+using Fantasy.Entitas;
+using MongoDB.Bson.Serialization.Attributes;
+
+namespace NB.Chat;
+
+
+///
+/// 聊天频道实体
+///
+public class ChatChannel : Entity
+{
+ [BsonElement("type")] public uint ChannelType;
+
+ ///
+ /// 频道Id
+ ///
+ [BsonElement("cid")] public long ChannelId;
+
+ ///
+ /// 频道名称
+ ///
+ [BsonElement("name")] public string Name = "";
+
+ ///
+ /// 创建者
+ ///
+ [BsonElement("cr")] public long Creator;
+
+ ///
+ /// 创建时间
+ ///
+ [BsonElement("ct")] public long CreateTime;
+
+ ///
+ /// 频道地区
+ ///
+ [BsonElement("region")] public int Region;
+
+ [BsonElement("ids")] public readonly HashSet Units = new HashSet();
+}
\ No newline at end of file
diff --git a/Entity/Chat/ChatChannelCenterComponent.cs b/Entity/Chat/ChatChannelCenterComponent.cs
index 67650a9..c3fb9f6 100644
--- a/Entity/Chat/ChatChannelCenterComponent.cs
+++ b/Entity/Chat/ChatChannelCenterComponent.cs
@@ -7,5 +7,5 @@ namespace NB.Chat;
///
public class ChatChannelCenterComponent : Entity
{
- public readonly Dictionary Channels = new Dictionary();
+ public readonly Dictionary Channels = new Dictionary();
}
\ No newline at end of file
diff --git a/Entity/Chat/ChatChannelComponent.cs b/Entity/Chat/ChatChannelComponent.cs
deleted file mode 100644
index 3be133b..0000000
--- a/Entity/Chat/ChatChannelComponent.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Fantasy.Entitas;
-
-namespace NB.Chat;
-
-///
-/// 聊天频道实体
-///
-public class ChatChannelComponent : Entity
-{
- public readonly HashSet Units = new HashSet();
-}
\ No newline at end of file
diff --git a/Entity/Chat/ChatContentBase.cs b/Entity/Chat/ChatContentBase.cs
new file mode 100644
index 0000000..058088a
--- /dev/null
+++ b/Entity/Chat/ChatContentBase.cs
@@ -0,0 +1,25 @@
+namespace NB.Chat;
+
+[Serializable]
+public abstract class ChatContentData
+{
+}
+
+[Serializable]
+public class ChatContentNormal : ChatContentData
+{
+ public string Content = "";
+}
+
+[Serializable]
+public class ChatContentFished : ChatContentData
+{
+ public long Id;
+ public int Weight;
+ public int Type;
+}
+
+[Serializable]
+public class ChatContentRecord : ChatContentData
+{
+}
\ No newline at end of file
diff --git a/Entity/Chat/ChatMessageRecord.cs b/Entity/Chat/ChatMessageRecord.cs
new file mode 100644
index 0000000..0e5fa5c
--- /dev/null
+++ b/Entity/Chat/ChatMessageRecord.cs
@@ -0,0 +1,4 @@
+using Fantasy.Entitas;
+
+namespace NB.Chat;
+
diff --git a/Entity/Chat/ChatUnit.cs b/Entity/Chat/ChatUnit.cs
index 6d9da62..a6f8ae4 100644
--- a/Entity/Chat/ChatUnit.cs
+++ b/Entity/Chat/ChatUnit.cs
@@ -6,6 +6,16 @@ public sealed class ChatUnit : Entity
{
public long GateRouteId;
+ public long RoleId;
+
+ public string NickName = string.Empty;
+
+ public string Head = string.Empty;
+
+ public string Country = string.Empty;
+
+ public int Level;
+
public override void Dispose()
{
if (IsDisposed)
@@ -13,7 +23,12 @@ public sealed class ChatUnit : Entity
return;
}
+ RoleId = 0;
GateRouteId = 0;
+ NickName = string.Empty;
+ Head = string.Empty;
+ Country = string.Empty;
+ Level = 0;
base.Dispose();
}
}
\ No newline at end of file
diff --git a/Entity/Generate/NetworkProtocol/Account.cs b/Entity/Generate/NetworkProtocol/Account.cs
index ce1db38..ea3c8f8 100644
--- a/Entity/Generate/NetworkProtocol/Account.cs
+++ b/Entity/Generate/NetworkProtocol/Account.cs
@@ -151,6 +151,38 @@ namespace Fantasy
public List Skills = new List();
}
///
+ /// 角色信息
+ ///
+ [ProtoContract]
+ public partial class RoleSimpleInfo : AMessage, IProto
+ {
+ public static RoleSimpleInfo Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ RoleId = default;
+ NickName = default;
+ Head = default;
+ Country = default;
+ Level = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoMember(1)]
+ public long RoleId { get; set; }
+ [ProtoMember(2)]
+ public string NickName { get; set; }
+ [ProtoMember(3)]
+ public string Head { get; set; }
+ [ProtoMember(4)]
+ public string Country { get; set; }
+ [ProtoMember(5)]
+ public int Level { get; set; }
+ }
+ ///
/// VIP信息
///
[ProtoContract]
diff --git a/Entity/Generate/NetworkProtocol/GlobalData.cs b/Entity/Generate/NetworkProtocol/GlobalData.cs
index 02ceddc..80a4367 100644
--- a/Entity/Generate/NetworkProtocol/GlobalData.cs
+++ b/Entity/Generate/NetworkProtocol/GlobalData.cs
@@ -47,6 +47,7 @@ namespace Fantasy
public override void Dispose()
{
Type = default;
+ Source = default;
Trigger = default;
Content.Clear();
#if FANTASY_NET || FANTASY_UNITY
@@ -56,8 +57,10 @@ namespace Fantasy
[ProtoMember(1)]
public int Type { get; set; }
[ProtoMember(2)]
- public ChatUserInfo Trigger { get; set; }
+ public int Source { get; set; }
[ProtoMember(3)]
- public List Content = new List();
+ public ChatUserInfo Trigger { get; set; }
+ [ProtoMember(4)]
+ public List Content = new List();
}
}
diff --git a/Entity/Generate/NetworkProtocol/InnerMessage.cs b/Entity/Generate/NetworkProtocol/InnerMessage.cs
index 4c8c1e8..c2ee871 100644
--- a/Entity/Generate/NetworkProtocol/InnerMessage.cs
+++ b/Entity/Generate/NetworkProtocol/InnerMessage.cs
@@ -54,6 +54,7 @@ namespace Fantasy
{
ErrorCode = default;
RoleRouteId = default;
+ RoleInfo = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
#endif
@@ -62,6 +63,8 @@ namespace Fantasy
[ProtoMember(1)]
public long RoleRouteId { get; set; }
[ProtoMember(2)]
+ public RoleSimpleInfo RoleInfo { get; set; }
+ [ProtoMember(3)]
public uint ErrorCode { get; set; }
}
///
@@ -76,7 +79,7 @@ namespace Fantasy
}
public override void Dispose()
{
- AccountId = default;
+ Role = default;
GateRouteId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
@@ -86,7 +89,7 @@ namespace Fantasy
public Game2G_EnterResponse ResponseType { get; set; }
public uint OpCode() { return InnerOpcode.G2Chat_EnterRequest; }
[ProtoMember(1)]
- public long AccountId { get; set; }
+ public RoleSimpleInfo Role { get; set; }
[ProtoMember(2)]
public long GateRouteId { get; set; }
}
@@ -127,6 +130,6 @@ namespace Fantasy
}
public uint OpCode() { return InnerOpcode.Chat2G_ChatMessage; }
[ProtoMember(1)]
- public string Message { get; set; }
+ public ChatMessageInfo Message { get; set; }
}
}
diff --git a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs b/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs
index 410b843..c50520b 100644
--- a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs
+++ b/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs
@@ -10,7 +10,7 @@ public sealed class
protected override async FTask Run(ChatUnit chatUnit, C2Chat_SendMessageRequest request,
Caht2C_SendMessageResponse response, Action reply)
{
- ChatSceneHelper.Broadcast(chatUnit.Scene, request.Message);
+ // ChatSceneHelper.Broadcast(chatUnit.Scene, request.Message);
await FTask.CompletedTask;
}
}
\ No newline at end of file
diff --git a/Hotfix/Chat/Handler/G2Chat_EnterRequestHandler.cs b/Hotfix/Chat/Handler/G2Chat_EnterRequestHandler.cs
index f3a6b0a..ad840e1 100644
--- a/Hotfix/Chat/Handler/G2Chat_EnterRequestHandler.cs
+++ b/Hotfix/Chat/Handler/G2Chat_EnterRequestHandler.cs
@@ -5,16 +5,18 @@ using NB.Game;
namespace NB.Chat;
-public class G2Chat_EnterRequestHandler: RouteRPC
+public class G2Chat_EnterRequestHandler : RouteRPC
{
protected override async FTask Run(Scene scene, G2Chat_EnterRequest request, Chat2G_EnterResponse response,
Action reply)
{
- Log.Debug($"收到 G2Chat_EnterRequestHandler {request.AccountId}");
-
+ var roleId = request.Role.RoleId;
+ Log.Debug($"收到 G2Chat_EnterRequestHandler {roleId}");
+
+
// 在缓存中检查该账号是否存在
var chatUnitManageComponent = scene.GetComponent();
- var account = await chatUnitManageComponent.Online(scene, request.AccountId, request.GateRouteId);
+ var account = await chatUnitManageComponent.Online(scene, request.Role, request.GateRouteId);
response.RoleRouteId = account.RuntimeId;
await FTask.CompletedTask;
diff --git a/Hotfix/Chat/Helper/ChatChannelHelper.cs b/Hotfix/Chat/Helper/ChatChannelHelper.cs
deleted file mode 100644
index dd33966..0000000
--- a/Hotfix/Chat/Helper/ChatChannelHelper.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using Fantasy;
-
-namespace NB.Chat;
-
-public static class ChatChannelHelper
-{
- ///
- /// 申请一个频道
- ///
- ///
- ///
- ///
- public static ChatChannelComponent Apply(Scene scene, long channelId)
- {
- return scene.GetComponent().Apply(channelId);
- }
-
- ///
- /// 尝试获取一个频道
- ///
- ///
- ///
- ///
- ///
- public static bool TryGet(Scene scene, long channelId, out ChatChannelComponent? channel)
- {
- return scene.GetComponent().TryGet(channelId, out channel);
- }
-
- ///
- /// 解散频道
- ///
- ///
- ///
- public static void Disband(Scene scene, long channelId)
- {
- scene.GetComponent().Disband(channelId);
- }
-}
\ No newline at end of file
diff --git a/Hotfix/Chat/Helper/ChatSceneHelper.cs b/Hotfix/Chat/Helper/ChatSceneHelper.cs
index c322d38..477ac98 100644
--- a/Hotfix/Chat/Helper/ChatSceneHelper.cs
+++ b/Hotfix/Chat/Helper/ChatSceneHelper.cs
@@ -6,17 +6,29 @@ namespace NB.Chat;
public static class ChatSceneHelper
{
+ #region 消息发送
+
///
- /// 广播消息
+ /// 广播记录更新
+ ///
+ ///
+ ///
+ public static void BroadcastRecord(Scene scene, ChatContentRecord record)
+ {
+
+ }
+
+
+ ///
+ /// 广播消息给所有人
///
///
///
- public static void Broadcast(Scene scene, string message)
+ public static void Broadcast(Scene scene, ChatMessageInfo message)
{
Log.Info("广播消息===");
//发送给所有Gate服务器,让Gate转发给其他客户端
var gateConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Gate);
-
var sendMessage = new Chat2G_ChatMessage()
{
Message = message
@@ -29,7 +41,12 @@ public static class ChatSceneHelper
}
}
- public static async FTask Online(Scene scene, long accountID, long gateRuntimeId)
+ #endregion
+
+
+ #region 上线下线
+
+ public static async FTask Online(Scene scene, RoleSimpleInfo roleSimple, long gateRuntimeId)
{
var gameSceneConfig = GetSceneConfig();
var gameRouteId = gameSceneConfig.RouteId;
@@ -37,7 +54,7 @@ public static class ChatSceneHelper
var gameResponse = (Chat2G_EnterResponse)await scene.NetworkMessagingComponent.CallInnerRoute(
gameRouteId, new G2Chat_EnterRequest()
{
- AccountId = accountID,
+ Role = roleSimple,
GateRouteId = gateRuntimeId
});
@@ -48,14 +65,13 @@ public static class ChatSceneHelper
return gameResponse.RoleRouteId;
}
-
+
private static SceneConfig GetSceneConfig()
{
var gameSceneConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Chat);
return gameSceneConfigs.First();
}
-
-
-
+
+ #endregion
}
\ No newline at end of file
diff --git a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs b/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs
index a51c84c..c6ae5dd 100644
--- a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs
+++ b/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs
@@ -1,23 +1,27 @@
using Fantasy.Entitas;
+using Fantasy.Helper;
namespace NB.Chat;
public static class ChatChannelCenterComponentSystem
{
///
- /// 申请
+ /// 申请创建一个频道
///
///
+ ///
///
///
- public static ChatChannelComponent Apply(this ChatChannelCenterComponent self, long channelId)
+ public static ChatChannel Apply(this ChatChannelCenterComponent self, ChatUnit unit, long channelId)
{
if (self.Channels.TryGetValue(channelId, out var channel))
{
return channel;
}
- channel = Entity.Create(self.Scene, channelId, true, true);
+ channel = Entity.Create(self.Scene, channelId, true, true);
+ channel.Creator = unit.RoleId;
+ channel.CreateTime = TimeHelper.Now;
self.Channels.Add(channelId, channel);
return channel;
}
@@ -29,7 +33,7 @@ public static class ChatChannelCenterComponentSystem
///
///
///
- public static bool TryGet(this ChatChannelCenterComponent self, long channelId, out ChatChannelComponent? channel)
+ public static bool TryGet(this ChatChannelCenterComponent self, long channelId, out ChatChannel? channel)
{
return self.Channels.TryGetValue(channelId, out channel);
}
diff --git a/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs b/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs
index 62c26fa..af69c5d 100644
--- a/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs
+++ b/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs
@@ -13,21 +13,29 @@ public static class ChatUnitManageComponentSystem
///
///
///
- ///
+ ///
///
- public static async FTask Online(this ChatUnitManageComponent self, Scene scene, long accountId,
+ public static async FTask Online(this ChatUnitManageComponent self, Scene scene, RoleSimpleInfo roleSimpleInfo,
long gateRouteId)
{
+ var accountId = roleSimpleInfo.RoleId;
if (!self.TryGet(accountId, out var account))
{
account = ChatUnitFactory.Create(scene, accountId);
self.Add(account);
}
- account.GateRouteId = gateRouteId;
-
+ if (account != null)
+ {
+ account.GateRouteId = gateRouteId;
+ account.RoleId = accountId;
+ account.Head = roleSimpleInfo.Head;
+ account.Level = roleSimpleInfo.Level;
+ account.NickName = roleSimpleInfo.NickName;
+ account.Country = roleSimpleInfo.Country;
+ }
+
await FTask.CompletedTask;
-
return account;
}
diff --git a/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs b/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs
index 5aa93d1..0b0134b 100644
--- a/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs
+++ b/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs
@@ -23,6 +23,7 @@ public class G2Game_EnterRequestHandler : RouteRPC Online(Scene scene, long accountID, long gateRuntimeId)
+ public static async FTask<(long, RoleSimpleInfo?)> Online(Scene scene, long accountID, long gateRuntimeId)
{
var gameSceneConfig = GetSceneConfig();
var gameRouteId = gameSceneConfig.RouteId;
@@ -29,9 +29,9 @@ public static class GameSceneHelper
if (gameResponse.ErrorCode != 0)
{
- return 0;
+ return (0, null);
}
-
- return gameResponse.RoleRouteId;
+
+ return (gameResponse.RoleRouteId, gameResponse.RoleInfo);
}
}
\ No newline at end of file
diff --git a/Hotfix/Game/Player/Helper/PlayerHelper.cs b/Hotfix/Game/Player/Helper/PlayerHelper.cs
index fd5aade..fbd39c2 100644
--- a/Hotfix/Game/Player/Helper/PlayerHelper.cs
+++ b/Hotfix/Game/Player/Helper/PlayerHelper.cs
@@ -8,6 +8,8 @@ namespace NB.Game;
public static class PlayerHelper
{
+ #region MyRegion
+
public static void InitializeChildEntity(this Player self)
{
if (self.Basic == null)
@@ -141,6 +143,11 @@ public static class PlayerHelper
account.SetTimeout(timeOut, account.Disconnect);
}
+ #endregion
+
+
+ #region 结构转换
+
///
/// 获得GameAccountInfo
///
@@ -158,4 +165,37 @@ public static class PlayerHelper
LoginTime = self.Statistics.LoginTime
};
}
+
+ public static RoleSimpleInfo GetRoleSimpleInfo(this Player self)
+ {
+ return new RoleSimpleInfo()
+ {
+ RoleId = self.Id,
+ NickName = self.Basic.NickName,
+ Head = self.Basic.Head,
+ Country = self.Basic.Country,
+ Level = self.Basic.Level
+ };
+ }
+
+ public static RoleInfo GetRoleInfo(this Player self)
+ {
+ var info = new RoleInfo();
+ info.BaseInfo = GetRoleBaseInfo(self);
+ return info;
+ }
+
+ public static RoleBaseInfo GetRoleBaseInfo(this Player self)
+ {
+ return new RoleBaseInfo()
+ {
+ NickName = self.Basic.NickName,
+ Head = self.Basic.Head,
+ Country = self.Basic.Country,
+ Level = self.Basic.Level,
+ Exp = self.Basic.Exp,
+ };
+ }
+
+ #endregion
}
\ No newline at end of file
diff --git a/Hotfix/Gate/Helper/GateLoginHelper.cs b/Hotfix/Gate/Helper/GateLoginHelper.cs
index b7e4e6d..5571076 100644
--- a/Hotfix/Gate/Helper/GateLoginHelper.cs
+++ b/Hotfix/Gate/Helper/GateLoginHelper.cs
@@ -43,22 +43,25 @@ public static class GateLoginHelper
//安排游戏服务器,并通知进入
- var gameRouteId = await GameSceneHelper.Online(session.Scene, gateUnit.AccountID, session.RuntimeId);
- if (gameRouteId <= 0)
+ var (gameRouteId, roleSimpleInfo) =
+ await GameSceneHelper.Online(session.Scene, gateUnit.AccountID, session.RuntimeId);
+ if (gameRouteId <= 0 || roleSimpleInfo == null)
{
return ErrorCode.OnlineSceneFailed;
}
+
Log.Info($"连接游戏服成功,gameRouteId:{gameRouteId}");
routeComponent.AddAddress(RouteType.GameRoute, gameRouteId);
gateUnit.GameSceneRouteId = gameRouteId;
-
- // //安排进入的聊天服
- var chatRouteId = await ChatSceneHelper.Online(session.Scene, gateUnit.AccountID, session.RuntimeId);
+
+ //安排进入的聊天服
+ var chatRouteId = await ChatSceneHelper.Online(session.Scene, roleSimpleInfo, session.RuntimeId);
if (chatRouteId <= 0)
{
return ErrorCode.OnlineSceneFailed;
}
+
routeComponent.AddAddress(RouteType.ChatRoute, chatRouteId);
gateUnit.ChatSceneRouteId = chatRouteId;
Log.Info($"连接聊天服成功,gameRouteId:{gameRouteId}");
@@ -66,7 +69,7 @@ public static class GateLoginHelper
}
#endregion
-
+
#region 下线
///
@@ -82,5 +85,4 @@ public static class GateLoginHelper
}
#endregion
-
}
\ No newline at end of file
diff --git a/Hotfix/Hotfix.csproj b/Hotfix/Hotfix.csproj
index 2707d36..efcebd9 100644
--- a/Hotfix/Hotfix.csproj
+++ b/Hotfix/Hotfix.csproj
@@ -12,4 +12,8 @@
+
+
+
+