mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
合理化框架
合理化框架
This commit is contained in:
@@ -2,9 +2,9 @@ namespace TEngine.Core
|
||||
{
|
||||
public class CoreErrorCode
|
||||
{
|
||||
public const int ErrRpcFail = 100000002; // Rpc消息发送失败
|
||||
public const int ErrNotFoundRoute = 100000003; // 没有找到Route消息
|
||||
public const int ErrRouteTimeout = 100000004; // 发送Route消息超时
|
||||
public const int Error_NotFindEntity = 100000008; // 没有找到Entity
|
||||
public const uint ErrRpcFail = 100000002; // Rpc消息发送失败
|
||||
public const uint ErrNotFoundRoute = 100000003; // 没有找到Route消息
|
||||
public const uint ErrRouteTimeout = 100000004; // 发送Route消息超时
|
||||
public const uint Error_NotFindEntity = 100000008; // 没有找到Entity
|
||||
}
|
||||
}
|
@@ -399,12 +399,6 @@ namespace TEngine
|
||||
|
||||
public void Deserialize(Scene scene, bool resetId = false)
|
||||
{
|
||||
if (IsDisposed)
|
||||
{
|
||||
Log.Error($"component is Disposed {this.GetType().FullName}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (RuntimeId != 0)
|
||||
{
|
||||
return;
|
||||
|
@@ -70,7 +70,7 @@ namespace TEngine
|
||||
public void CreateSession(string remoteAddress, NetworkProtocolType networkProtocolType, Action onConnectComplete, Action onConnectFail, int connectTimeout = 5000)
|
||||
{
|
||||
var address = NetworkHelper.ToIPEndPoint(remoteAddress);
|
||||
var clientNetworkComponent = AddComponent<ClientNetworkComponent>();
|
||||
var clientNetworkComponent = GetComponent<ClientNetworkComponent>() ?? AddComponent<ClientNetworkComponent>();
|
||||
clientNetworkComponent.Initialize(networkProtocolType, NetworkTarget.Outer);
|
||||
clientNetworkComponent.Connect(address, onConnectComplete, onConnectFail, connectTimeout);
|
||||
Session = clientNetworkComponent.Session;
|
||||
|
@@ -246,7 +246,7 @@ public sealed class ProtoBufExporter
|
||||
{
|
||||
opcodeInfo.Code += ++_aResponse;
|
||||
file.AppendLine("\t\t[ProtoMember(91, IsRequired = true)]");
|
||||
file.AppendLine("\t\tpublic int ErrorCode { get; set; }");
|
||||
file.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -263,7 +263,7 @@ public sealed class ProtoBufExporter
|
||||
{
|
||||
opcodeInfo.Code += ++_aRouteResponse;
|
||||
file.AppendLine("\t\t[ProtoMember(91, IsRequired = true)]");
|
||||
file.AppendLine("\t\tpublic int ErrorCode { get; set; }");
|
||||
file.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
|
||||
}
|
||||
|
||||
break;
|
||||
|
@@ -112,7 +112,7 @@ namespace TEngine.Core.Network
|
||||
|
||||
if (networkId != 0 && channelId != 0)
|
||||
{
|
||||
NetworkThread.Instance.SynchronizationContext.Post(() =>
|
||||
NetworkThread.Instance?.SynchronizationContext.Post(() =>
|
||||
{
|
||||
NetworkThread.Instance?.RemoveChannel(networkId, channelId);
|
||||
});
|
||||
|
@@ -212,7 +212,7 @@ namespace TEngine.Core.Network
|
||||
}
|
||||
}
|
||||
#endif
|
||||
public void FailResponse(Session session, IRouteRequest iRouteRequest, int error, uint rpcId)
|
||||
public void FailResponse(Session session, IRouteRequest iRouteRequest, uint error, uint rpcId)
|
||||
{
|
||||
var response = CreateResponse(iRouteRequest, error);
|
||||
session.Send(response, rpcId);
|
||||
@@ -223,7 +223,7 @@ namespace TEngine.Core.Network
|
||||
return new RouteResponse();
|
||||
}
|
||||
|
||||
public IResponse CreateResponse(Type requestType, int error)
|
||||
public IResponse CreateResponse(Type requestType, uint error)
|
||||
{
|
||||
IResponse response;
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace TEngine.Core.Network
|
||||
return response;
|
||||
}
|
||||
|
||||
public IResponse CreateResponse(IRequest iRequest, int error)
|
||||
public IResponse CreateResponse(IRequest iRequest, uint error)
|
||||
{
|
||||
IResponse response;
|
||||
|
||||
@@ -257,7 +257,7 @@ namespace TEngine.Core.Network
|
||||
return response;
|
||||
}
|
||||
|
||||
public IRouteResponse CreateResponse(IRouteRequest iRouteRequest, int error)
|
||||
public IRouteResponse CreateResponse(IRouteRequest iRouteRequest, uint error)
|
||||
{
|
||||
IRouteResponse response;
|
||||
|
||||
|
@@ -12,6 +12,6 @@ namespace TEngine.Core.Network
|
||||
|
||||
public interface IResponse : IMessage
|
||||
{
|
||||
int ErrorCode { get; set; }
|
||||
uint ErrorCode { get; set; }
|
||||
}
|
||||
}
|
@@ -12,7 +12,7 @@ namespace TEngine
|
||||
}
|
||||
|
||||
[ProtoMember(90)] public long RpcId { get; set; }
|
||||
[ProtoMember(91, IsRequired = true)] public int ErrorCode { get; set; }
|
||||
[ProtoMember(91, IsRequired = true)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
@@ -24,7 +24,7 @@ namespace TEngine
|
||||
}
|
||||
|
||||
[ProtoMember(90)] public long RpcId { get; set; }
|
||||
[ProtoMember(91, IsRequired = true)] public int ErrorCode { get; set; }
|
||||
[ProtoMember(91, IsRequired = true)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public class PingRequest : AProto, IRequest
|
||||
@@ -46,7 +46,7 @@ namespace TEngine
|
||||
}
|
||||
|
||||
[ProtoMember(90)] public long RpcId { get; set; }
|
||||
[ProtoMember(91, IsRequired = true)] public int ErrorCode { get; set; }
|
||||
[ProtoMember(91, IsRequired = true)] public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)] public long Now;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -69,7 +69,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return Opcode.AddressableAddResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询一个可寻址
|
||||
@@ -89,7 +89,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return Opcode.AddressableGetResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public long RouteId { get; set; }
|
||||
}
|
||||
@@ -111,7 +111,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return Opcode.AddressableRemoveResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 锁定一个可寻址
|
||||
@@ -131,7 +131,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return Opcode.AddressableLockResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 解锁一个可寻址
|
||||
@@ -155,6 +155,6 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return Opcode.AddressableUnLockResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
}
|
@@ -34,7 +34,7 @@ namespace GameLogic
|
||||
}
|
||||
|
||||
//Remark 这里图方便注册错误码文本,正常应该走文本配置表。
|
||||
public static Dictionary<int, string> ErrCodeTextMap = new Dictionary<int, string>
|
||||
public static Dictionary<uint, string> ErrCodeTextMap = new Dictionary<uint, string>
|
||||
{
|
||||
{
|
||||
ErrorCode.ERR_AccountAlreadyRegisted, "账户已经被注册了"
|
||||
|
@@ -33,7 +33,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return OuterOpcode.H_G2C_MessageResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public string Message { get; set; }
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return OuterOpcode.H_G2C_LoginAddressResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送一个Address消息给Map
|
||||
@@ -105,7 +105,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return OuterOpcode.H_M2C_MessageResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public string Message { get; set; }
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return OuterOpcode.H_G2C_LoginResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public uint UID { get; set; }
|
||||
[ProtoMember(2)]
|
||||
@@ -177,7 +177,7 @@ namespace TEngine
|
||||
{
|
||||
public uint OpCode() { return OuterOpcode.H_G2C_RegisterResponse; }
|
||||
[ProtoMember(91, IsRequired = true)]
|
||||
public int ErrorCode { get; set; }
|
||||
public uint ErrorCode { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public uint UID { get; set; }
|
||||
}
|
||||
|
Reference in New Issue
Block a user