升级框架
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
@@ -21,7 +22,7 @@ public class C2A_LoginRequestHandler : MessageRPC<C2A_LoginRequest, A2C_LoginRes
|
||||
|
||||
session.SetTimeout(3000);
|
||||
var scene = session.Scene;
|
||||
Log.Info($"登录服场景 {scene.Id} {scene.RouteId} {scene.SceneConfigId}");
|
||||
Log.Info($"登录服场景 {scene.Id} {scene.RuntimeId} {scene.SceneConfigId}");
|
||||
var result = await AuthenticationHelper.Login(scene, request.Username, request.Password);
|
||||
|
||||
if (result.ErrorCode != ErrorCode.Successful && result.AccountId == -1)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Cryptography;
|
||||
using Fantasy;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Chat;
|
||||
@@ -6,7 +7,7 @@ using NB.Game;
|
||||
|
||||
namespace NB.Common;
|
||||
|
||||
public class G2Common_EnterRequestHandler : RouteRPC<Scene, G2Common_EnterRequest, G2Common_EnterResponse>
|
||||
public class G2Common_EnterRequestHandler : AddressRPC<Scene, G2Common_EnterRequest, G2Common_EnterResponse>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, G2Common_EnterRequest request, G2Common_EnterResponse response,
|
||||
Action reply)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Chat;
|
||||
@@ -6,7 +7,7 @@ using NB.Game;
|
||||
|
||||
namespace NB.Common;
|
||||
|
||||
public class G2Common_ExitRequestHandler : RouteRPC<Scene, G2Common_ExitRequest, Common2G_ExitResponse>
|
||||
public class G2Common_ExitRequestHandler : AddressRPC<Scene, G2Common_ExitRequest, Common2G_ExitResponse>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response,
|
||||
Action reply)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using Fantasy;
|
||||
using Fantasy.Platform.Net;
|
||||
|
||||
namespace NB.Common;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using NB.Authentication;
|
||||
using System;
|
||||
using NB.Authentication;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using Fantasy.Helper;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class
|
||||
S2G_GetPlayerBasicInfoRequestHandler : RouteRPC<Scene, S2G_GetPlayerBasicInfoRequest,
|
||||
S2G_GetPlayerBasicInfoRequestHandler : AddressRPC<Scene, S2G_GetPlayerBasicInfoRequest,
|
||||
G2S_GetPlayerBasicInfoResponse>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, S2G_GetPlayerBasicInfoRequest request,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using NB.Common;
|
||||
|
||||
@@ -15,9 +16,9 @@ public static class CacheHandler
|
||||
public static async FTask<List<RoleSimpleInfo>> GetPlayerBasicCacheInfos(Scene scene, List<long> id)
|
||||
{
|
||||
var gameSceneConfig = SceneConfigHelper.GetConfig(SceneType.Game);
|
||||
var gameRouteId = gameSceneConfig.RouteId;
|
||||
var gameRouteId = gameSceneConfig.Address;
|
||||
//连接到游戏中心服
|
||||
var gameResponse = (G2S_GetPlayerBasicInfoResponse)await scene.NetworkMessagingComponent.CallInnerRoute(
|
||||
var gameResponse = (G2S_GetPlayerBasicInfoResponse)await scene.NetworkMessagingComponent.Call(
|
||||
gameRouteId, new S2G_GetPlayerBasicInfoRequest()
|
||||
{
|
||||
IdList = id
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Game_GetItemsRequestHandler : RouteRPC<Player, C2Game_GetItemsRequest, Game2C_GetItemsResponse>
|
||||
public class C2Game_GetItemsRequestHandler : AddressRPC<Player, C2Game_GetItemsRequest, Game2C_GetItemsResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Game_GetItemsRequest request, Game2C_GetItemsResponse response,
|
||||
Action reply)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Game_GetRoleInfoRequestHandler : RouteRPC<Player, C2Game_GetRoleInfoRequest, Game2C_GetRoleInfoResponse>
|
||||
public class C2Game_GetRoleInfoRequestHandler : AddressRPC<Player, C2Game_GetRoleInfoRequest, Game2C_GetRoleInfoResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Game_GetRoleInfoRequest request,
|
||||
Game2C_GetRoleInfoResponse response, Action reply)
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Game_RigChangeRequestHandler : RouteRPC<Player, C2Game_RigChangeRequest, Game2C_RigChangeResponse>
|
||||
public class C2Game_RigChangeRequestHandler : AddressRPC<Player, C2Game_RigChangeRequest, Game2C_RigChangeResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Game_RigChangeRequest request,
|
||||
Game2C_RigChangeResponse response, Action reply)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Game_SetSlotRequestHandler : RouteRPC<Player, C2Game_SetSlotRequest, Game2C_SetSlotResponse>
|
||||
public class C2Game_SetSlotRequestHandler : AddressRPC<Player, C2Game_SetSlotRequest, Game2C_SetSlotResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Game_SetSlotRequest request, Game2C_SetSlotResponse response,
|
||||
Action reply)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Game_UseItemRequestHandler : RouteRPC<Player, C2Game_UseItemRequest, Game2C_UseItemResponse>
|
||||
public class C2Game_UseItemRequestHandler : AddressRPC<Player, C2Game_UseItemRequest, Game2C_UseItemResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Game_UseItemRequest request, Game2C_UseItemResponse response,
|
||||
Action reply)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_CreateRoomRequestHandler : RouteRPC<Player, C2Map_CreateRoomRequest, Map2C_CreateRoomResponse>
|
||||
public class C2Map_CreateRoomRequestHandler : AddressRPC<Player, C2Map_CreateRoomRequest, Map2C_CreateRoomResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_CreateRoomRequest request,
|
||||
Map2C_CreateRoomResponse response,
|
||||
|
||||
@@ -4,7 +4,7 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_LookHandler : Route<Player, C2Map_Look>
|
||||
public class C2Map_LookHandler : Address<Player, C2Map_Look>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_Look message)
|
||||
{
|
||||
@@ -37,7 +37,7 @@ public class C2Map_LookHandler : Route<Player, C2Map_Look>
|
||||
foreach (var (_, unit) in room.Units)
|
||||
{
|
||||
// if (unit.Id == entity.Id) continue;
|
||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
|
||||
entity.Scene.NetworkMessagingComponent.Send(unit.SessionRunTimeId, notifyMessage);
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
|
||||
@@ -5,7 +5,7 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_MoveHandler : Route<Player, C2Map_Move>
|
||||
public class C2Map_MoveHandler : Address<Player, C2Map_Move>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_Move message)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ public class C2Map_MoveHandler : Route<Player, C2Map_Move>
|
||||
foreach (var (_, unit) in room.Units)
|
||||
{
|
||||
// if (unit.Id == entity.Id) continue;
|
||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
|
||||
entity.Scene.NetworkMessagingComponent.Send(unit.SessionRunTimeId, notifyMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_RolePropertyChangeHandler : Route<Player, C2Map_RolePropertyChange>
|
||||
public class C2Map_RolePropertyChangeHandler : Address<Player, C2Map_RolePropertyChange>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_RolePropertyChange message)
|
||||
{
|
||||
@@ -33,7 +33,7 @@ public class C2Map_RolePropertyChangeHandler : Route<Player, C2Map_RolePropertyC
|
||||
foreach (var (_, unit) in room.Units)
|
||||
{
|
||||
if (unit.Id == entity.Id) continue;
|
||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
|
||||
entity.Scene.NetworkMessagingComponent.Send(unit.SessionRunTimeId, notifyMessage);
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class C2Map_TakeItemRequestHandler : RouteRPC<Player, C2Map_TakeItemRequest, Map2C_TakeItemResponse>
|
||||
public class C2Map_TakeItemRequestHandler : AddressRPC<Player, C2Map_TakeItemRequest, Map2C_TakeItemResponse>
|
||||
{
|
||||
protected override async FTask Run(Player entity, C2Map_TakeItemRequest request, Map2C_TakeItemResponse response,
|
||||
Action reply)
|
||||
@@ -53,7 +54,7 @@ public class C2Map_TakeItemRequestHandler : RouteRPC<Player, C2Map_TakeItemReque
|
||||
foreach (var (_, unit) in room.Units)
|
||||
{
|
||||
// if (unit.Id == entity.Id) continue;
|
||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
|
||||
entity.Scene.NetworkMessagingComponent.Send(unit.SessionRunTimeId, notifyMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Game;
|
||||
@@ -8,7 +9,7 @@ namespace NB.Game.Inner;
|
||||
/// <summary>
|
||||
/// 请求进入地图
|
||||
/// </summary>
|
||||
public class G2Map_EnterMapRequestHandler : RouteRPC<Scene, G2Map_EnterMapRequest, Map2G_EnterMapResponse>
|
||||
public class G2Map_EnterMapRequestHandler : AddressRPC<Scene, G2Map_EnterMapRequest, Map2G_EnterMapResponse>
|
||||
{
|
||||
protected override async FTask Run(Scene entity, G2Map_EnterMapRequest request, Map2G_EnterMapResponse response,
|
||||
Action reply)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Game.Inner;
|
||||
|
||||
public class G2Map_ExitRoomRequestHandler : RouteRPC<Scene, G2Map_ExitRoomRequest, Map2G_ExiRoomResponse>
|
||||
public class G2Map_ExitRoomRequestHandler : AddressRPC<Scene, G2Map_ExitRoomRequest, Map2G_ExiRoomResponse>
|
||||
{
|
||||
protected override async FTask Run(Scene entity, G2Map_ExitRoomRequest request, Map2G_ExiRoomResponse response,
|
||||
Action reply)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
@@ -69,8 +70,8 @@ public static class PlayerSystem
|
||||
var ret = new MapUnitInfo()
|
||||
{
|
||||
Id = self.Id,
|
||||
Position = Vector3Info.Create(self.Scene),
|
||||
Rotation = Vector3Info.Create(self.Scene),
|
||||
Position = Vector3Info.Create(),
|
||||
Rotation = Vector3Info.Create(),
|
||||
};
|
||||
|
||||
var mapUnit = self.GetComponent<MapUnitComponent>();
|
||||
|
||||
@@ -133,7 +133,7 @@ public static class PlayerHelper
|
||||
var info = new RoleInfo();
|
||||
info.BaseInfo = GetRoleBaseInfo(self);
|
||||
// info.Items = self.ItemContainer.GetItemInfos();
|
||||
info.RoleId = self.RouteId;
|
||||
info.RoleId = self.Address;
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Fantasy.PacketParser;
|
||||
|
||||
namespace NB.Gate;
|
||||
|
||||
public class S2G_ChatMessageHandler : Route<Scene, S2G_ChatMessage>
|
||||
public class S2G_ChatMessageHandler : Address<Scene, S2G_ChatMessage>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, S2G_ChatMessage message)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Fantasy;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
using Fantasy.Network.Interface;
|
||||
@@ -68,7 +70,7 @@ public class C2G_EnterMapRequestHandler : MessageRPC<C2G_EnterMapRequest, G2C_En
|
||||
|
||||
//先判断是否需要更换地图服务器
|
||||
var oldServerRouteId = gateUnit.GetAddress(sceneConfig.SceneType);
|
||||
if (oldServerRouteId != sceneConfig.RouteId)
|
||||
if (oldServerRouteId != sceneConfig.Address)
|
||||
{
|
||||
//先退出旧的服务
|
||||
var ret = await gateUnit.Offline(session.RuntimeId, RouteType.GameRoute);
|
||||
@@ -88,8 +90,8 @@ public class C2G_EnterMapRequestHandler : MessageRPC<C2G_EnterMapRequest, G2C_En
|
||||
}
|
||||
|
||||
//执行进入房间操作
|
||||
var roomResponse = (Map2G_EnterMapResponse)await session.Scene.NetworkMessagingComponent.CallInnerRoute(
|
||||
sceneConfig.RouteId, new G2Map_EnterMapRequest()
|
||||
var roomResponse = (Map2G_EnterMapResponse)await session.Scene.NetworkMessagingComponent.Call(
|
||||
sceneConfig.Address, new G2Map_EnterMapRequest()
|
||||
{
|
||||
AccountId = gateUnit.Id,
|
||||
RoomCode = request.RoomCode,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
@@ -62,8 +63,8 @@ public class C2G_ExitRoomRequestHandler : MessageRPC<C2G_ExitRoomRequest, G2C_Ex
|
||||
}
|
||||
|
||||
//执行退出房间操作
|
||||
var roomResponse = (Map2G_ExiRoomResponse)await session.Scene.NetworkMessagingComponent.CallInnerRoute(
|
||||
sceneConfig.RouteId, new G2Map_ExitRoomRequest()
|
||||
var roomResponse = (Map2G_ExiRoomResponse)await session.Scene.NetworkMessagingComponent.Call(
|
||||
sceneConfig.Address, new G2Map_ExitRoomRequest()
|
||||
{
|
||||
AccountId = gateUnit.Id,
|
||||
RoomCode = request.RoomCode,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas;
|
||||
using Fantasy.Network;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Fantasy;
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Entitas.Interface;
|
||||
using Fantasy.Network;
|
||||
@@ -72,9 +73,9 @@ public static class GateUnitSystem
|
||||
sceneConfig = SceneConfigHelper.GetConfigByRouteType(routeType);
|
||||
}
|
||||
|
||||
var gameRouteId = sceneConfig.RouteId;
|
||||
var gameRouteId = sceneConfig.Address;
|
||||
|
||||
var gameResponse = (G2Common_EnterResponse)await self.Scene.NetworkMessagingComponent.CallInnerRoute(
|
||||
var gameResponse = (G2Common_EnterResponse)await self.Scene.NetworkMessagingComponent.Call(
|
||||
gameRouteId, new G2Common_EnterRequest()
|
||||
{
|
||||
AccountId = self.AccountID,
|
||||
@@ -115,11 +116,11 @@ public static class GateUnitSystem
|
||||
public static async FTask<uint> Offline(this GateUnit self, long sessionId, int routeType)
|
||||
{
|
||||
var sceneConfig = SceneConfigHelper.GetConfigByRouteType(routeType);
|
||||
var sceneRouteId = sceneConfig.RouteId;
|
||||
var sceneRouteId = sceneConfig.Address;
|
||||
if (sceneRouteId < 1) return ErrorCode.Successful;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var gameResponse = (Common2G_ExitResponse)await self.Scene.NetworkMessagingComponent.CallInnerRoute(
|
||||
var gameResponse = (Common2G_ExitResponse)await self.Scene.NetworkMessagingComponent.Call(
|
||||
sceneRouteId, new G2Common_ExitRequest()
|
||||
{
|
||||
AccountId = self.AccountID,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Cryptography;
|
||||
using Fantasy.Entitas.Interface;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using Fantasy;
|
||||
|
||||
|
||||
@@ -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