介入网络收发
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using ProtoBuf;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using NBC;
|
||||
using NBC.Network.Interface;
|
||||
using NBC.Serialize;
|
||||
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace NBC
|
||||
@@ -15,7 +15,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2A_RegisterRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Username = default;
|
||||
@@ -24,18 +23,14 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2A_RegisterRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public A2C_RegisterResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2A_RegisterRequest;
|
||||
[ProtoIgnore]
|
||||
public A2C_RegisterResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2A_RegisterRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string Username { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Username { get; set; }
|
||||
[ProtoMember(2)] public string Password { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class A2C_RegisterResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
@@ -43,7 +38,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<A2C_RegisterResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -51,15 +45,10 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<A2C_RegisterResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.A2C_RegisterResponse;
|
||||
public uint OpCode() { return OuterOpcode.A2C_RegisterResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class C2A_LoginRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
@@ -67,7 +56,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2A_LoginRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Username = default;
|
||||
@@ -77,19 +65,16 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2A_LoginRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public A2C_LoginResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2A_LoginRequest;
|
||||
[ProtoIgnore]
|
||||
public A2C_LoginResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2A_LoginRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string Username { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public string Password { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public int LoginType { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Username { get; set; }
|
||||
[ProtoMember(2)] public string Password { get; set; }
|
||||
[ProtoMember(3)] public int LoginType { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class A2C_LoginResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
@@ -97,7 +82,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<A2C_LoginResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -106,16 +90,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<A2C_LoginResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.A2C_LoginResponse;
|
||||
public uint OpCode() { return OuterOpcode.A2C_LoginResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string ToKen { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string ToKen { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 客户端登录到Gate服务器
|
||||
/// </summary>
|
||||
@@ -126,7 +106,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_LoginRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ToKen = default;
|
||||
@@ -134,17 +113,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2G_LoginRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public G2C_LoginResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2G_LoginRequest;
|
||||
[ProtoIgnore]
|
||||
public G2C_LoginResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_LoginRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string ToKen { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string ToKen { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class G2C_LoginResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
@@ -152,7 +126,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_LoginResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -161,16 +134,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<G2C_LoginResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.G2C_LoginResponse;
|
||||
public uint OpCode() { return OuterOpcode.G2C_LoginResponse; }
|
||||
[ProtoMember(1)]
|
||||
public GameAccountInfo GameAccountInfo { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public GameAccountInfo GameAccountInfo { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知客户端重复登录
|
||||
/// </summary>
|
||||
@@ -181,20 +150,14 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_RepeatLogin>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_RepeatLogin>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.G2C_RepeatLogin;
|
||||
public uint OpCode() { return OuterOpcode.G2C_RepeatLogin; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GameAccount实体类
|
||||
/// </summary>
|
||||
@@ -205,7 +168,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<GameAccountInfo>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
CreateTime = default;
|
||||
@@ -214,11 +176,11 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<GameAccountInfo>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public long CreateTime { get; set; }
|
||||
[ProtoMember(2)] public long LoginTime { get; set; }
|
||||
[ProtoMember(1)]
|
||||
public long CreateTime { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long LoginTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拿到当前账号的信息
|
||||
/// </summary>
|
||||
@@ -229,22 +191,16 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_GetAccountInfoRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_GetAccountInfoRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public G2C_GetAccountInfoResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2G_GetAccountInfoRequest;
|
||||
[ProtoIgnore]
|
||||
public G2C_GetAccountInfoResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_GetAccountInfoRequest; }
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class G2C_GetAccountInfoResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
@@ -252,7 +208,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_GetAccountInfoResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -261,16 +216,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<G2C_GetAccountInfoResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.G2C_GetAccountInfoResponse;
|
||||
public uint OpCode() { return OuterOpcode.G2C_GetAccountInfoResponse; }
|
||||
[ProtoMember(1)]
|
||||
public GameAccountInfo GameAccountInfo { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public GameAccountInfo GameAccountInfo { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class C2G_TestMessage : AMessage, IMessage, IProto
|
||||
{
|
||||
@@ -278,7 +229,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_TestMessage>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
@@ -286,15 +236,10 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2G_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2G_TestMessage;
|
||||
public uint OpCode() { return OuterOpcode.C2G_TestMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class C2G_TestRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
@@ -302,7 +247,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_TestRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
@@ -310,17 +254,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2G_TestRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public G2C_TestResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2G_TestRequest;
|
||||
[ProtoIgnore]
|
||||
public G2C_TestResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_TestRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class G2C_TestResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
@@ -328,7 +267,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_TestResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -337,16 +275,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<G2C_TestResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.G2C_TestResponse;
|
||||
public uint OpCode() { return OuterOpcode.G2C_TestResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class C2G_CreateAddressableRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
@@ -354,22 +288,16 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_CreateAddressableRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_CreateAddressableRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public G2C_CreateAddressableResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2G_CreateAddressableRequest;
|
||||
[ProtoIgnore]
|
||||
public G2C_CreateAddressableResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_CreateAddressableRequest; }
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class G2C_CreateAddressableResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
@@ -377,7 +305,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_CreateAddressableResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -385,15 +312,10 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<G2C_CreateAddressableResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.G2C_CreateAddressableResponse;
|
||||
public uint OpCode() { return OuterOpcode.G2C_CreateAddressableResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class C2M_TestMessage : AMessage, IAddressableRouteMessage, IProto
|
||||
{
|
||||
@@ -401,7 +323,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2M_TestMessage>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
@@ -409,15 +330,10 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2M_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2M_TestMessage;
|
||||
public uint OpCode() { return OuterOpcode.C2M_TestMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class C2M_TestRequest : AMessage, IAddressableRouteRequest, IProto
|
||||
{
|
||||
@@ -425,7 +341,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2M_TestRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
@@ -433,17 +348,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2M_TestRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public M2C_TestResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2M_TestRequest;
|
||||
[ProtoIgnore]
|
||||
public M2C_TestResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2M_TestRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class M2C_TestResponse : AMessage, IAddressableRouteResponse, IProto
|
||||
{
|
||||
@@ -451,7 +361,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<M2C_TestResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -460,16 +369,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<M2C_TestResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.M2C_TestResponse;
|
||||
public uint OpCode() { return OuterOpcode.M2C_TestResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知Gate服务器创建一个Chat的Route连接
|
||||
/// </summary>
|
||||
@@ -480,22 +385,16 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_CreateChatRouteRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_CreateChatRouteRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public G2C_CreateChatRouteResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2G_CreateChatRouteRequest;
|
||||
[ProtoIgnore]
|
||||
public G2C_CreateChatRouteResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_CreateChatRouteRequest; }
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class G2C_CreateChatRouteResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
@@ -503,7 +402,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_CreateChatRouteResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -511,15 +409,10 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<G2C_CreateChatRouteResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.G2C_CreateChatRouteResponse;
|
||||
public uint OpCode() { return OuterOpcode.G2C_CreateChatRouteResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public uint ErrorCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送一个Route消息给Chat
|
||||
/// </summary>
|
||||
@@ -530,7 +423,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestMessage>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
@@ -538,16 +430,12 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2Chat_TestMessage;
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestMessage; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => NBC.RouteType.ChatRoute;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoIgnore] public int RouteType => NBC.RouteType.ChatRoute;
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送一个RPCRoute消息给Chat
|
||||
/// </summary>
|
||||
@@ -558,7 +446,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Chat_TestMessageRequest>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
@@ -566,18 +453,14 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<C2Chat_TestMessageRequest>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[ProtoIgnore] public Chat2C_TestMessageResponse ResponseType { get; set; }
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.C2Chat_TestMessageRequest;
|
||||
[ProtoIgnore]
|
||||
public Chat2C_TestMessageResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Chat_TestMessageRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => NBC.RouteType.ChatRoute;
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoIgnore] public int RouteType => NBC.RouteType.ChatRoute;
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public partial class Chat2C_TestMessageResponse : AMessage, ICustomRouteResponse, IProto
|
||||
{
|
||||
@@ -585,7 +468,6 @@ namespace NBC
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Chat2C_TestMessageResponse>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
@@ -594,13 +476,10 @@ namespace NBC
|
||||
GetScene().MessagePoolComponent.Return<Chat2C_TestMessageResponse>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public uint OpCode()
|
||||
{
|
||||
return OuterOpcode.Chat2C_TestMessageResponse;
|
||||
}
|
||||
|
||||
[ProtoMember(1)] public string Tag { get; set; }
|
||||
[ProtoMember(2)] public uint ErrorCode { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.Chat2C_TestMessageResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf5bc579defd25640b8f277220459410
|
||||
guid: ac16629ba2ddb4832bfc3548b7a92da0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc84d27ae0bdf764fb50b6d543cbcf7e
|
||||
guid: 79e8bd7cb8ff94462a0108fac5149a46
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76b668cc0db30b34ab2a64d695b14ac4
|
||||
guid: 93ff0f8f28d294cdab3c6346d873065d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBC
|
||||
@@ -73,10 +74,34 @@ namespace NBC
|
||||
private async FTask StartAsync()
|
||||
{
|
||||
// 初始化框架
|
||||
await NBC.Platform.Unity.Entry.Initialize(GetType().Assembly);
|
||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
List<System.Reflection.Assembly> loadAssemblies = new List<System.Reflection.Assembly>();
|
||||
foreach (var assembly in assemblies)
|
||||
{
|
||||
// 跳过系统程序集以提高性能(可选)
|
||||
if (IsSystemAssembly(assembly))
|
||||
continue;
|
||||
loadAssemblies.Add(assembly);
|
||||
}
|
||||
|
||||
await NBC.Platform.Unity.Entry.Initialize(loadAssemblies.ToArray());
|
||||
_scene = await Scene.Create(SceneRuntimeMode.MainThread);
|
||||
UI = _scene.AddComponent<UIComponent>();
|
||||
OnInitialized?.Invoke();
|
||||
}
|
||||
|
||||
// 判断是否是系统程序集(可选优化)
|
||||
private static bool IsSystemAssembly(System.Reflection.Assembly assembly)
|
||||
{
|
||||
string assemblyName = assembly.FullName;
|
||||
return assemblyName.StartsWith("System") ||
|
||||
assemblyName.StartsWith("Microsoft.") ||
|
||||
assemblyName.StartsWith("UnityEngine") ||
|
||||
assemblyName.StartsWith("UnityEditor") ||
|
||||
assemblyName.StartsWith("mscorlib") ||
|
||||
assemblyName.StartsWith("netstandard") ||
|
||||
assemblyName.StartsWith("nunit.") ||
|
||||
assemblyName.StartsWith("Unity.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,8 +72,9 @@ namespace NBC.Network.Interface
|
||||
|
||||
private void LoadInner(long assemblyIdentity)
|
||||
{
|
||||
var nmsl = AssemblySystem.ForEach(assemblyIdentity, typeof(IMessage));
|
||||
// 遍历所有实现了IMessage接口的类型,获取OpCode并添加到_networkProtocols字典中
|
||||
foreach (var type in AssemblySystem.ForEach(assemblyIdentity, typeof(IMessage)))
|
||||
foreach (var type in nmsl)
|
||||
{
|
||||
var obj = (IMessage) Activator.CreateInstance(type);
|
||||
var opCode = obj.OpCode();
|
||||
|
||||
@@ -231,6 +231,7 @@ namespace NBC.PacketParser
|
||||
var memoryStreamLength = 0;
|
||||
var messageType = message.GetType();
|
||||
var memoryStream = Network.MemoryStreamBufferPool.RentMemoryStream(MemoryStreamBufferSource.Pack);
|
||||
var nmsl = message.OpCode();
|
||||
OpCodeIdStruct opCodeIdStruct = message.OpCode();
|
||||
memoryStream.Seek(Packet.OuterPacketHeadLength, SeekOrigin.Begin);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Assets.Scripts.Hotfix;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
using NBC.Network;
|
||||
using NBC.Platform.Unity;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.Video;
|
||||
@@ -150,18 +151,31 @@ namespace NBF
|
||||
|
||||
private async FTask OnLoginButtonClick()
|
||||
{
|
||||
// NBC.Platform.Unity.Entry.Initialize(GetType().Assembly);
|
||||
|
||||
// 根据用户名来选择目标的鉴权服务器
|
||||
// 根据鉴权服务器地址来创建一个新的网络会话
|
||||
_session = SessionHelper.CreateSession(App.Main, "127.0.0.1:20001", OnConnectComplete,
|
||||
OnConnectFail,
|
||||
OnConnectDisconnect);
|
||||
|
||||
var acc = "test001";
|
||||
|
||||
// // 发送一个注册的请求消息到目标服务器
|
||||
// var responseReg = (A2C_RegisterResponse)await _session.Call(new C2A_RegisterRequest()
|
||||
// {
|
||||
// Username = acc,
|
||||
// Password = acc
|
||||
// });
|
||||
|
||||
// 发送登录的请求给服务器
|
||||
var response = (A2C_LoginResponse)await _session.Call(new C2A_LoginRequest()
|
||||
{
|
||||
Username = "test001",
|
||||
Password = "test001",
|
||||
Username = acc,
|
||||
Password = acc,
|
||||
LoginType = 1
|
||||
});
|
||||
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"登录发生错误{response.ErrorCode}");
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AKeyCode_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003Fd1_003F01a95d3a_003FKeyCode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F314938d17f3848e8ac683e11b27f62ee46ae00_003Fe8_003F01e5a04a_003FList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObject_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003F35_003F4c34802c_003FObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObject_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F314938d17f3848e8ac683e11b27f62ee46ae00_003F0d_003F47ff7f51_003FObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APhysics_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F03ef825315384b1cab81c4b53eb03d922ac00_003Fc6_003F12ad2f00_003FPhysics_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARect_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003F42_003F3681f1e8_003FRect_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARenderChain_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4f75f0eb2d14004826911645c6175d61fbe00_003Fde_003Fedac53d9_003FRenderChain_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
|
||||
Reference in New Issue
Block a user