服务合并
This commit is contained in:
@@ -57,14 +57,6 @@
|
||||
networkProtocol=""
|
||||
outerPort="0" innerPort="11031" />
|
||||
|
||||
<scene id="1006"
|
||||
processConfigId="1"
|
||||
worldConfigId="1"
|
||||
sceneRuntimeMode="MultiThread"
|
||||
sceneTypeString="Social"
|
||||
networkProtocol=""
|
||||
outerPort="0" innerPort="11051" />
|
||||
|
||||
<!-- <scene id="1007" -->
|
||||
<!-- processConfigId="1" -->
|
||||
<!-- worldConfigId="1" -->
|
||||
|
||||
@@ -2,6 +2,7 @@ using Fantasy.Entitas;
|
||||
using Fantasy.Helper;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson.Serialization.Options;
|
||||
using NB.Chat;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
@@ -64,4 +65,7 @@ public sealed class Player : Entity
|
||||
|
||||
[BsonIgnore] public long SessionRunTimeId;
|
||||
|
||||
|
||||
[BsonIgnore] public readonly Dictionary<long, ChatChannelComponent> Channels = new();
|
||||
[BsonIgnore] public readonly Dictionary<int, long> SendTime = new Dictionary<int, long>();
|
||||
}
|
||||
33
Entity/Game/Social/SocialUnit.cs
Normal file
33
Entity/Game/Social/SocialUnit.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
// using Fantasy;
|
||||
// using Fantasy.Entitas;
|
||||
//
|
||||
// namespace NB.Chat;
|
||||
//
|
||||
// public sealed class SocialUnit : Entity
|
||||
// {
|
||||
// public long GateRouteId;
|
||||
//
|
||||
// public RoleSimpleInfo Role;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 当前所在地图
|
||||
// /// </summary>
|
||||
// public long MapId;
|
||||
//
|
||||
//
|
||||
// public readonly Dictionary<long, ChatChannelComponent> Channels = new();
|
||||
// public readonly Dictionary<int, long> SendTime = new Dictionary<int, long>();
|
||||
//
|
||||
//
|
||||
// public override void Dispose()
|
||||
// {
|
||||
// if (IsDisposed)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// GateRouteId = 0;
|
||||
// Role = null;
|
||||
// base.Dispose();
|
||||
// }
|
||||
// }
|
||||
17
Entity/Game/Social/SocialUnitManageComponent.cs
Normal file
17
Entity/Game/Social/SocialUnitManageComponent.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
// using System.Collections.Generic;
|
||||
// using Fantasy;
|
||||
// using Fantasy.DataStructure.Collection;
|
||||
// using Fantasy.Entitas;
|
||||
//
|
||||
// namespace NB.Chat;
|
||||
//
|
||||
// public class SocialUnitManageComponent : Entity
|
||||
// {
|
||||
// public readonly Dictionary<long, SocialUnit> Units = new();
|
||||
//
|
||||
// // public List<MailBox>
|
||||
// // /// <summary>
|
||||
// // /// 不在线消息缓存
|
||||
// // /// </summary>
|
||||
// // public readonly OneToManyList<long, ChatMessageInfo> NotSendMessage = new();
|
||||
// }
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,13 +27,13 @@ namespace Fantasy
|
||||
public const uint Game2C_RewardNotify = 2147493651;
|
||||
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 C2Game_CreateRoomRequest = 2281711386;
|
||||
public const uint Game2C_CreateRoomResponse = 2415929114;
|
||||
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 = 2147493652;
|
||||
public const uint Game2C_ChangeMap = 2147493652;
|
||||
public const uint C2A_LoginRequest = 268445459;
|
||||
public const uint A2C_LoginResponse = 402663187;
|
||||
public const uint C2G_LoginRequest = 268445460;
|
||||
@@ -41,52 +41,49 @@ namespace Fantasy
|
||||
public const uint G2C_RepeatLogin = 134227729;
|
||||
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;
|
||||
public const uint Map2C_RolePropertyChangeNotify = 2147493658;
|
||||
public const uint C2Map_Move = 2147493659;
|
||||
public const uint C2Map_Look = 2147493660;
|
||||
public const uint Map2C_MoveNotify = 2147493661;
|
||||
public const uint Map2C_LookeNotify = 2147493662;
|
||||
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 C2Chat_SendMessageRequest = 2281711392;
|
||||
public const uint Chat2C_SendMessageResponse = 2415929120;
|
||||
public const uint Chat2C_Message = 2147493665;
|
||||
public const uint C2S_CreateChannelRequest = 2281711393;
|
||||
public const uint S2C_CreateChannelResponse = 2415929121;
|
||||
public const uint C2S_JoinChannelRequest = 2281711394;
|
||||
public const uint S2C_JoinChannelResponse = 2415929122;
|
||||
public const uint C2S_SendMessageRequest = 2281711395;
|
||||
public const uint S2C_SendMessageResponse = 2415929123;
|
||||
public const uint S2C_Message = 2147493666;
|
||||
public const uint C2S_CreateClubRequest = 2281711396;
|
||||
public const uint S2C_CreateClubResponse = 2415929124;
|
||||
public const uint C2S_GetClubInfoRequest = 2281711397;
|
||||
public const uint S2C_GetClubInfoResponse = 2415929125;
|
||||
public const uint C2S_GetMemberListRequest = 2281711398;
|
||||
public const uint S2C_GetMemberListResponse = 2415929126;
|
||||
public const uint C2S_GetClubListRequest = 2281711399;
|
||||
public const uint S2C_GetClubListResponse = 2415929127;
|
||||
public const uint C2S_JoinClubRequest = 2281711400;
|
||||
public const uint S2C_JoinClubResponse = 2415929128;
|
||||
public const uint C2S_LeaveClubRequest = 2281711401;
|
||||
public const uint S2C_LeaveClubResponse = 2415929129;
|
||||
public const uint C2S_DissolveClubRequest = 2281711402;
|
||||
public const uint S2C_DissolveClubResponse = 2415929130;
|
||||
public const uint C2S_DisposeJoinRequest = 2281711403;
|
||||
public const uint S2C_DisposeJoinResponse = 2415929131;
|
||||
public const uint S2C_ClubChange = 2147493667;
|
||||
public const uint Game2C_RoleEnterRoomNotify = 2147493653;
|
||||
public const uint Game2C_RoleExitRoomNotify = 2147493654;
|
||||
public const uint C2Game_TakeItemRequest = 2281711388;
|
||||
public const uint Game2C_TakeItemResponse = 2415929116;
|
||||
public const uint C2Game_RolePropertyChange = 2147493655;
|
||||
public const uint Game2C_RoleStateNotify = 2147493656;
|
||||
public const uint Game2C_RoleGearChangeNotify = 2147493657;
|
||||
public const uint Game2C_RolePropertyChangeNotify = 2147493658;
|
||||
public const uint C2Game_Move = 2147493659;
|
||||
public const uint C2Game_Look = 2147493660;
|
||||
public const uint Game2C_MoveNotify = 2147493661;
|
||||
public const uint Game2C_LookeNotify = 2147493662;
|
||||
public const uint C2Game_GetConversationsRequest = 2281711389;
|
||||
public const uint Game2C_GetConversationsResponse = 2415929117;
|
||||
public const uint C2Game_SendMailRequest = 2281711390;
|
||||
public const uint Game2C_SendMailResponse = 2415929118;
|
||||
public const uint C2Game_DeleteMailRequest = 2281711391;
|
||||
public const uint Game2C_DeleteMailResponse = 2415929119;
|
||||
public const uint Game2C_HaveMail = 2147493663;
|
||||
public const uint Game2C_MailState = 2147493664;
|
||||
public const uint C2Game_SendMessageRequest = 2281711392;
|
||||
public const uint Game2C_SendMessageResponse = 2415929120;
|
||||
public const uint Game2C_Message = 2147493665;
|
||||
public const uint C2Game_CreateChannelRequest = 2281711393;
|
||||
public const uint Game2C_CreateChannelResponse = 2415929121;
|
||||
public const uint C2Game_JoinChannelRequest = 2281711394;
|
||||
public const uint Game2C_JoinChannelResponse = 2415929122;
|
||||
public const uint C2Game_CreateClubRequest = 2281711395;
|
||||
public const uint Game2C_CreateClubResponse = 2415929123;
|
||||
public const uint C2Game_GetClubInfoRequest = 2281711396;
|
||||
public const uint Game2C_GetClubInfoResponse = 2415929124;
|
||||
public const uint C2Game_GetMemberListRequest = 2281711397;
|
||||
public const uint Game2C_GetMemberListResponse = 2415929125;
|
||||
public const uint C2Game_GetClubListRequest = 2281711398;
|
||||
public const uint Game2C_GetClubListResponse = 2415929126;
|
||||
public const uint C2Game_JoinClubRequest = 2281711399;
|
||||
public const uint Game2C_JoinClubResponse = 2415929127;
|
||||
public const uint C2Game_LeaveClubRequest = 2281711400;
|
||||
public const uint Game2C_LeaveClubResponse = 2415929128;
|
||||
public const uint C2Game_DissolveClubRequest = 2281711401;
|
||||
public const uint Game2C_DissolveClubResponse = 2415929129;
|
||||
public const uint C2Game_DisposeJoinRequest = 2281711402;
|
||||
public const uint Game2C_DisposeJoinResponse = 2415929130;
|
||||
public const uint Game2C_ClubChange = 2147493666;
|
||||
}
|
||||
}
|
||||
@@ -8,15 +8,13 @@ namespace Fantasy
|
||||
public static partial class RouteType
|
||||
{
|
||||
public const int GateRoute = 1001; // Gate
|
||||
public const int SocialRoute = 1002; // Social
|
||||
public const int GameRoute = 1003; // Game
|
||||
public const int GameRoute = 1002; // Game
|
||||
|
||||
public static IEnumerable<int> RoamingTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return GateRoute;
|
||||
yield return SocialRoute;
|
||||
yield return GameRoute;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public sealed class SocialUnit : Entity
|
||||
{
|
||||
public long GateRouteId;
|
||||
|
||||
public RoleSimpleInfo Role;
|
||||
|
||||
/// <summary>
|
||||
/// 当前所在地图
|
||||
/// </summary>
|
||||
public long MapId;
|
||||
|
||||
|
||||
public readonly Dictionary<long, ChatChannelComponent> Channels = new();
|
||||
public readonly Dictionary<int, long> SendTime = new Dictionary<int, long>();
|
||||
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
if (IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GateRouteId = 0;
|
||||
Role = null;
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.DataStructure.Collection;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class SocialUnitManageComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<long, SocialUnit> Units = new();
|
||||
|
||||
// public List<MailBox>
|
||||
// /// <summary>
|
||||
// /// 不在线消息缓存
|
||||
// /// </summary>
|
||||
// public readonly OneToManyList<long, ChatMessageInfo> NotSendMessage = new();
|
||||
}
|
||||
@@ -4,7 +4,6 @@ using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Chat;
|
||||
using NB.Game;
|
||||
using NBF.Social;
|
||||
|
||||
namespace NB.Common;
|
||||
|
||||
@@ -23,14 +22,9 @@ public class G2Common_EnterRequestHandler : AddressRPC<Scene, G2Common_EnterRequ
|
||||
|
||||
break;
|
||||
}
|
||||
case SceneType.Social:
|
||||
{
|
||||
await RunSocial(scene, request, response);
|
||||
break;
|
||||
}
|
||||
// case SceneType.Map:
|
||||
// case SceneType.Social:
|
||||
// {
|
||||
// await RunMap(scene, request, response);
|
||||
// await RunSocial(scene, request, response);
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
@@ -53,21 +47,21 @@ public class G2Common_EnterRequestHandler : AddressRPC<Scene, G2Common_EnterRequ
|
||||
Log.Info($"登录到游戏服成功,id={response.UnitRouteId}");
|
||||
}
|
||||
|
||||
private async FTask RunSocial(Scene scene, G2Common_EnterRequest request, G2Common_EnterResponse response)
|
||||
{
|
||||
// 在缓存中检查该账号是否存在
|
||||
var chatUnitManageComponent = scene.GetComponent<SocialUnitManageComponent>();
|
||||
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 RunSocial(Scene scene, G2Common_EnterRequest request, G2Common_EnterResponse response)
|
||||
// {
|
||||
// // 在缓存中检查该账号是否存在
|
||||
// var chatUnitManageComponent = scene.GetComponent<SocialUnitManageComponent>();
|
||||
// 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)
|
||||
// {
|
||||
|
||||
@@ -4,7 +4,6 @@ using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Chat;
|
||||
using NB.Game;
|
||||
using NBF.Social;
|
||||
|
||||
namespace NB.Common;
|
||||
|
||||
@@ -21,11 +20,11 @@ public class G2Common_ExitRequestHandler : AddressRPC<Scene, G2Common_ExitReques
|
||||
|
||||
break;
|
||||
}
|
||||
case SceneType.Social:
|
||||
{
|
||||
await RunSocial(scene, request, response);
|
||||
break;
|
||||
}
|
||||
// case SceneType.Social:
|
||||
// {
|
||||
// await RunSocial(scene, request, response);
|
||||
// break;
|
||||
// }
|
||||
// case SceneType.Map:
|
||||
// {
|
||||
// await RunMap(scene, request, response);
|
||||
@@ -44,13 +43,13 @@ public class G2Common_ExitRequestHandler : AddressRPC<Scene, G2Common_ExitReques
|
||||
Log.Info("退出游戏服成功==");
|
||||
}
|
||||
|
||||
private async FTask RunSocial(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response)
|
||||
{
|
||||
// 在缓存中检查该账号是否存在
|
||||
var chatUnitManageComponent = scene.GetComponent<SocialUnitManageComponent>();
|
||||
await chatUnitManageComponent.Offline(scene, request.AccountId, request.GateRouteId);
|
||||
Log.Info("退出聊天服成功==");
|
||||
}
|
||||
// private async FTask RunSocial(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response)
|
||||
// {
|
||||
// // 在缓存中检查该账号是否存在
|
||||
// var chatUnitManageComponent = scene.GetComponent<SocialUnitManageComponent>();
|
||||
// await chatUnitManageComponent.Offline(scene, request.AccountId, request.GateRouteId);
|
||||
// Log.Info("退出聊天服成功==");
|
||||
// }
|
||||
|
||||
// private async FTask RunMap(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response)
|
||||
// {
|
||||
|
||||
@@ -13,10 +13,6 @@ public static class SceneConfigHelper
|
||||
{
|
||||
sceneType = SceneType.Game;
|
||||
}
|
||||
else if (routeType == RouteType.SocialRoute)
|
||||
{
|
||||
sceneType = SceneType.Social;
|
||||
}
|
||||
else if (routeType == RouteType.GateRoute)
|
||||
{
|
||||
sceneType = SceneType.Gate;
|
||||
|
||||
@@ -6,10 +6,10 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_CreateRoomRequestHandler : AddressRPC<Player, C2Map_CreateRoomRequest, Map2C_CreateRoomResponse>
|
||||
public class C2Map_CreateRoomRequestHandler : AddressRPC<Player, C2Game_CreateRoomRequest, Game2C_CreateRoomResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_CreateRoomRequest request,
|
||||
Map2C_CreateRoomResponse response,
|
||||
protected override async FTask Run(Player entity, C2Game_CreateRoomRequest request,
|
||||
Game2C_CreateRoomResponse response,
|
||||
Action reply)
|
||||
{
|
||||
var mapUnit = entity.GetComponent<MapUnitComponent>();
|
||||
|
||||
@@ -4,9 +4,9 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_LookHandler : Address<Player, C2Map_Look>
|
||||
public class C2Map_LookHandler : Address<Player, C2Game_Look>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_Look message)
|
||||
protected override async FTask Run(Player entity, C2Game_Look message)
|
||||
{
|
||||
var mapUnit = entity.GetComponent<MapUnitComponent>();
|
||||
if (mapUnit == null)
|
||||
@@ -23,7 +23,7 @@ public class C2Map_LookHandler : Address<Player, C2Map_Look>
|
||||
return;
|
||||
}
|
||||
|
||||
var notifyMessage = new Map2C_LookeNotify()
|
||||
var notifyMessage = new Game2C_LookeNotify()
|
||||
{
|
||||
Id = entity.Id,
|
||||
Rotation = message.Rotation,
|
||||
|
||||
@@ -5,9 +5,9 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_MoveHandler : Address<Player, C2Map_Move>
|
||||
public class C2Map_MoveHandler : Address<Player, C2Game_Move>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_Move message)
|
||||
protected override async FTask Run(Player entity, C2Game_Move message)
|
||||
{
|
||||
var mapUnit = entity.GetComponent<MapUnitComponent>();
|
||||
if (mapUnit == null)
|
||||
@@ -24,7 +24,7 @@ public class C2Map_MoveHandler : Address<Player, C2Map_Move>
|
||||
return;
|
||||
}
|
||||
// var mapUnitManageComponent = entity.Scene.GetComponent<MapUnitManageComponent>();
|
||||
var notifyMessage = new Map2C_MoveNotify()
|
||||
var notifyMessage = new Game2C_MoveNotify()
|
||||
{
|
||||
Id = entity.Id,
|
||||
Position = message.Position,
|
||||
|
||||
@@ -4,9 +4,9 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_RolePropertyChangeHandler : Address<Player, C2Map_RolePropertyChange>
|
||||
public class C2Map_RolePropertyChangeHandler : Address<Player, C2Game_RolePropertyChange>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_RolePropertyChange message)
|
||||
protected override async FTask Run(Player entity, C2Game_RolePropertyChange message)
|
||||
{
|
||||
var mapUnit = entity.GetComponent<MapUnitComponent>();
|
||||
if (mapUnit == null)
|
||||
@@ -23,7 +23,7 @@ public class C2Map_RolePropertyChangeHandler : Address<Player, C2Map_RolePropert
|
||||
return;
|
||||
}
|
||||
|
||||
var notifyMessage = new Map2C_RolePropertyChangeNotify()
|
||||
var notifyMessage = new Game2C_RolePropertyChangeNotify()
|
||||
{
|
||||
Id = entity.Id,
|
||||
Propertys = message.Propertys,
|
||||
|
||||
@@ -5,9 +5,9 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_TakeItemRequestHandler : AddressRPC<Player, C2Map_TakeItemRequest, Map2C_TakeItemResponse>
|
||||
public class C2Map_TakeItemRequestHandler : AddressRPC<Player, C2Game_TakeItemRequest, Game2C_TakeItemResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_TakeItemRequest request, Map2C_TakeItemResponse response,
|
||||
protected override async FTask Run(Player entity, C2Game_TakeItemRequest request, Game2C_TakeItemResponse response,
|
||||
Action reply)
|
||||
{
|
||||
var itemContainer = entity.GetComponent<PlayerItemContainerComponent>();
|
||||
@@ -48,7 +48,7 @@ public class C2Map_TakeItemRequestHandler : AddressRPC<Player, C2Map_TakeItemReq
|
||||
var room = roomManageComponent.Get(roomId);
|
||||
if (room != null)
|
||||
{
|
||||
var notifyMessage = new Map2C_RoleGearChangeNotify();
|
||||
var notifyMessage = new Game2C_RoleGearChangeNotify();
|
||||
// notifyMessage
|
||||
// return;
|
||||
foreach (var (_, unit) in room.Units)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// using Fantasy;
|
||||
// using Fantasy.Async;
|
||||
// using Fantasy.Network.Interface;
|
||||
//
|
||||
// namespace NB.Chat;
|
||||
//
|
||||
// public sealed class Other2Chat_ChatMessageHandler : Address<SocialUnit, Other2Chat_ChatMessage>
|
||||
// {
|
||||
// protected override async FTask Run(SocialUnit chatUnit, Other2Chat_ChatMessage message)
|
||||
// {
|
||||
// var result = ChatSceneHelper.Distribution(chatUnit, message.ChatInfoTree, false);
|
||||
//
|
||||
// if (result != 0)
|
||||
// {
|
||||
// Log.Warning($"Other2Chat_ChatMessageHandler: Distribution failed, result: {result}");
|
||||
// }
|
||||
//
|
||||
// await FTask.CompletedTask;
|
||||
// }
|
||||
// }
|
||||
@@ -1,12 +1,13 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Game;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public sealed class C2Chat_SendMessageRequestHandler : AddressRPC<SocialUnit, C2Chat_SendMessageRequest, Chat2C_SendMessageResponse>
|
||||
public sealed class C2Chat_SendMessageRequestHandler : AddressRPC<Player, C2Game_SendMessageRequest, Game2C_SendMessageResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit chatUnit, C2Chat_SendMessageRequest request, Chat2C_SendMessageResponse response, Action reply)
|
||||
protected override async FTask Run(Player chatUnit, C2Game_SendMessageRequest request, Game2C_SendMessageResponse response, Action reply)
|
||||
{
|
||||
response.ErrorCode = ChatSceneHelper.Distribution(chatUnit, request.ChatInfoTree);
|
||||
await FTask.CompletedTask;
|
||||
@@ -13,11 +13,11 @@ public static class ChatHelper
|
||||
/// <param name="tree"></param>
|
||||
public static void SendChatMessage(Scene scene, long chatUnitRouteId, ChatInfoTree tree)
|
||||
{
|
||||
if (scene.SceneType == SceneType.Social)
|
||||
{
|
||||
Log.Warning("ChatHelper.SendChatMessage: scene is not a chat scene.");
|
||||
return;
|
||||
}
|
||||
// if (scene.SceneType == SceneType.Social)
|
||||
// {
|
||||
// Log.Warning("ChatHelper.SendChatMessage: scene is not a chat scene.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
var other2ChatChatMessage = new Other2Chat_ChatMessage()
|
||||
{
|
||||
@@ -2,7 +2,7 @@ using System.Threading.Channels;
|
||||
using Fantasy;
|
||||
using Fantasy.Helper;
|
||||
using Fantasy.Platform.Net;
|
||||
using NBF.Social;
|
||||
using NB.Game;
|
||||
|
||||
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
|
||||
@@ -21,7 +21,7 @@ public static class ChatSceneHelper
|
||||
/// <param name="tree"></param>
|
||||
/// <param name="isCheckSendTime"></param>
|
||||
/// <returns></returns>
|
||||
public static uint Distribution(SocialUnit chatUnit, ChatInfoTree tree, bool isCheckSendTime = true)
|
||||
public static uint Distribution(Player chatUnit, ChatInfoTree tree, bool isCheckSendTime = true)
|
||||
{
|
||||
var result = Condition(chatUnit, tree, isCheckSendTime);
|
||||
|
||||
@@ -60,7 +60,7 @@ public static class ChatSceneHelper
|
||||
/// <param name="tree"></param>
|
||||
/// <param name="isCheckSendTime"></param>
|
||||
/// <returns></returns>
|
||||
private static uint Condition(SocialUnit chatUnit, ChatInfoTree tree, bool isCheckSendTime = true)
|
||||
private static uint Condition(Player chatUnit, ChatInfoTree tree, bool isCheckSendTime = true)
|
||||
{
|
||||
// 每个频道可能聊天的间隔都不一样。
|
||||
// 这里的条件判断,是根据频道的类型,来判断是否到达了聊天的间隔。
|
||||
@@ -152,7 +152,7 @@ public static class ChatSceneHelper
|
||||
|
||||
if (tree.Target.Count > 0)
|
||||
{
|
||||
var chatUnitManageComponent = scene.GetComponent<SocialUnitManageComponent>();
|
||||
var chatUnitManageComponent = scene.GetComponent<PlayerManageComponent>();
|
||||
// 给一部分人广播消息
|
||||
foreach (var chatUnitId in tree.Target)
|
||||
{
|
||||
@@ -162,7 +162,7 @@ public static class ChatSceneHelper
|
||||
}
|
||||
|
||||
// networkMessagingComponent.SendInnerRoute(chatUnit.GateRouteId, chatMessage);
|
||||
networkMessagingComponent.Send(chatUnit.GateRouteId, chatMessage);
|
||||
networkMessagingComponent.Send(chatUnit.SessionRunTimeId, chatMessage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public static class ChatSceneHelper
|
||||
/// </summary>
|
||||
/// <param name="chatUnit"></param>
|
||||
/// <param name="tree"></param>
|
||||
private static uint Channel(SocialUnit chatUnit, ChatInfoTree tree)
|
||||
private static uint Channel(Player chatUnit, ChatInfoTree tree)
|
||||
{
|
||||
// 那组队,公会、地图、等这个的聊天,如何使用频道呢?
|
||||
// 这里的频道,是指一个频道,比如一个公会的频道,一个队伍的频道,一个地图的频道。
|
||||
@@ -213,7 +213,7 @@ public static class ChatSceneHelper
|
||||
/// <param name="chatUnit"></param>
|
||||
/// <param name="tree"></param>
|
||||
/// <returns></returns>
|
||||
private static uint Private(SocialUnit chatUnit, ChatInfoTree tree)
|
||||
private static uint Private(Player chatUnit, ChatInfoTree tree)
|
||||
{
|
||||
// 私聊,就是两个玩家之间,直接聊天。
|
||||
// 1、首先,客户端需要知道对方的ID,这个ID是通过什么方式获取的呢?
|
||||
@@ -230,14 +230,14 @@ public static class ChatSceneHelper
|
||||
|
||||
var targetChatUnitId = tree.Target[0];
|
||||
var scene = chatUnit.Scene;
|
||||
if (!scene.GetComponent<SocialUnitManageComponent>().TryGet(targetChatUnitId, out var targetChatUnit))
|
||||
if (!scene.GetComponent<PlayerManageComponent>().TryGet(targetChatUnitId, out var targetChatUnit))
|
||||
{
|
||||
// 这个2代表对方不在线。
|
||||
return 2;
|
||||
}
|
||||
|
||||
var networkMessagingComponent = scene.NetworkMessagingComponent;
|
||||
var chatMessage = new Chat2C_Message()
|
||||
var chatMessage = new Game2C_Message()
|
||||
{
|
||||
ChatInfoTree = tree
|
||||
};
|
||||
@@ -248,9 +248,9 @@ public static class ChatSceneHelper
|
||||
// networkMessagingComponent.SendInnerRoute(targetChatUnit.GateRouteId, chatMessage);
|
||||
|
||||
// 先给自己发送一个聊天消息。
|
||||
networkMessagingComponent.Send(chatUnit.GateRouteId, chatMessage);
|
||||
networkMessagingComponent.Send(chatUnit.SessionRunTimeId, chatMessage);
|
||||
// 然后再给对方发送一个聊天消息。
|
||||
networkMessagingComponent.Send(targetChatUnit.GateRouteId, chatMessage);
|
||||
networkMessagingComponent.Send(targetChatUnit.SessionRunTimeId, chatMessage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,41 +1,39 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
using NBF.Social;
|
||||
using NB.Game;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class MemoryEntity : Entity
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class ChatChannelComponentSystem
|
||||
{
|
||||
public static void Send(this ChatChannelComponent self, ChatInfoTree tree)
|
||||
{
|
||||
var chatUnitManageComponent = self.Scene.GetComponent<SocialUnitManageComponent>();
|
||||
var chatUnitManageComponent = self.Scene.GetComponent<PlayerManageComponent>();
|
||||
var networkMessagingComponent = self.Scene.NetworkMessagingComponent;
|
||||
var chatMessage = new Chat2C_Message()
|
||||
var chatMessage = new Game2C_Message()
|
||||
{
|
||||
ChatInfoTree = tree
|
||||
};
|
||||
|
||||
foreach (var unitId in self.Units)
|
||||
{
|
||||
if (!chatUnitManageComponent.Units.TryGetValue(unitId, out var chatUnit))
|
||||
if (!chatUnitManageComponent.TryGet(unitId, out var chatUnit))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// networkMessagingComponent.SendInnerRoute(chatUnit.GateRouteId, chatMessage);
|
||||
networkMessagingComponent.Send(chatUnit.GateRouteId, chatMessage);
|
||||
networkMessagingComponent.Send(chatUnit.SessionRunTimeId, chatMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool JoinChannel(this ChatChannelComponent self, long chatUnitId)
|
||||
{
|
||||
var chatUnitManageComponent = self.Scene.GetComponent<SocialUnitManageComponent>();
|
||||
var chatUnitManageComponent = self.Scene.GetComponent<PlayerManageComponent>();
|
||||
|
||||
if (!chatUnitManageComponent.TryGet(chatUnitId, out var chatUnit))
|
||||
{
|
||||
@@ -49,6 +47,7 @@ public static class ChatChannelComponentSystem
|
||||
{
|
||||
chatUnit.Channels.Add(self.Id, self);
|
||||
}
|
||||
|
||||
// 可以在这里给客户端发送一个加入频道成功的消息。
|
||||
return true;
|
||||
}
|
||||
@@ -65,7 +64,7 @@ public static class ChatChannelComponentSystem
|
||||
return;
|
||||
}
|
||||
|
||||
var chatUnitManageComponent = self.Scene.GetComponent<SocialUnitManageComponent>();
|
||||
var chatUnitManageComponent = self.Scene.GetComponent<PlayerManageComponent>();
|
||||
|
||||
if (!chatUnitManageComponent.TryGet(chatUnitId, out var chatUnit))
|
||||
{
|
||||
@@ -2,13 +2,14 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Game;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class C2S_DeleteMailRequestHandler : AddressRPC<SocialUnit, C2S_DeleteMailRequest, S2C_DeleteMailResponse>
|
||||
public class C2Game_DeleteMailRequestHandler : AddressRPC<Player, C2Game_DeleteMailRequest, Game2C_DeleteMailResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_DeleteMailRequest request,
|
||||
S2C_DeleteMailResponse response, Action reply)
|
||||
protected override async FTask Run(Player entity, C2Game_DeleteMailRequest request,
|
||||
Game2C_DeleteMailResponse response, Action reply)
|
||||
{
|
||||
if (request.Id < 1)
|
||||
{
|
||||
@@ -3,14 +3,15 @@ using System.Diagnostics;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Game;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class
|
||||
C2S_GetConversationsRequestHandler : AddressRPC<SocialUnit, C2S_GetConversationsRequest, S2C_GetConversationsResponse>
|
||||
C2Game_GetConversationsRequestHandler : AddressRPC<Player, C2Game_GetConversationsRequest, Game2C_GetConversationsResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_GetConversationsRequest request,
|
||||
S2C_GetConversationsResponse response, Action reply)
|
||||
protected override async FTask Run(Player entity, C2Game_GetConversationsRequest request,
|
||||
Game2C_GetConversationsResponse response, Action reply)
|
||||
{
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
@@ -2,12 +2,13 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Game;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class C2S_SendMailRequestHandler : AddressRPC<SocialUnit, C2S_SendMailRequest, S2C_SendMailResponse>
|
||||
public class C2Game_SendMailRequestHandler : AddressRPC<Player, C2Game_SendMailRequest, Game2C_SendMailResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_SendMailRequest request, S2C_SendMailResponse response,
|
||||
protected override async FTask Run(Player entity, C2Game_SendMailRequest request, Game2C_SendMailResponse response,
|
||||
Action reply)
|
||||
{
|
||||
if (request.Target < 1)
|
||||
@@ -24,7 +25,7 @@ public class C2S_SendMailRequestHandler : AddressRPC<SocialUnit, C2S_SendMailReq
|
||||
return;
|
||||
}
|
||||
|
||||
var chatUnitManage = entity.Scene.GetComponent<SocialUnitManageComponent>();
|
||||
var chatUnitManage = entity.Scene.GetComponent<PlayerManageComponent>();
|
||||
if (chatUnitManage == null)
|
||||
{
|
||||
Log.Error("组件不存在 SocialUnitManageComponent");
|
||||
@@ -50,13 +51,13 @@ public class C2S_SendMailRequestHandler : AddressRPC<SocialUnit, C2S_SendMailReq
|
||||
mail.OwnerId = request.Target;
|
||||
await conversation.Add(mail);
|
||||
|
||||
var res = new S2C_HaveMail()
|
||||
var res = new Game2C_HaveMail()
|
||||
{
|
||||
Mail = mail.ToMailInfo(),
|
||||
Key = conversation.Key
|
||||
};
|
||||
//同步客户端
|
||||
entity.Scene.NetworkMessagingComponent.Send(entity.GateRouteId, res);
|
||||
entity.Scene.NetworkMessagingComponent.Send(entity.SessionRunTimeId, res);
|
||||
|
||||
// var chatUnit = chatUnitManage.Get(request.Target);
|
||||
//
|
||||
@@ -43,7 +43,7 @@ public static class MailComponentSystem
|
||||
if (sync)
|
||||
{
|
||||
//同步客户端
|
||||
self.Scene.NetworkMessagingComponent.Send(0,new S2C_HaveMail()
|
||||
self.Scene.NetworkMessagingComponent.Send(0,new Game2C_HaveMail()
|
||||
{
|
||||
Mail = mail.ToMailInfo(),
|
||||
});
|
||||
@@ -66,7 +66,7 @@ public static class MailComponentSystem
|
||||
if (sync)
|
||||
{
|
||||
//同步客户端
|
||||
self.Scene.NetworkMessagingComponent.Send(0,new S2C_MailState()
|
||||
self.Scene.NetworkMessagingComponent.Send(0,new Game2C_MailState()
|
||||
{
|
||||
MailState = (int)MailState.Deleted,
|
||||
MailId = mailId,
|
||||
146
Hotfix/Game/Social/SocialUnitManageComponentSystem.cs
Normal file
146
Hotfix/Game/Social/SocialUnitManageComponentSystem.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
// using Fantasy;
|
||||
// using Fantasy.Async;
|
||||
// using Fantasy.Entitas;
|
||||
// using Fantasy.Entitas.Interface;
|
||||
// using NB.Chat;
|
||||
//
|
||||
// namespace NBF.Social;
|
||||
//
|
||||
// public sealed class ChatUnitManageComponentDestroySystem : DestroySystem<SocialUnitManageComponent>
|
||||
// {
|
||||
// protected override void Destroy(SocialUnitManageComponent self)
|
||||
// {
|
||||
// foreach (var chatUnit in self.Units.Values.ToArray())
|
||||
// {
|
||||
// chatUnit.Dispose();
|
||||
// }
|
||||
//
|
||||
// self.Units.Clear();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static class SocialUnitManageComponentSystem
|
||||
// {
|
||||
// #region 消息缓存
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 离线消息,进入待领取队列
|
||||
// /// </summary>
|
||||
// /// <param name="self"></param>
|
||||
// /// <param name="targetId"></param>
|
||||
// /// <param name="message"></param>
|
||||
// public static void SaveOfflineMessage(this SocialUnitManageComponent self, long targetId, ChatMessageInfo message)
|
||||
// {
|
||||
// // self.NotSendMessage.Add(targetId, message);
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region 上线下线
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 玩家上线
|
||||
// /// </summary>
|
||||
// /// <param name="self"></param>
|
||||
// /// <param name="scene"></param>
|
||||
// /// <param name="accountId"></param>
|
||||
// /// <param name="gateRouteId"></param>
|
||||
// public static async FTask<SocialUnit?> Online(this SocialUnitManageComponent self, Scene scene,
|
||||
// long accountId,
|
||||
// long gateRouteId)
|
||||
// {
|
||||
// // var accountId = roleSimpleInfo.RoleId;
|
||||
// if (!self.TryGet(accountId, out var account))
|
||||
// {
|
||||
// account = Entity.Create<SocialUnit>(scene, accountId, true, true);
|
||||
// self.Add(account);
|
||||
// }
|
||||
//
|
||||
// if (account != null)
|
||||
// {
|
||||
// await account.TryComponent<MailComponent>();
|
||||
// account.GateRouteId = gateRouteId;
|
||||
// // account.Role = roleSimpleInfo;
|
||||
// }
|
||||
//
|
||||
// await FTask.CompletedTask;
|
||||
// return account;
|
||||
// }
|
||||
//
|
||||
// public static async FTask Offline(this SocialUnitManageComponent self, Scene scene, long accountId,
|
||||
// long gateRouteId)
|
||||
// {
|
||||
// if (self.TryGet(accountId, out var unit) && unit != null)
|
||||
// {
|
||||
// if (unit.GateRouteId == gateRouteId)
|
||||
// {
|
||||
// Log.Info("退出当前聊天服==");
|
||||
// self.Remove(accountId); //如果当前网关和下线的网关一致
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// await FTask.CompletedTask;
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region 获取&移除
|
||||
//
|
||||
// public static void Add(this SocialUnitManageComponent self, SocialUnit account)
|
||||
// {
|
||||
// self.Units.Add(account.Id, account);
|
||||
// }
|
||||
//
|
||||
// public static SocialUnit? Get(this SocialUnitManageComponent self, long accountId)
|
||||
// {
|
||||
// return self.Units.GetValueOrDefault(accountId);
|
||||
// }
|
||||
//
|
||||
// public static bool TryGet(this SocialUnitManageComponent self, long accountId, out SocialUnit? account)
|
||||
// {
|
||||
// return self.Units.TryGetValue(accountId, out account);
|
||||
// }
|
||||
//
|
||||
// public static void Remove(this SocialUnitManageComponent self, long accountId, bool isDispose = true)
|
||||
// {
|
||||
// if (!self.Units.Remove(accountId, out var account))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!isDispose)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// account.Dispose();
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region 组件
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 尝试给增加相关组件
|
||||
// /// </summary>
|
||||
// /// <param name="socialUnit"></param>
|
||||
// /// <typeparam name="T"></typeparam>
|
||||
// public static async FTask TryComponent<T>(this SocialUnit socialUnit) where T : Entity, new()
|
||||
// {
|
||||
// if (socialUnit.GetComponent<T>() == null)
|
||||
// {
|
||||
// var mailComponent = await socialUnit.Scene.World.Database.Query<T>(socialUnit.Id, true);
|
||||
// if (mailComponent == null)
|
||||
// {
|
||||
// //如果没有邮件组件
|
||||
// socialUnit.AddComponent<T>();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// socialUnit.AddComponent(mailComponent);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
// }
|
||||
22
Hotfix/Game/Social/SocialUnitSystem.cs
Normal file
22
Hotfix/Game/Social/SocialUnitSystem.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
// using Fantasy.Entitas.Interface;
|
||||
// #pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
//
|
||||
// namespace NB.Chat;
|
||||
//
|
||||
// public sealed class SocialUnitDestroySystem : DestroySystem<SocialUnit>
|
||||
// {
|
||||
// protected override void Destroy(SocialUnit self)
|
||||
// {
|
||||
// self.Role?.Return();
|
||||
// self.Role = null;
|
||||
// self.GateRouteId = 0;
|
||||
// // 退出当前ChatUnit拥有的所有频道
|
||||
// foreach (var (_,chatChannelComponent) in self.Channels)
|
||||
// {
|
||||
// chatChannelComponent.ExitChannel(self.Id, false);
|
||||
// }
|
||||
// // 理论情况下,这个self.Channels不会存在因为数据的,因为上面已经给清空掉了。
|
||||
// // 但是self.Channels.Clear();还是加上吧,防止以后忘记了。
|
||||
// self.Channels.Clear();
|
||||
// }
|
||||
// }
|
||||
@@ -11,7 +11,7 @@ public class S2G_ChatMessageHandler : Address<Scene, Chat2G_ChatMessage>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, Chat2G_ChatMessage message)
|
||||
{
|
||||
// var chatMessage = new S2C_Message()
|
||||
// var chatMessage = new Game2C_Message()
|
||||
// {
|
||||
// Msg = message.Message,
|
||||
// };
|
||||
@@ -42,7 +42,7 @@ public class S2G_ChatMessageHandler : Address<Scene, Chat2G_ChatMessage>
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
var chatMessage = new Chat2C_Message()
|
||||
var chatMessage = new Game2C_Message()
|
||||
{
|
||||
ChatInfoTree = message.ChatInfoTree
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ public static class GateLoginHelper
|
||||
gateUnitSessionComponent.AccountID = gateUnit.AccountID;
|
||||
gateUnitSessionComponent.SessionId = session.RuntimeId;
|
||||
|
||||
return await gateUnit.Online(RouteType.GameRoute, RouteType.SocialRoute);
|
||||
return await gateUnit.Online(RouteType.GameRoute);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -61,7 +61,7 @@ public static class GateLoginHelper
|
||||
{
|
||||
//通知服务器下线
|
||||
Log.Info($"断线的session id={sessionId}");
|
||||
var ret = await gateUnit.Offline(sessionId, RouteType.GameRoute, RouteType.SocialRoute);
|
||||
var ret = await gateUnit.Offline(sessionId, RouteType.GameRoute);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,4 @@
|
||||
<ProjectReference Include="..\Entity\Entity.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Social\Chat\Handler\Inner\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -44,15 +44,16 @@ public sealed class OnCreateSceneEvent : AsyncEventSystem<OnCreateScene>
|
||||
// await InitializeMapScene(scene);
|
||||
// break;
|
||||
// }
|
||||
case SceneType.Social:
|
||||
{
|
||||
// Gate 场景初始化
|
||||
await InitializeSocialScene(scene);
|
||||
break;
|
||||
}
|
||||
// case SceneType.Social:
|
||||
// {
|
||||
// // Gate 场景初始化
|
||||
// await InitializeSocialScene(scene);
|
||||
// break;
|
||||
// }
|
||||
case SceneType.Game:
|
||||
{
|
||||
await InitializeGameScene(scene);
|
||||
await InitializeSocialScene(scene);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +140,6 @@ public sealed class OnCreateSceneEvent : AsyncEventSystem<OnCreateScene>
|
||||
{
|
||||
Log.Info($"初始化 Social 场景: {scene.Id}");
|
||||
//用于管理玩家的组件
|
||||
scene.AddComponent<SocialUnitManageComponent>();
|
||||
scene.AddComponent<MailManageComponent>();
|
||||
//聊天
|
||||
// 聊天频道中控中心组件。
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public sealed class Other2Chat_ChatMessageHandler : Address<SocialUnit, Other2Chat_ChatMessage>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit chatUnit, Other2Chat_ChatMessage message)
|
||||
{
|
||||
var result = ChatSceneHelper.Distribution(chatUnit, message.ChatInfoTree, false);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
Log.Warning($"Other2Chat_ChatMessageHandler: Distribution failed, result: {result}");
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using NB.Chat;
|
||||
|
||||
namespace NBF.Social;
|
||||
|
||||
public sealed class ChatUnitManageComponentDestroySystem : DestroySystem<SocialUnitManageComponent>
|
||||
{
|
||||
protected override void Destroy(SocialUnitManageComponent self)
|
||||
{
|
||||
foreach (var chatUnit in self.Units.Values.ToArray())
|
||||
{
|
||||
chatUnit.Dispose();
|
||||
}
|
||||
|
||||
self.Units.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SocialUnitManageComponentSystem
|
||||
{
|
||||
#region 消息缓存
|
||||
|
||||
/// <summary>
|
||||
/// 离线消息,进入待领取队列
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
/// <param name="targetId"></param>
|
||||
/// <param name="message"></param>
|
||||
public static void SaveOfflineMessage(this SocialUnitManageComponent self, long targetId, ChatMessageInfo message)
|
||||
{
|
||||
// self.NotSendMessage.Add(targetId, message);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 上线下线
|
||||
|
||||
/// <summary>
|
||||
/// 玩家上线
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="accountId"></param>
|
||||
/// <param name="gateRouteId"></param>
|
||||
public static async FTask<SocialUnit?> Online(this SocialUnitManageComponent self, Scene scene,
|
||||
long accountId,
|
||||
long gateRouteId)
|
||||
{
|
||||
// var accountId = roleSimpleInfo.RoleId;
|
||||
if (!self.TryGet(accountId, out var account))
|
||||
{
|
||||
account = Entity.Create<SocialUnit>(scene, accountId, true, true);
|
||||
self.Add(account);
|
||||
}
|
||||
|
||||
if (account != null)
|
||||
{
|
||||
await account.TryComponent<MailComponent>();
|
||||
account.GateRouteId = gateRouteId;
|
||||
// account.Role = roleSimpleInfo;
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
return account;
|
||||
}
|
||||
|
||||
public static async FTask Offline(this SocialUnitManageComponent self, Scene scene, long accountId,
|
||||
long gateRouteId)
|
||||
{
|
||||
if (self.TryGet(accountId, out var unit) && unit != null)
|
||||
{
|
||||
if (unit.GateRouteId == gateRouteId)
|
||||
{
|
||||
Log.Info("退出当前聊天服==");
|
||||
self.Remove(accountId); //如果当前网关和下线的网关一致
|
||||
}
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取&移除
|
||||
|
||||
public static void Add(this SocialUnitManageComponent self, SocialUnit account)
|
||||
{
|
||||
self.Units.Add(account.Id, account);
|
||||
}
|
||||
|
||||
public static SocialUnit? Get(this SocialUnitManageComponent self, long accountId)
|
||||
{
|
||||
return self.Units.GetValueOrDefault(accountId);
|
||||
}
|
||||
|
||||
public static bool TryGet(this SocialUnitManageComponent self, long accountId, out SocialUnit? account)
|
||||
{
|
||||
return self.Units.TryGetValue(accountId, out account);
|
||||
}
|
||||
|
||||
public static void Remove(this SocialUnitManageComponent self, long accountId, bool isDispose = true)
|
||||
{
|
||||
if (!self.Units.Remove(accountId, out var account))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDispose)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
account.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 组件
|
||||
|
||||
/// <summary>
|
||||
/// 尝试给增加相关组件
|
||||
/// </summary>
|
||||
/// <param name="socialUnit"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public static async FTask TryComponent<T>(this SocialUnit socialUnit) where T : Entity, new()
|
||||
{
|
||||
if (socialUnit.GetComponent<T>() == null)
|
||||
{
|
||||
var mailComponent = await socialUnit.Scene.World.Database.Query<T>(socialUnit.Id, true);
|
||||
if (mailComponent == null)
|
||||
{
|
||||
//如果没有邮件组件
|
||||
socialUnit.AddComponent<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
socialUnit.AddComponent(mailComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using Fantasy.Entitas.Interface;
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public sealed class SocialUnitDestroySystem : DestroySystem<SocialUnit>
|
||||
{
|
||||
protected override void Destroy(SocialUnit self)
|
||||
{
|
||||
self.Role?.Return();
|
||||
self.Role = null;
|
||||
self.GateRouteId = 0;
|
||||
// 退出当前ChatUnit拥有的所有频道
|
||||
foreach (var (_,chatChannelComponent) in self.Channels)
|
||||
{
|
||||
chatChannelComponent.ExitChannel(self.Id, false);
|
||||
}
|
||||
// 理论情况下,这个self.Channels不会存在因为数据的,因为上面已经给清空掉了。
|
||||
// 但是self.Channels.Clear();还是加上吧,防止以后忘记了。
|
||||
self.Channels.Clear();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AISerialize_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F199e3c534d1e41cbb9a3a30bbf9ac93bde200_003F7d_003F9fe3ad36_003FISerialize_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1b81cb3be224213a6a73519b6e340a628d9a1fb8629c351a186a26f6376669_003FList_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANetworkMessagingComponent_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5935efc3ba8745d5800392d88681b8c2ddc00_003Fdd_003Fc26349d0_003FNetworkMessagingComponent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANetworkMessagingComponent_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F199e3c534d1e41cbb9a3a30bbf9ac93bde200_003F6d_003F2f2e114c_003FNetworkMessagingComponent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AScene_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3cbbaf32e578423d8d0163d75da8233f87e00_003F6a_003F5adfe93e_003FScene_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASerializerManager_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F199e3c534d1e41cbb9a3a30bbf9ac93bde200_003F9f_003Fa4f53cf4_003FSerializerManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASortedOneToManyList_00602_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3cbbaf32e578423d8d0163d75da8233f87e00_003F12_003Fcfa98068_003FSortedOneToManyList_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
|
||||
@@ -2,13 +2,13 @@ syntax = "proto3";
|
||||
package Fantasy.Network.Message;
|
||||
|
||||
/// 请求创建房间
|
||||
message C2Map_CreateRoomRequest // ICustomRouteRequest,Map2C_CreateRoomResponse,GameRoute
|
||||
message C2Game_CreateRoomRequest // ICustomRouteRequest,Game2C_CreateRoomResponse,GameRoute
|
||||
{
|
||||
int32 MapId = 1;//地图id
|
||||
}
|
||||
|
||||
/// 请求创建房间成功
|
||||
message Map2C_CreateRoomResponse // ICustomRouteResponse
|
||||
message Game2C_CreateRoomResponse // ICustomRouteResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
repeated MapUnitInfo Units = 2; //房间玩家列表
|
||||
@@ -47,7 +47,7 @@ message G2C_EnterMapResponse // IResponse
|
||||
|
||||
|
||||
/// 通知客户端切换地图
|
||||
message Map2C_ChangeMap // ICustomRouteMessage,GameRoute
|
||||
message Game2C_ChangeMap // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int32 MapId = 1; //地图id
|
||||
int32 Node = 2; //站位节点
|
||||
|
||||
@@ -4,13 +4,13 @@ package Fantasy.Network.Message;
|
||||
|
||||
//************** 进入 离开 **********************
|
||||
///用户进入地图
|
||||
message Map2C_RoleEnterRoomNotify // ICustomRouteMessage,GameRoute
|
||||
message Game2C_RoleEnterRoomNotify // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
MapUnitInfo Info = 2;
|
||||
}
|
||||
|
||||
///用户离开地图
|
||||
message Map2C_RoleExitRoomNotify // ICustomRouteMessage,GameRoute
|
||||
message Game2C_RoleExitRoomNotify // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int64 Id = 1;//离开人员
|
||||
}
|
||||
@@ -18,14 +18,14 @@ message Map2C_RoleExitRoomNotify // ICustomRouteMessage,GameRoute
|
||||
//************** 物品变化 **********************
|
||||
|
||||
/// 请求拿起物品
|
||||
message C2Map_TakeItemRequest // ICustomRouteRequest,Map2C_TakeItemResponse,GameRoute
|
||||
message C2Game_TakeItemRequest // ICustomRouteRequest,Game2C_TakeItemResponse,GameRoute
|
||||
{
|
||||
int32 Id = 1; //物品id
|
||||
bool Task = 2; //拿起
|
||||
}
|
||||
|
||||
/// 请求拿起物品响应
|
||||
message Map2C_TakeItemResponse // ICustomRouteResponse
|
||||
message Game2C_TakeItemResponse // ICustomRouteResponse
|
||||
{
|
||||
int32 Id = 1; //物品id
|
||||
bool Task = 2; //拿起
|
||||
@@ -33,27 +33,27 @@ message Map2C_TakeItemResponse // ICustomRouteResponse
|
||||
|
||||
|
||||
//************** 参数变化 **********************
|
||||
message C2Map_RolePropertyChange // ICustomRouteMessage,GameRoute
|
||||
message C2Game_RolePropertyChange // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
repeated KeyValueInt64 Propertys = 1; //变化的属性信息
|
||||
}
|
||||
|
||||
///玩家状态变化同步
|
||||
message Map2C_RoleStateNotify // ICustomRouteMessage,GameRoute
|
||||
message Game2C_RoleStateNotify // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int64 Id = 1;
|
||||
UnitStateInfo State = 2;
|
||||
}
|
||||
|
||||
///玩家钓组变化
|
||||
message Map2C_RoleGearChangeNotify // ICustomRouteMessage,GameRoute
|
||||
message Game2C_RoleGearChangeNotify // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int64 Id = 1;
|
||||
repeated GearInfo Gears = 2; //钓组数据
|
||||
}
|
||||
|
||||
//玩家属性值变化
|
||||
message Map2C_RolePropertyChangeNotify // ICustomRouteMessage,GameRoute
|
||||
message Game2C_RolePropertyChangeNotify // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int64 Id = 1;
|
||||
repeated KeyValueInt64 Propertys = 2; //变化的属性信息
|
||||
@@ -64,7 +64,7 @@ message Map2C_RolePropertyChangeNotify // ICustomRouteMessage,GameRoute
|
||||
//************** 移动 旋转 **********************
|
||||
|
||||
// 角色移动
|
||||
message C2Map_Move // ICustomRouteMessage,GameRoute
|
||||
message C2Game_Move // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
Vector3Info Position = 1; //当前位置
|
||||
Vector3Info Rotation = 2; //角色方向
|
||||
@@ -75,14 +75,14 @@ message C2Map_Move // ICustomRouteMessage,GameRoute
|
||||
}
|
||||
|
||||
// 角色朝向变化
|
||||
message C2Map_Look // ICustomRouteMessage,GameRoute
|
||||
message C2Game_Look // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
Vector3Info Rotation = 1; //角色方向
|
||||
int64 Timestamp = 2; // 时间点
|
||||
}
|
||||
|
||||
///玩家移动推送
|
||||
message Map2C_MoveNotify // ICustomRouteMessage,GameRoute
|
||||
message Game2C_MoveNotify // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int64 Id = 1; // id
|
||||
Vector3Info Position = 2; //当前位置
|
||||
@@ -94,7 +94,7 @@ message Map2C_MoveNotify // ICustomRouteMessage,GameRoute
|
||||
}
|
||||
|
||||
///玩家旋转推送
|
||||
message Map2C_LookeNotify // ICustomRouteMessage,GameRoute
|
||||
message Game2C_LookeNotify // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int64 Id = 1; // id
|
||||
Vector3Info Rotation = 2; //角色方向
|
||||
|
||||
@@ -23,19 +23,19 @@ message MailInfo
|
||||
|
||||
|
||||
///请求会话列表
|
||||
message C2S_GetConversationsRequest // ICustomRouteRequest,S2C_GetConversationsResponse,SocialRoute
|
||||
message C2Game_GetConversationsRequest // ICustomRouteRequest,Game2C_GetConversationsResponse,GameRoute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///请求会话列表响应
|
||||
message S2C_GetConversationsResponse // ICustomRouteResponse
|
||||
message Game2C_GetConversationsResponse // ICustomRouteResponse
|
||||
{
|
||||
repeated ConversationInfo List = 1;
|
||||
}
|
||||
|
||||
///发送邮件消息
|
||||
message C2S_SendMailRequest // ICustomRouteRequest,S2C_SendMailResponse,SocialRoute
|
||||
message C2Game_SendMailRequest // ICustomRouteRequest,Game2C_SendMailResponse,GameRoute
|
||||
{
|
||||
int64 Target = 1; //目标id
|
||||
string Content = 2; //内容
|
||||
@@ -43,32 +43,32 @@ message C2S_SendMailRequest // ICustomRouteRequest,S2C_SendMailResponse,SocialRo
|
||||
}
|
||||
|
||||
///发送邮件消息响应
|
||||
message S2C_SendMailResponse // ICustomRouteResponse
|
||||
message Game2C_SendMailResponse // ICustomRouteResponse
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///发送删除会话消息
|
||||
message C2S_DeleteMailRequest // ICustomRouteRequest,S2C_DeleteMailResponse,SocialRoute
|
||||
message C2Game_DeleteMailRequest // ICustomRouteRequest,Game2C_DeleteMailResponse,GameRoute
|
||||
{
|
||||
int64 Id = 1; //会话id
|
||||
}
|
||||
|
||||
///发送删除会话消息响应
|
||||
message S2C_DeleteMailResponse // ICustomRouteResponse
|
||||
message Game2C_DeleteMailResponse // ICustomRouteResponse
|
||||
{
|
||||
int64 Id = 1; //会话id
|
||||
}
|
||||
|
||||
|
||||
///新邮件推送
|
||||
message S2C_HaveMail // ICustomRouteMessage,SocialRoute
|
||||
message Game2C_HaveMail // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
MailInfo Mail = 1;
|
||||
string Key = 2;
|
||||
}
|
||||
|
||||
message S2C_MailState // ICustomRouteMessage,SocialRoute
|
||||
message Game2C_MailState // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int32 MailState = 1;
|
||||
int64 MailId = 2;
|
||||
@@ -77,17 +77,17 @@ message S2C_MailState // ICustomRouteMessage,SocialRoute
|
||||
////////////// ******** 频道聊天 *******/////////////
|
||||
|
||||
/// 发送一个聊天消息给Chat服务器,中间是经过Gate中转的
|
||||
message C2Chat_SendMessageRequest // ICustomRouteRequest,Chat2C_SendMessageResponse,SocialRoute
|
||||
message C2Game_SendMessageRequest // ICustomRouteRequest,Game2C_SendMessageResponse,GameRoute
|
||||
{
|
||||
ChatInfoTree ChatInfoTree = 1;
|
||||
}
|
||||
message Chat2C_SendMessageResponse // ICustomRouteResponse
|
||||
message Game2C_SendMessageResponse // ICustomRouteResponse
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 该消息是Chat发送给Gate服务器,让Gate服务器自动转发到客户端
|
||||
message Chat2C_Message // ICustomRouteMessage,SocialRoute
|
||||
message Game2C_Message // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
ChatInfoTree ChatInfoTree = 1;
|
||||
}
|
||||
@@ -164,47 +164,47 @@ message ChatMessageInfo
|
||||
}
|
||||
|
||||
///创建频道
|
||||
message C2S_CreateChannelRequest // ICustomRouteRequest,S2C_CreateChannelResponse,SocialRoute
|
||||
message C2Game_CreateChannelRequest // ICustomRouteRequest,Game2C_CreateChannelResponse,GameRoute
|
||||
{
|
||||
string Name = 1; //频道名称
|
||||
}
|
||||
|
||||
///创建频道响应
|
||||
message S2C_CreateChannelResponse // ICustomRouteResponse
|
||||
message Game2C_CreateChannelResponse // ICustomRouteResponse
|
||||
{
|
||||
int64 ChannelId = 1; //创建的频道id
|
||||
}
|
||||
|
||||
///请求进入频道
|
||||
message C2S_JoinChannelRequest // ICustomRouteRequest,S2C_JoinChannelResponse,SocialRoute
|
||||
message C2Game_JoinChannelRequest // ICustomRouteRequest,Game2C_JoinChannelResponse,GameRoute
|
||||
{
|
||||
int64 Target = 1; // 频道id
|
||||
}
|
||||
|
||||
///进入频道响应
|
||||
message S2C_JoinChannelResponse // ICustomRouteResponse
|
||||
message Game2C_JoinChannelResponse // ICustomRouteResponse
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///发送消息
|
||||
message C2S_SendMessageRequest // ICustomRouteRequest,S2C_SendMessageResponse,SocialRoute
|
||||
{
|
||||
string Message = 1;
|
||||
int64 Target = 2; //目标id
|
||||
}
|
||||
// ///发送消息
|
||||
// message C2Game_SendMessageRequest // ICustomRouteRequest,Game2C_SendMessageResponse,GameRoute
|
||||
// {
|
||||
// string Message = 1;
|
||||
// int64 Target = 2; //目标id
|
||||
// }
|
||||
|
||||
///发送消息响应
|
||||
message S2C_SendMessageResponse // ICustomRouteResponse
|
||||
{
|
||||
// ///发送消息响应
|
||||
// message Game2C_SendMessageResponse // ICustomRouteResponse
|
||||
// {
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
///推送消息
|
||||
message S2C_Message // ICustomRouteMessage,SocialRoute
|
||||
{
|
||||
ChatMessageInfo Msg = 1;
|
||||
}
|
||||
// ///推送消息
|
||||
// message Game2C_Message // ICustomRouteMessage,GameRoute
|
||||
// {
|
||||
// ChatMessageInfo Msg = 1;
|
||||
// }
|
||||
|
||||
|
||||
////////////// ******** 工会 *******/////////////
|
||||
@@ -219,89 +219,89 @@ message ClubInfo
|
||||
}
|
||||
|
||||
///请求创建工会
|
||||
message C2S_CreateClubRequest // ICustomRouteRequest,S2C_CreateClubResponse,SocialRoute
|
||||
message C2Game_CreateClubRequest // ICustomRouteRequest,Game2C_CreateClubResponse,GameRoute
|
||||
{
|
||||
string Name = 1; //工会名称
|
||||
}
|
||||
|
||||
///创建工会响应
|
||||
message S2C_CreateClubResponse // ICustomRouteResponse
|
||||
message Game2C_CreateClubResponse // ICustomRouteResponse
|
||||
{
|
||||
ClubInfo Club = 1; //创建的工会信息
|
||||
}
|
||||
|
||||
///请求工会信息
|
||||
message C2S_GetClubInfoRequest // ICustomRouteRequest,S2C_GetClubInfoResponse,SocialRoute
|
||||
message C2Game_GetClubInfoRequest // ICustomRouteRequest,Game2C_GetClubInfoResponse,GameRoute
|
||||
{
|
||||
int64 ClubId = 1; //工会ID
|
||||
}
|
||||
///响应工会信息
|
||||
message S2C_GetClubInfoResponse // ICustomRouteResponse
|
||||
message Game2C_GetClubInfoResponse // ICustomRouteResponse
|
||||
{
|
||||
string Name = 1; //工会名称
|
||||
}
|
||||
|
||||
/// 请求工会成员列表
|
||||
message C2S_GetMemberListRequest // ICustomRouteRequest,S2C_GetMemberListResponse,SocialRoute
|
||||
message C2Game_GetMemberListRequest // ICustomRouteRequest,Game2C_GetMemberListResponse,GameRoute
|
||||
{
|
||||
int64 ClubId = 1; //工会ID
|
||||
}
|
||||
|
||||
/// 响应工会成员列表
|
||||
message S2C_GetMemberListResponse // ICustomRouteResponse
|
||||
message Game2C_GetMemberListResponse // ICustomRouteResponse
|
||||
{
|
||||
repeated RoleSimpleInfo Members = 1; //工会成员列表
|
||||
}
|
||||
|
||||
///获取工会列表请求
|
||||
message C2S_GetClubListRequest // ICustomRouteRequest,S2C_GetClubListResponse,SocialRoute
|
||||
message C2Game_GetClubListRequest // ICustomRouteRequest,Game2C_GetClubListResponse,GameRoute
|
||||
{
|
||||
|
||||
}
|
||||
///获取工会列表响应
|
||||
message S2C_GetClubListResponse // ICustomRouteResponse
|
||||
message Game2C_GetClubListResponse // ICustomRouteResponse
|
||||
{
|
||||
repeated ClubInfo Clubs = 1; //工会列表
|
||||
}
|
||||
|
||||
/// 请求加入工会
|
||||
message C2S_JoinClubRequest // ICustomRouteRequest,S2C_JoinClubResponse,SocialRoute
|
||||
message C2Game_JoinClubRequest // ICustomRouteRequest,Game2C_JoinClubResponse,GameRoute
|
||||
{
|
||||
int64 ClubId = 1; //工会ID
|
||||
}
|
||||
|
||||
/// 响应加入工会
|
||||
message S2C_JoinClubResponse // ICustomRouteResponse
|
||||
message Game2C_JoinClubResponse // ICustomRouteResponse
|
||||
{
|
||||
ClubInfo Club = 1; //加入的工会信息
|
||||
}
|
||||
|
||||
/// 请求退出工会
|
||||
message C2S_LeaveClubRequest // ICustomRouteRequest,S2C_LeaveClubResponse,SocialRoute
|
||||
message C2Game_LeaveClubRequest // ICustomRouteRequest,Game2C_LeaveClubResponse,GameRoute
|
||||
{
|
||||
int64 ClubId = 1; //工会ID
|
||||
}
|
||||
|
||||
/// 响应退出工会
|
||||
message S2C_LeaveClubResponse // ICustomRouteResponse
|
||||
message Game2C_LeaveClubResponse // ICustomRouteResponse
|
||||
{
|
||||
int64 ClubId = 1; //退出的工会ID
|
||||
}
|
||||
|
||||
/// 请求解散工会
|
||||
message C2S_DissolveClubRequest // ICustomRouteRequest,S2C_DissolveClubResponse,SocialRoute
|
||||
message C2Game_DissolveClubRequest // ICustomRouteRequest,Game2C_DissolveClubResponse,GameRoute
|
||||
{
|
||||
int64 ClubId = 1; //工会ID
|
||||
}
|
||||
|
||||
/// 响应解散工会
|
||||
message S2C_DissolveClubResponse // ICustomRouteResponse
|
||||
message Game2C_DissolveClubResponse // ICustomRouteResponse
|
||||
{
|
||||
int64 ClubId = 1; //解散的工会ID
|
||||
}
|
||||
|
||||
/// 请求操作申请
|
||||
message C2S_DisposeJoinRequest // ICustomRouteRequest,S2C_DisposeJoinResponse,SocialRoute
|
||||
message C2Game_DisposeJoinRequest // ICustomRouteRequest,Game2C_DisposeJoinResponse,GameRoute
|
||||
{
|
||||
int64 ClubId = 1; //工会ID
|
||||
int64 ApplicantId = 2; //申请人ID
|
||||
@@ -309,7 +309,7 @@ message C2S_DisposeJoinRequest // ICustomRouteRequest,S2C_DisposeJoinResponse,So
|
||||
}
|
||||
|
||||
/// 响应操作申请
|
||||
message S2C_DisposeJoinResponse // ICustomRouteResponse
|
||||
message Game2C_DisposeJoinResponse // ICustomRouteResponse
|
||||
{
|
||||
int64 ClubId = 1; //工会ID
|
||||
int64 ApplicantId = 2; //申请人ID
|
||||
@@ -317,7 +317,7 @@ message S2C_DisposeJoinResponse // ICustomRouteResponse
|
||||
}
|
||||
|
||||
///推送消息
|
||||
message S2C_ClubChange // ICustomRouteMessage,SocialRoute
|
||||
message Game2C_ClubChange // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
ClubInfo Club = 1;
|
||||
int32 ChangeType = 2; //变更类型 0.创建 1.解散 2.加入 3.退出 4.申请处理
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
|
||||
GateRoute = 1001 // Gate
|
||||
SocialRoute = 1002 // Social
|
||||
GameRoute = 1003 // Game
|
||||
GameRoute = 1002 // Game
|
||||
Reference in New Issue
Block a user