对对对
This commit is contained in:
@@ -5,6 +5,7 @@ using ProtoBuf;
|
||||
#if FANTASY_NET
|
||||
using Fantasy.Network.Roaming;
|
||||
#endif
|
||||
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable PropertyCanBeMadeInitOnly.Global
|
||||
@@ -21,6 +22,7 @@ namespace Fantasy.InnerMessage
|
||||
return Fantasy.Network.OpCode.BenchmarkMessage;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class BenchmarkRequest : AMessage, IRequest
|
||||
{
|
||||
@@ -28,12 +30,11 @@ namespace Fantasy.InnerMessage
|
||||
{
|
||||
return Fantasy.Network.OpCode.BenchmarkRequest;
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public BenchmarkResponse ResponseType { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public long RpcId { get; set; }
|
||||
|
||||
[ProtoIgnore] public BenchmarkResponse ResponseType { get; set; }
|
||||
[ProtoMember(1)] public long RpcId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[ProtoContract]
|
||||
public partial class BenchmarkResponse : AMessage, IResponse
|
||||
{
|
||||
@@ -41,22 +42,22 @@ namespace Fantasy.InnerMessage
|
||||
{
|
||||
return Fantasy.Network.OpCode.BenchmarkResponse;
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long RpcId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
|
||||
[ProtoMember(1)] public long RpcId { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
public sealed partial class Response : AMessage, IResponse
|
||||
{
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.DefaultResponse;
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long RpcId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
|
||||
[ProtoMember(1)] public long RpcId { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class RouteResponse : AMessage, IRouteResponse
|
||||
{
|
||||
@@ -64,11 +65,11 @@ namespace Fantasy.InnerMessage
|
||||
{
|
||||
return Fantasy.Network.OpCode.DefaultRouteResponse;
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long RpcId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
|
||||
[ProtoMember(1)] public long RpcId { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class PingRequest : AMessage, IRequest
|
||||
{
|
||||
@@ -76,12 +77,11 @@ namespace Fantasy.InnerMessage
|
||||
{
|
||||
return Fantasy.Network.OpCode.PingRequest;
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public PingResponse ResponseType { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public long RpcId { get; set; }
|
||||
|
||||
[ProtoIgnore] public PingResponse ResponseType { get; set; }
|
||||
[ProtoMember(1)] public long RpcId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[ProtoContract]
|
||||
public partial class PingResponse : AMessage, IResponse
|
||||
{
|
||||
@@ -89,231 +89,334 @@ namespace Fantasy.InnerMessage
|
||||
{
|
||||
return Fantasy.Network.OpCode.PingResponse;
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long RpcId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public long Now;
|
||||
|
||||
[ProtoMember(1)] public long RpcId { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
[ProtoMember(3)] public long Now;
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableAdd_Request : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_AddressableAdd_Response ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableAddRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long RouteId { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public bool IsLock { get; set; }
|
||||
[ProtoIgnore] public I_AddressableAdd_Response ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableAddRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long AddressableId { get; set; }
|
||||
[ProtoMember(2)] public long RouteId { get; set; }
|
||||
[ProtoMember(3)] public bool IsLock { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableAdd_Response : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableAddResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableAddResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableGet_Request : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_AddressableGet_Response ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableGetRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoIgnore] public I_AddressableGet_Response ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableGetRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long AddressableId { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableGet_Response : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableGetResponse; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public long RouteId { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableGetResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)] public long RouteId { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableRemove_Request : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_AddressableRemove_Response ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableRemoveRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoIgnore] public I_AddressableRemove_Response ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableRemoveRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long AddressableId { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableRemove_Response : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableRemoveResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableRemoveResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableLock_Request : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_AddressableLock_Response ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableLockRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoIgnore] public I_AddressableLock_Response ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableLockRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long AddressableId { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableLock_Response : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableLockResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableLockResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableUnLock_Request : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_AddressableUnLock_Response ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableUnLockRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long RouteId { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public string Source { get; set; }
|
||||
[ProtoIgnore] public I_AddressableUnLock_Response ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableUnLockRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long AddressableId { get; set; }
|
||||
[ProtoMember(2)] public long RouteId { get; set; }
|
||||
[ProtoMember(3)] public string Source { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableUnLock_Response : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.AddressableUnLockResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.AddressableUnLockResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
#if FANTASY_NET
|
||||
[ProtoContract]
|
||||
public sealed class I_LinkRoamingRequest : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_LinkRoamingResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.LinkRoamingRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long RoamingId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public int RoamingType { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public long ForwardSessionRouteId { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public long SceneRouteId { get; set; }
|
||||
[ProtoIgnore] public I_LinkRoamingResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.LinkRoamingRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long RoamingId { get; set; }
|
||||
[ProtoMember(2)] public int RoamingType { get; set; }
|
||||
[ProtoMember(3)] public long ForwardSessionRouteId { get; set; }
|
||||
[ProtoMember(4)] public long SceneRouteId { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed class I_LinkRoamingResponse : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.LinkRoamingResponse; }
|
||||
[ProtoMember(1)]
|
||||
public long TerminusId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.LinkRoamingResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long TerminusId { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed class I_UnLinkRoamingRequest : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_UnLinkRoamingResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.UnLinkRoamingRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long RoamingId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public bool DisposeRoaming { get; set; }
|
||||
[ProtoIgnore] public I_UnLinkRoamingResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.UnLinkRoamingRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long RoamingId { get; set; }
|
||||
[ProtoMember(2)] public bool DisposeRoaming { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed class I_UnLinkRoamingResponse : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.UnLinkRoamingResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.UnLinkRoamingResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_LockTerminusIdRequest : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_LockTerminusIdResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.LockTerminusIdRequest; }
|
||||
[ProtoMember(1)]
|
||||
public long SessionRuntimeId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public int RoamingType { get; set; }
|
||||
[ProtoIgnore] public I_LockTerminusIdResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.LockTerminusIdRequest;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long SessionRuntimeId { get; set; }
|
||||
[ProtoMember(2)] public int RoamingType { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_LockTerminusIdResponse : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.LockTerminusIdResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.LockTerminusIdResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed class I_UnLockTerminusIdRequest : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_UnLockTerminusIdResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.UnLockTerminusIdRequest; }
|
||||
public long RouteTypeOpCode() { return 1; }
|
||||
[ProtoMember(1)]
|
||||
public long SessionRuntimeId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public int RoamingType { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public long TerminusId { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public long TargetSceneRouteId { get; set; }
|
||||
[ProtoIgnore] public I_UnLockTerminusIdResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.UnLockTerminusIdRequest;
|
||||
}
|
||||
|
||||
public long RouteTypeOpCode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long SessionRuntimeId { get; set; }
|
||||
[ProtoMember(2)] public int RoamingType { get; set; }
|
||||
[ProtoMember(3)] public long TerminusId { get; set; }
|
||||
[ProtoMember(4)] public long TargetSceneRouteId { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed class I_UnLockTerminusIdResponse : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.UnLockTerminusIdResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.UnLockTerminusIdResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 漫游传送终端的请求
|
||||
/// </summary>
|
||||
public partial class I_TransferTerminusRequest : AMessage, IRouteRequest
|
||||
{
|
||||
[BsonIgnore]
|
||||
public I_TransferTerminusResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.TransferTerminusRequest; }
|
||||
[BsonIgnore] public I_TransferTerminusResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.TransferTerminusRequest;
|
||||
}
|
||||
|
||||
public Terminus Terminus { get; set; }
|
||||
}
|
||||
|
||||
public partial class I_TransferTerminusResponse : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.TransferTerminusResponse; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.TransferTerminusResponse;
|
||||
}
|
||||
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于服务器之间获取漫游的TerminusId。
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class I_GetTerminusIdRequest : AMessage, IRouteRequest
|
||||
{
|
||||
[ProtoIgnore]
|
||||
public I_GetTerminusIdResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.GetTerminusIdRequest; }
|
||||
[ProtoMember(1)]
|
||||
public int RoamingType { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long SessionRuntimeId { get; set; }
|
||||
[ProtoIgnore] public I_GetTerminusIdResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.GetTerminusIdRequest;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public int RoamingType { get; set; }
|
||||
[ProtoMember(2)] public long SessionRuntimeId { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class I_GetTerminusIdResponse : AMessage, IRouteResponse
|
||||
{
|
||||
public uint OpCode() { return Fantasy.Network.OpCode.GetTerminusIdResponse; }
|
||||
[ProtoMember(1)]
|
||||
public long TerminusId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
public uint OpCode()
|
||||
{
|
||||
return Fantasy.Network.OpCode.GetTerminusIdResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long TerminusId { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -53,7 +53,6 @@ namespace Fantasy.Scheduler
|
||||
case OpCodeType.OuterPingRequest:
|
||||
{
|
||||
// 注意心跳目前只有外网才才会有、内网之间不需要心跳。
|
||||
|
||||
session.LastReceiveTime = TimeHelper.Now;
|
||||
_pingResponse.Now = session.LastReceiveTime;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -17,6 +18,7 @@ using Fantasy.Serialize;
|
||||
using Fantasy.Network.Route;
|
||||
using Fantasy.Platform.Net;
|
||||
using Fantasy.Network.Roaming;
|
||||
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#endif
|
||||
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
@@ -36,15 +38,18 @@ namespace Fantasy.Network
|
||||
{
|
||||
private uint _rpcId;
|
||||
internal long LastReceiveTime;
|
||||
|
||||
/// <summary>
|
||||
/// 关联的网络连接通道
|
||||
/// </summary>
|
||||
internal INetworkChannel Channel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前Session的终结点信息
|
||||
/// </summary>
|
||||
public IPEndPoint RemoteEndPoint { get; private set; }
|
||||
private ANetworkMessageScheduler NetworkMessageScheduler { get; set;}
|
||||
|
||||
private ANetworkMessageScheduler NetworkMessageScheduler { get; set; }
|
||||
internal readonly Dictionary<long, FTask<IResponse>> RequestCallback = new();
|
||||
/// <summary>
|
||||
/// Session的Dispose委托
|
||||
@@ -54,7 +59,8 @@ namespace Fantasy.Network
|
||||
internal RouteComponent RouteComponent;
|
||||
internal SessionRoamingComponent SessionRoamingComponent;
|
||||
internal AddressableRouteComponent AddressableRouteComponent;
|
||||
internal static Session Create(ANetworkMessageScheduler networkMessageScheduler, ANetworkServerChannel channel, NetworkTarget networkTarget)
|
||||
internal static Session Create(ANetworkMessageScheduler networkMessageScheduler, ANetworkServerChannel channel,
|
||||
NetworkTarget networkTarget)
|
||||
{
|
||||
var session = Entity.Create<Session>(channel.Scene, false, true);
|
||||
session.Channel = channel;
|
||||
@@ -69,6 +75,7 @@ namespace Fantasy.Network
|
||||
var timeOut = ProcessDefine.SessionIdleCheckerTimeout;
|
||||
session.AddComponent<SessionIdleCheckerComponent>().Start(interval, timeOut);
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
#endif
|
||||
@@ -152,7 +159,7 @@ namespace Fantasy.Network
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_rpcId = 0;
|
||||
LastReceiveTime = 0;
|
||||
Channel = null;
|
||||
@@ -170,11 +177,11 @@ namespace Fantasy.Network
|
||||
{
|
||||
requestCallback.SetException(new Exception($"session is dispose: {Id}"));
|
||||
}
|
||||
|
||||
|
||||
RequestCallback.Clear();
|
||||
OnDispose?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送一个消息
|
||||
/// </summary>
|
||||
@@ -187,10 +194,10 @@ namespace Fantasy.Network
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Channel.Send(rpcId, routeId, null, message);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送一个消息
|
||||
/// </summary>
|
||||
@@ -206,7 +213,7 @@ namespace Fantasy.Network
|
||||
|
||||
Channel.Send(rpcId, routeId, null, routeMessage);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送一个RPC消息
|
||||
/// </summary>
|
||||
@@ -219,14 +226,14 @@ namespace Fantasy.Network
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
var requestCallback = FTask<IResponse>.Create();
|
||||
var rpcId = ++_rpcId;
|
||||
var rpcId = ++_rpcId;
|
||||
RequestCallback.Add(rpcId, requestCallback);
|
||||
Send(request, rpcId, routeId);
|
||||
return requestCallback;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送一个RPC消息
|
||||
/// </summary>
|
||||
@@ -239,9 +246,9 @@ namespace Fantasy.Network
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
var requestCallback = FTask<IResponse>.Create();
|
||||
var rpcId = ++_rpcId;
|
||||
var rpcId = ++_rpcId;
|
||||
RequestCallback.Add(rpcId, requestCallback);
|
||||
Send(request, rpcId, routeId);
|
||||
return requestCallback;
|
||||
@@ -269,4 +276,4 @@ namespace Fantasy.Network
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user