升级框架
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace NB.Chat;
|
||||
/// 请求创建频道
|
||||
/// </summary>
|
||||
public class
|
||||
C2S_CreateChannelRequestHandler : RouteRPC<SocialUnit, C2S_CreateChannelRequest, S2C_CreateChannelResponse>
|
||||
C2S_CreateChannelRequestHandler : AddressRPC<SocialUnit, C2S_CreateChannelRequest, S2C_CreateChannelResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_CreateChannelRequest request,
|
||||
S2C_CreateChannelResponse response, Action reply)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// namespace NB.Chat;
|
||||
//
|
||||
// public class
|
||||
// C2S_GetOfflineMessageRequestHandler : RouteRPC<SocialUnit, C2S_GetOfflineMessageRequest,
|
||||
// C2S_GetOfflineMessageRequestHandler : AddressRPC<SocialUnit, C2S_GetOfflineMessageRequest,
|
||||
// S2C_GetOfflineMessageResponse>
|
||||
// {
|
||||
// protected override async FTask Run(SocialUnit entity, C2S_GetOfflineMessageRequest request,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace NB.Chat;
|
||||
/// 请求进入频道
|
||||
/// </summary>
|
||||
public class
|
||||
C2S_JoinChannelRequestHandler : RouteRPC<SocialUnit, C2S_JoinChannelRequest, S2C_JoinChannelResponse>
|
||||
C2S_JoinChannelRequestHandler : AddressRPC<SocialUnit, C2S_JoinChannelRequest, S2C_JoinChannelResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_JoinChannelRequest request,
|
||||
S2C_JoinChannelResponse response, Action reply)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
@@ -9,7 +10,7 @@ using NB.Game;
|
||||
namespace NB.Chat;
|
||||
|
||||
public sealed class
|
||||
C2S_SendMessageRequestHandler : RouteRPC<SocialUnit, C2S_SendMessageRequest, S2C_SendMessageResponse>
|
||||
C2S_SendMessageRequestHandler : AddressRPC<SocialUnit, C2S_SendMessageRequest, S2C_SendMessageResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit socialUnit, C2S_SendMessageRequest request,
|
||||
S2C_SendMessageResponse response, Action reply)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Platform.Net;
|
||||
|
||||
@@ -113,7 +114,7 @@ public static class SocialSceneHelper
|
||||
foreach (var config in gateConfigs)
|
||||
{
|
||||
//发送给Gate服务器转发消息
|
||||
networkMessagingComponent.SendInnerRoute(config.RouteId, sendMessage);
|
||||
networkMessagingComponent.Send(config.Address, sendMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using NB.Game;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class C2S_DeleteMailRequestHandler : RouteRPC<SocialUnit, C2S_DeleteMailRequest, S2C_DeleteMailResponse>
|
||||
public class C2S_DeleteMailRequestHandler : AddressRPC<SocialUnit, C2S_DeleteMailRequest, S2C_DeleteMailResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_DeleteMailRequest request,
|
||||
S2C_DeleteMailResponse response, Action reply)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
@@ -6,7 +7,7 @@ using Fantasy.Network.Interface;
|
||||
namespace NB.Chat;
|
||||
|
||||
public class
|
||||
C2S_GetConversationsRequestHandler : RouteRPC<SocialUnit, C2S_GetConversationsRequest, S2C_GetConversationsResponse>
|
||||
C2S_GetConversationsRequestHandler : AddressRPC<SocialUnit, C2S_GetConversationsRequest, S2C_GetConversationsResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_GetConversationsRequest request,
|
||||
S2C_GetConversationsResponse response, Action reply)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
public class C2S_SendMailRequestHandler : RouteRPC<SocialUnit, C2S_SendMailRequest, S2C_SendMailResponse>
|
||||
public class C2S_SendMailRequestHandler : AddressRPC<SocialUnit, C2S_SendMailRequest, S2C_SendMailResponse>
|
||||
{
|
||||
protected override async FTask Run(SocialUnit entity, C2S_SendMailRequest request, S2C_SendMailResponse response,
|
||||
Action reply)
|
||||
@@ -55,14 +56,14 @@ public class C2S_SendMailRequestHandler : RouteRPC<SocialUnit, C2S_SendMailReque
|
||||
Key = conversation.Key
|
||||
};
|
||||
//同步客户端
|
||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(entity.GateRouteId, res);
|
||||
entity.Scene.NetworkMessagingComponent.Send(entity.GateRouteId, res);
|
||||
|
||||
var chatUnit = chatUnitManage.Get(request.Target);
|
||||
|
||||
if (chatUnit != null)
|
||||
{
|
||||
//对方在线
|
||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(chatUnit.GateRouteId, res);
|
||||
entity.Scene.NetworkMessagingComponent.Send(chatUnit.GateRouteId, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Helper;
|
||||
using NB.Game;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Helper;
|
||||
using Fantasy.Serialize;
|
||||
@@ -8,10 +9,11 @@ namespace NB.Chat;
|
||||
|
||||
public static class MailFactory
|
||||
{
|
||||
private static readonly ISerialize _serializer = SerializerManager.GetSerializer(FantasySerializerType.Bson);
|
||||
private static readonly ISerialize _serializer = SerializerManager.BsonPack;
|
||||
|
||||
public static Mail Create(Scene scene, string content, List<AwardItem> items = null)
|
||||
{
|
||||
|
||||
var mail = Entity.Create<Mail>(scene, true, true);
|
||||
mail.Content = content;
|
||||
mail.State = MailState.Unread;
|
||||
@@ -21,7 +23,7 @@ public static class MailFactory
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
mail.Items.Add(_serializer.Clone(item));
|
||||
// mail.Items.Add(_serializer.Clone(item));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using Fantasy.Helper;
|
||||
@@ -42,7 +43,7 @@ public static class MailComponentSystem
|
||||
if (sync)
|
||||
{
|
||||
//同步客户端
|
||||
self.Scene.NetworkMessagingComponent.SendInnerRoute(0,new S2C_HaveMail()
|
||||
self.Scene.NetworkMessagingComponent.Send(0,new S2C_HaveMail()
|
||||
{
|
||||
Mail = mail.ToMailInfo(),
|
||||
});
|
||||
@@ -65,7 +66,7 @@ public static class MailComponentSystem
|
||||
if (sync)
|
||||
{
|
||||
//同步客户端
|
||||
self.Scene.NetworkMessagingComponent.SendInnerRoute(0,new S2C_MailState()
|
||||
self.Scene.NetworkMessagingComponent.Send(0,new S2C_MailState()
|
||||
{
|
||||
MailState = (int)MailState.Deleted,
|
||||
MailId = mailId,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using Fantasy.Helper;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using NB.Game;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user